How denesis0-0/booking-platform-api works
This Go service exposes a REST API for managing bookable resources, their time slots, and confirmed or cancelled bookings. The main workflow is an API client request routed by the server to an HTTP handler, which validates input and invokes PostgreSQL-backed storage; available-slot queries exclude confirmed bookings, and the database’s partial unique index prevents duplicate active bookings. The README documents the API capabilities and schema. Edges reflect shown calls or documented behavior; unsampled migration details are limited to the README’s stated uniqueness guarantee.
Main entry points: main.go HTTP server · handler.go Request handlers · slots.go Slot storage · bookings.go Booking storage
Components 10
Runtime and configuration
- HTTP server
cmd/api/main.go - Runtime config
internal/config/config.go
HTTP API
- Request handlers
internal/httpapi/handler.go
Persistence
- Postgres pool
internal/storage/postgres.go - Resource storage
internal/storage/resources.go - Slot storage
internal/storage/slots.go - Booking storage
internal/storage/bookings.go - Booking schema
migrations/001_create_tables.sql
Other components
- API client
- PostgreSQL
Connections 16
- API client → HTTP server: sends requests
README.md - HTTP server → Runtime config: loads config
cmd/api/main.go - HTTP server → Postgres pool: opens pool
cmd/api/main.go - HTTP server → Request handlers: registers routes
cmd/api/main.go - HTTP server → API client: serves responses
cmd/api/main.go - Request handlers → Postgres pool: checks health
internal/httpapi/handler.go - Request handlers → Resource storage: manages resources
internal/httpapi/handler.go - Request handlers → Slot storage: manages slots
internal/httpapi/handler.go - Request handlers → Booking storage: manages bookings
internal/httpapi/handler.go - Postgres pool → PostgreSQL: connects pool
internal/storage/postgres.go - Resource storage → PostgreSQL: reads and writes
internal/storage/resources.go - Slot storage → PostgreSQL: queries slots
internal/storage/slots.go - Booking storage → PostgreSQL: queries bookings
internal/storage/bookings.go - Booking schema → PostgreSQL: defines tables
README.md - Slot storage → PostgreSQL: filters confirmed bookings
internal/storage/slots.go - Booking storage → PostgreSQL: enforces unique active slot
README.md