mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-10-31 18:19:43 +00:00
The sender can require photo or audio proof when sending any dare, catalogue or custom. The recipient captures and uploads the proof as a new couple-scoped 'dare_proof' media kind and attaches it on submit; the server enforces ownership, kind, couple, and MIME-type match. The proof renders inline on the dare card for the sender to review before confirming completion. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
17 lines
1.0 KiB
SQL
17 lines
1.0 KiB
SQL
-- Optional proof-of-completion for dares. The sender picks a requirement
|
|
-- ('none', 'photo', 'audio') at send time for both catalogue and custom dares;
|
|
-- the recipient attaches a media object when submitting.
|
|
ALTER TABLE sent_dares ADD COLUMN IF NOT EXISTS proof_type text NOT NULL DEFAULT 'none';
|
|
--> statement-breakpoint
|
|
ALTER TABLE sent_dares DROP CONSTRAINT IF EXISTS sent_dares_proof_type_check;
|
|
ALTER TABLE sent_dares ADD CONSTRAINT sent_dares_proof_type_check
|
|
CHECK (proof_type IN ('none', 'photo', 'audio'));
|
|
--> statement-breakpoint
|
|
ALTER TABLE sent_dares ADD COLUMN IF NOT EXISTS proof_media_id uuid REFERENCES media_objects(id) ON DELETE SET NULL;
|
|
--> statement-breakpoint
|
|
CREATE INDEX IF NOT EXISTS sent_dares_proof_media_idx ON sent_dares(proof_media_id) WHERE proof_media_id IS NOT NULL;
|
|
--> statement-breakpoint
|
|
ALTER TABLE media_objects DROP CONSTRAINT IF EXISTS media_objects_kind_check;
|
|
ALTER TABLE media_objects ADD CONSTRAINT media_objects_kind_check
|
|
CHECK (kind IN ('avatar', 'response', 'chat', 'feedback', 'dare_proof'));
|