refactor(bookings): simplify capacity tracking to use seats

Replace 'pax' booking mode with 'seat'
Consolidate inventory summary to track only seat counts
Update database schema and UI for seat-centric capacity
This commit is contained in:
2026-04-13 08:49:54 +08:00
parent c47d0d287e
commit faa998c7e1
12 changed files with 136 additions and 139 deletions

View File

@@ -7,15 +7,15 @@ export default defineEventHandler(async (event) => {
await requireRole(event, 'super_admin')
const body = await readBody<{
totalTables?: number | string | null
totalSeats?: number | string | null
}>(event)
const input = parseBookingCapacityInput(body)
const summary = await getBookingInventorySummary()
assertBadRequest(
input.totalTables === null || (input.totalTables * 10) >= summary.soldCapacitySeats,
`Total tables cannot be lower than the currently sold capacity of ${summary.soldTables} tables and ${summary.soldSeats} seats`
input.totalSeats === null || input.totalSeats >= summary.soldSeats,
`Total seats cannot be lower than the currently sold count of ${summary.soldSeats} seats`
)
const settings = await updateBookingCapacitySettings(input)