Hospitality engine

Remove an area photo

delete/api/areas/{id}/image

Deletes the stored object and nulls image_url. Storage removal is best-effort and its failure does not fail the request.

Authorization

sessionCookie
sb-qxrvgfkjyvbngipqvslu-auth-token<token>

The dashboard's Supabase Auth session cookie, set at sign-in. Large sessions are split across numbered chunks (…auth-token.0, .1), so treat this as a cookie family rather than one name.

Every request re-validates it against the Auth server (getUser()), never by decoding the cookie locally: a JWT nothing has checked is not a credential. Tenancy is then read from the verified app_metadata.company_id claim and enforced by row-level security; it is never read from request input, on any route, ever.

role (admin / staff) is deliberately not in RLS. It gates specific actions in route code, the operations marked admin below, so hiding a button in the UI is cosmetic only, and a route's own check is the enforcement.

In: cookie

Path Parameters

id*string

Area id.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X DELETE "https://example.com/api/areas/string/image"
{  "ok": true}

Upload an area (room) photo POST

A line-for-line mirror of POST /api/services/{id}/image, stored in `area-photos` (migration 0110) instead. Not admin-gated: a photo is part of editing the area, same permission level as PATCH /api/areas/{id}.

Replace a named service period (admin, or manage_services) PUT

Writes a whole period at once: "the period called `name` now runs on exactly these days, with these settings". No active period for a weekday means an empty availability grid that day, so this is the endpoint a venue's bookable times live or die by. **PUT, and wholesale, on purpose.** A day of a period is not an entity an operator names; the PERIOD is, and it is identified by its `name`. There is nothing here for a per-row create to be idempotent about, and the old `POST` (one weekday per call) is what made a restaurant serving lunch and dinner all week fourteen separate writes. **One statement, therefore one transaction.** The whole replacement happens inside `book_replace_service_period_group()` (migration 0029) rather than as a PostgREST delete followed by an insert. That is not tidiness: `computeReservationSlots` returns nothing for a day with no periods, so a delete that landed without its insert would take the venue's booking page **offline** until someone re-saved, not merely degrade it. On any error nothing is written and nothing is lost. Gated to admin, or a staff login granted `manage_services` (migration 0082), hospitality's equivalent of the appointments services routes, and gated the same way: an empty `days` array deletes the group, so this one call is as destructive as it is creative.