feat(bookings): allow editing and soft-deleting bookings

Add edit modal to update guest details, ticket selection, and quantity
Implement soft delete functionality to archive bookings
This commit is contained in:
2026-05-08 15:57:32 +08:00
parent 1318e766d5
commit e05c238495
7 changed files with 754 additions and 14 deletions

View File

@@ -0,0 +1,31 @@
import type { DeleteBookingResponse } from '~~/shared/booking'
import { requireAuth } from '../../utils/auth'
import { getBookingById, softDeleteBooking } from '../../utils/booking-repository'
import { getRequiredRouteParam, httpError } from '../../utils/http'
export default defineEventHandler(async (event): Promise<DeleteBookingResponse> => {
const auth = await requireAuth(event)
const bookingId = getRequiredRouteParam(event, 'id', 'Booking ID')
const existingBooking = await getBookingById(bookingId, auth.user.role === 'super_admin'
? undefined
: { personInChargeId: auth.user.id })
if (!existingBooking) {
httpError(404, 'Booking not found')
}
const booking = await softDeleteBooking({
bookingId,
personInChargeId: auth.user.role === 'super_admin' ? undefined : auth.user.id
})
if (!booking) {
httpError(404, 'Booking not found')
}
return {
booking
}
})