New booking dashboard
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import type { UpdateAdminBookingStatusInput } from '@repo/api-contract'
|
||||
import {
|
||||
AdminBookingServiceError,
|
||||
updateAdminBookingStatus,
|
||||
} from '@/modules/admin-booking/services/admin-booking.service'
|
||||
import type { AppContext } from '@/types/hono'
|
||||
|
||||
type BookingIdParams = { id: string }
|
||||
|
||||
export async function updateAdminBookingStatusHandler(c: AppContext) {
|
||||
const { id } = c.req.valid('param' as never) as BookingIdParams
|
||||
const payload = c.req.valid('json' as never) as UpdateAdminBookingStatusInput
|
||||
const appUserId = c.get('appUserId')
|
||||
|
||||
try {
|
||||
const booking = await updateAdminBookingStatus(appUserId, id, payload)
|
||||
return c.json(booking)
|
||||
} catch (error) {
|
||||
if (error instanceof AdminBookingServiceError) {
|
||||
return c.json({ message: error.message }, error.status)
|
||||
}
|
||||
throw error
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user