feat: v2.2 batch (calendar, self-service, sort, description, filename search, stats, collab, invoice) on pre-redesign base

This commit is contained in:
Leon Tonhäuser committed 2026-11-30 21:20:13 +01:00
1 parent 453bece72c
commit 7204dd6b60
108 files changed
+10400 -105

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
CREATE TABLE "calendar_events" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"title" text NOT NULL,
"event_date" date NOT NULL,
"immich_album_id" text,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"created_by_user_id" uuid
);
--> statement-breakpoint
CREATE TABLE "event_responses" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"event_id" uuid NOT NULL,
"editorial_account_id" uuid NOT NULL,
"status" text NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "event_responses_status_check" CHECK ("event_responses"."status" in ('attending', 'not_attending'))
);
--> statement-breakpoint
CREATE TABLE "release_notes" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"version" text NOT NULL,
"audience" text DEFAULT 'both' NOT NULL,
"body" text NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"created_by_user_id" uuid,
CONSTRAINT "release_notes_audience_check" CHECK ("release_notes"."audience" in ('admin', 'editorial', 'both')),
CONSTRAINT "release_notes_version_check" CHECK ("release_notes"."version" ~ '^[0-9]+\.[0-9]+(\.[0-9]+)?$')
);
--> statement-breakpoint
ALTER TABLE "album_grants" ADD COLUMN "source" text DEFAULT 'admin' NOT NULL;--> statement-breakpoint
ALTER TABLE "calendar_events" ADD CONSTRAINT "calendar_events_created_by_user_id_user_id_fk" FOREIGN KEY ("created_by_user_id") REFERENCES "public"."user"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "event_responses" ADD CONSTRAINT "event_responses_event_id_calendar_events_id_fk" FOREIGN KEY ("event_id") REFERENCES "public"."calendar_events"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "event_responses" ADD CONSTRAINT "event_responses_editorial_account_id_editorial_accounts_id_fk" FOREIGN KEY ("editorial_account_id") REFERENCES "public"."editorial_accounts"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "release_notes" ADD CONSTRAINT "release_notes_created_by_user_id_user_id_fk" FOREIGN KEY ("created_by_user_id") REFERENCES "public"."user"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
CREATE UNIQUE INDEX "event_responses_event_editorial_unique" ON "event_responses" USING btree ("event_id","editorial_account_id");--> statement-breakpoint
CREATE UNIQUE INDEX "release_notes_version_audience_unique" ON "release_notes" USING btree ("version","audience");--> statement-breakpoint
ALTER TABLE "album_grants" ADD CONSTRAINT "album_grants_source_check" CHECK ("album_grants"."source" in ('admin', 'auto_rule', 'self_service'));--> statement-breakpoint
-- Seed the version notes: 2.0.0 documents the existing portal as the baseline,
-- 2.1.0 documents this release. Idempotent so re-runs never duplicate rows.
INSERT INTO "release_notes" ("version", "audience", "body", "created_by_user_id")
VALUES
('2.0.0', 'both', 'Basisversion des Redaktionsportals: Albumfreigaben mit automatischen Regeln, Suche über alle Alben, Merkzettel, Wasserzeichen-Vorschauen, lizenzierte Downloads mit automatischer Abrechnung, Hinweise des Fotografen und Zwei-Faktor-Schutz für Admins.', NULL),
('2.1.0', 'editorial', 'Neu in 2.1: Fotos lassen sich in der Album-Suche und in der Suche über alle Alben nach ältesten und neuesten sortieren. Die Bildbeschreibung wird jetzt in der Großansicht angezeigt. Der neue Kalender zeigt kommende Termine, Sie können je Termin zurückmelden, ob Sie da sind. Event-Alben aus dem Kalender können Sie selbst freischalten und sofort öffnen. Das Logo im Kopfbereich ist wieder sichtbar.', NULL),
('2.1.0', 'admin', 'Neu in 2.1: Kalender unter /admin/kalender (Termine anlegen, Alben verknüpfen, Zusagen der Redaktionen einsehen). Redaktionen schalten Kalender-Alben selbst frei, jeder Selbstzugriff wird im Audit protokolliert und lässt sich unter Alben entziehen. Versionshinweise werden unter /admin/versionen gepflegt. Sortierung und Bildbeschreibung in der Redaktionssuche, Logo im Kopfbereich korrigiert.', NULL)
ON CONFLICT ("version", "audience") DO NOTHING;