feat: early check-in / late checkout fees with room-level configuration
- DB migration 016: add early_checkin_fee, late_checkout_fee to rooms table - Backend rooms: support new fee columns in POST/PATCH - Backend hotel-settings GET: also returns check_in_time, check_out_time - Room type + RoomPayload: add earlyCheckinFee, lateCheckoutFee fields - RoomModal: add fee amount inputs in pricing section - SettingsPage: add toggles for early_checkin_enabled / late_checkout_enabled - BookingDetailPanel: on check-in shows fee warning + adds payment record if current time is before checkInTime and fee is set on the room; same logic for check-out after checkOutTime Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -55,6 +55,7 @@ const rooms: FastifyPluginAsync = async (fastify) => {
|
||||
beds?: unknown; housekeeping_status?: string; sort_order?: number
|
||||
allow_hourly?: boolean; hourly_rate?: number; extra_place?: unknown
|
||||
child_policy?: unknown; description?: string; photos?: string[]
|
||||
early_checkin_fee?: number; late_checkout_fee?: number
|
||||
} }>(
|
||||
'/api/hotels/:slug/rooms',
|
||||
{ onRequest: [fastify.authenticate] },
|
||||
@@ -74,15 +75,16 @@ const rooms: FastifyPluginAsync = async (fastify) => {
|
||||
amenities = [], name, category_id, bed_type = 'double',
|
||||
beds, housekeeping_status = 'clean', sort_order = 99,
|
||||
allow_hourly = false, hourly_rate, extra_place, child_policy,
|
||||
description, photos = [],
|
||||
description, photos = [], early_checkin_fee, late_checkout_fee,
|
||||
} = request.body
|
||||
|
||||
const { rows } = await db.query(
|
||||
`INSERT INTO rooms
|
||||
(hotel_id, number, type, floor, max_guests, base_rate, amenities, name,
|
||||
category_id, bed_type, beds, housekeeping_status, sort_order,
|
||||
allow_hourly, hourly_rate, extra_place, child_policy, description, photos)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19)
|
||||
allow_hourly, hourly_rate, extra_place, child_policy, description, photos,
|
||||
early_checkin_fee, late_checkout_fee)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21)
|
||||
RETURNING *`,
|
||||
[
|
||||
hotelId, number, type, floor, max_guests, base_rate,
|
||||
@@ -92,6 +94,7 @@ const rooms: FastifyPluginAsync = async (fastify) => {
|
||||
extra_place ? JSON.stringify(extra_place) : null,
|
||||
child_policy ? JSON.stringify(child_policy) : null,
|
||||
description ?? null, photos,
|
||||
early_checkin_fee ?? null, late_checkout_fee ?? null,
|
||||
],
|
||||
)
|
||||
return reply.code(201).send(rows[0])
|
||||
@@ -139,6 +142,7 @@ const rooms: FastifyPluginAsync = async (fastify) => {
|
||||
'amenities', 'name', 'category_id', 'bed_type', 'beds',
|
||||
'housekeeping_status', 'sort_order', 'allow_hourly', 'hourly_rate',
|
||||
'extra_place', 'child_policy', 'description', 'photos',
|
||||
'early_checkin_fee', 'late_checkout_fee',
|
||||
]
|
||||
const updates: string[] = []
|
||||
const values: unknown[] = []
|
||||
|
||||
Reference in New Issue
Block a user