Initial commit

This commit is contained in:
Jose Selesan
2026-04-08 22:53:11 -03:00
commit 9ae270609d
179 changed files with 28096 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import type { CreatePublicBookingInput } from '@repo/api-contract'
import {
PublicBookingServiceError,
createPublicBooking,
} from '@/modules/public-booking/services/public-booking.service'
import type { AppContext } from '@/types/hono'
type ComplexSlugParams = { complexSlug: string }
export async function createPublicBookingHandler(c: AppContext) {
const { complexSlug } = c.req.valid('param' as never) as ComplexSlugParams
const payload = c.req.valid('json' as never) as CreatePublicBookingInput
try {
const booking = await createPublicBooking(complexSlug, payload)
return c.json(booking, 201)
} catch (error) {
if (error instanceof PublicBookingServiceError) {
return c.json({ message: error.message }, error.status)
}
throw error
}
}