Rumah Singgah — booking rules (engineering baseline)
TL;DR
Only user role accounts may create Rumah Singgah bookings. Enforce at most one booked night per user per calendar month (timezone TBD — default Asia/Jakarta unless client specifies). admin can view (and optionally cancel/override — TBD Friday).
Rules (v0)
- Authentication required to book — anonymous users see info only.
- Role
user — may create bookings subject to monthly cap.
- Role
admin — does not consume end-user quota; uses admin UI (not the public booking form) for oversight.
- Monthly cap — count nights booked (or check-in dates) in the same calendar month for
userId; reject new booking if cap reached.
- One night per booking record — v0 models a single night stay per reservation (multi-night stays out of scope unless client requests).
Implementation notes (simple / deadline-friendly)
- Store bookings in MongoDB with
userId, checkInDate (or nightDate), status, createdAt.
- Enforce cap in Server Action or API route with a unique query: existing booking for same
userId + month before insert.
- Optional DB index:
{ userId: 1, checkInDate: 1 } — add compound guard if single-room inventory later.
- Show clear ID error copy when cap exceeded (e.g. “Anda sudah memesan satu malam di bulan ini.”).
Open (client meeting)
- [ ] Calendar month vs rolling 30 days
- [ ] Timezone for “month” boundary
- [ ] Multiple rooms / concurrent guests
- [ ] Cancellation and re-book same month
- [ ] Admin manual booking or override
Related
- [[Projects/lumendev-museum-ibu-marsinah/backlog/p0-rumah-singgah-booking-one-night-per-month|Backlog — booking feature]]