mirror of
https://github.com/Dvorinka/Bookra.git
synced 2026-10-28 15:51:15 +00:00
Services declare up to 8 intake fields (text/yesno, required) stored as JSONB; shared/intake.go is the single normalization point — slug keys, label/dup/unknown-key rules, yes/no canonicalization. Booking create validates answers against the service declaration (missing required -> 400), unknown keys are dropped before persist. Answers surface on UpcomingBooking and CustomerBookingView; the services page gains a compact editor and the public form renders declared questions under contact details. Verified live end-to-end. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
14 lines
576 B
SQL
14 lines
576 B
SQL
-- +goose Up
|
|
-- Schema-light structured intake: services declare a small list of intake
|
|
-- fields (key/label/type/required); bookings store the customer's answers as
|
|
-- a JSON object keyed by the declared field keys. Both default to empty so
|
|
-- existing services/bookings need no backfill.
|
|
ALTER TABLE services
|
|
ADD COLUMN intake_fields jsonb NOT NULL DEFAULT '[]'::jsonb;
|
|
ALTER TABLE bookings
|
|
ADD COLUMN intake jsonb NOT NULL DEFAULT '{}'::jsonb;
|
|
|
|
-- +goose Down
|
|
ALTER TABLE services DROP COLUMN IF EXISTS intake_fields;
|
|
ALTER TABLE bookings DROP COLUMN IF EXISTS intake;
|