From 71110208a9b2442c8756390c032eb77a94fcd50c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Tonh=C3=A4user?= Date: Mon, 30 Nov 2026 22:38:32 +0100 Subject: [PATCH] Release 2.2.1: quarterly billing and Sakani form polish - Billing is always quarterly: the billing page opens the current quarter, the month view is gone, old ?month= links land in their quarter and invalid quarters no longer throw. - Calendar and release-note forms and the RSVP buttons use Sakani components (Card, Input, Textarea, FormSelect, Button, Alert). - Sidebar logo stays visible in dark mode (Sakani's logo tile is light). - Release notes for 2.2.1 seeded via custom migration 0004; popup version bumped. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 3 +- AI_MEMORY.md | 1 + drizzle/0004_release_notes_2_2_1.sql | 6 + drizzle/meta/0004_snapshot.json | 2491 +++++++++++++++++ drizzle/meta/_journal.json | 7 + .../[editorialId]/BillingSelection.test.tsx | 43 +- .../[editorialId]/BillingSelection.tsx | 71 +- .../[editorialId]/page-content.test.ts | 13 + .../[editorialId]/page-content.ts | 72 +- .../admin/abrechnungen/[editorialId]/page.tsx | 2 - src/app/admin/abrechnungen/page.tsx | 2 +- src/app/admin/kalender/CalendarEventForm.tsx | 92 +- src/app/admin/versionen/ReleaseNoteForm.tsx | 93 +- .../redaktion/kalender/EventRsvpButtons.tsx | 20 +- src/components/layout/app-shell.tsx | 8 +- src/components/layout/release-notes.tsx | 3 +- 16 files changed, 2653 insertions(+), 274 deletions(-) create mode 100644 drizzle/0004_release_notes_2_2_1.sql create mode 100644 drizzle/meta/0004_snapshot.json create mode 100644 src/app/admin/abrechnungen/[editorialId]/page-content.test.ts diff --git a/AGENTS.md b/AGENTS.md index 12704ed..2fbe66e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -24,7 +24,8 @@ Bei jedem neuen Feature, jeder Änderung und jedem Fix im Portal: Aktueller Stand: siehe neueste Einträge in `release_notes` (Basis `2.0.0`, Kalender/Selbstbedienung/Sortierung/Beschreibung: `2.1.0`, -Dateiname-Suche: `2.1.1`, Statistik/Collab/Rechnungsversand: `2.2.0`). +Dateiname-Suche: `2.1.1`, Statistik/Collab/Rechnungsversand: `2.2.0`, +Quartalsabrechnung + Sakani-Formulare: `2.2.1`). ## Sicherheit (bei jeder Änderung mitprüfen) diff --git a/AI_MEMORY.md b/AI_MEMORY.md index 3c8b5b5..b42d6b5 100644 --- a/AI_MEMORY.md +++ b/AI_MEMORY.md @@ -79,4 +79,5 @@ Redaktionen können Bilder durchsuchen, einen Leuchtkasten verwenden, Bilder her - **Fingerprint-Kompatibilität (WICHTIG):** `requestFingerprint` für `new_usage` DARF nicht um neue Felder (z. B. collab) erweitert werden — die historischen Migrationen 0001/0002 rekonstruieren Legacy-Fingerprints aus der alten Payload-Form. Tests in `tests/db/accounting-migration.test.ts` prüfen das. - **Rechnungsversand (2.2.0):** Finalisieren verschickt KEINE E-Mail mehr (Nutzungsnachweis dient der Prüfung; Korrekturen via Collab-Toggle oder Storno + Neu-Finalisierung). Admin lädt die Rechnungs-PDF unter Abrechnungen hoch (`POST /api/billing-reports/[reportId]/invoice`, multipart, %PDF-Magic, max 20 MB, Rate-Limit `invoiceUploadPolicy`). Der Upload speichert (`invoice_pdf`, `invoice_pdf_sha256`, …) und sendet automatisch GEBÜNDELT Rechnung + Nutzungsnachweis (`emailService.sendInvoiceBundle`, Vorlage `invoice-message.ts`). Status `invoice_email_status` (not_sent/sent/failed) + `invoice_email_sent_at`/`invoice_email_error`; „Erneut senden" via `POST …/invoice/resend`, Download via `GET …/invoice`. Audit: `invoice_uploaded`, `invoice_email_sent`, `invoice_email_failed`. - **Activity-Tracking (2.2.0):** `activity_events` (album_view/search/lightbox_view) nur für Browsing; Downloads bleiben in `download_events`. Server-Hooks in den Albumseiten, Lightbox-Beacon `POST /api/activity` (nur lightbox_view). `recordActivity` ist fire-and-forget: validiert, rate-limited (`activityPolicy` 240/60s), schluckt alle Fehler. Statistikseite `/admin/statistiken` (`src/modules/stats/queries.ts`, Zeitraum 7/30/90 Tage via `zeitraum`): KPI-Karten mit Trend-Pills (Vorperiode), Recharts Area/Bar (lazy, ssr:false, Theme-Farben), Top-Redaktionen/Alben, offene Umsätze, letzte Aktivitäten. SakaniUI-Elemente: Pill-Segmented-Control, Uppercase-Muted-Labels, Tabular-Nums, Hover-Shadow. +- **Quartalsabrechnung (2.2.1):** Abgerechnet wird immer quartalsweise. `resolvePeriod` (`src/app/admin/abrechnungen/[editorialId]/page-content.ts`) liefert nur Quartale; alte `?month=`-Links landen im passenden Quartal, ungültige Werte im aktuellen. Die Billing-APIs akzeptieren weiter `month`, das UI sendet nur `quarter`. Mail-Betreff: `Ihre Rechnung für Q4 2026`. Seed der Versionshinweise: `drizzle/0004_release_notes_2_2_1.sql` (Custom-Migration ohne Schemaänderung). - **Lokale Verifikation (tmp/, gitignored):** Dev-Server `NEXT_DISABLE_TURBOPACK=1 next dev` (Port 3000), Mock-Immich :2283 (inkl. `/original`), Mock-SMTP :587 (`tmp/mock-smtp.mjs`, loggt nach `tmp/mock-smtp.log`), DB-Container `portal-clickthrough-db` :5433. BetterAuth-Sign-In-Limit 5/15min liegt IM SPEICHER des Dev-Servers — vor jedem Click-Through-Lauf Dev-Server neu starten; die Spec cached Session-Cookies nach dem ersten Login (`loginCached`). `tmp/dev-seed.ts` ist idempotent: User per E-Mail auflösen (signUp mit existierender E-Mail liefert Phantom-User ohne Persistenz!), 2FA-Setup überspringen wenn verified, Rechnungsadresse anlegen. Click-Through: `node_modules/.bin/playwright test --config tmp/playwright.config.ts` (7 Tests, Reset via beforeAll, FK-Reihenfolge beachten: items → download_events → usages → billing_reports). diff --git a/drizzle/0004_release_notes_2_2_1.sql b/drizzle/0004_release_notes_2_2_1.sql new file mode 100644 index 0000000..1d0e00e --- /dev/null +++ b/drizzle/0004_release_notes_2_2_1.sql @@ -0,0 +1,6 @@ +-- Custom SQL migration file, put your code below! -- +INSERT INTO "release_notes" ("version", "audience", "body", "created_by_user_id") +VALUES + ('2.2.1', 'admin', 'Abrechnungen laufen jetzt immer quartalsweise: Die Abrechnungsseite öffnet direkt das aktuelle Quartal, die Monatsansicht entfällt. Das Logo in der Seitenleiste ist im dunklen Design wieder sichtbar. Die Formulare für Kalender und Versionshinweise nutzen jetzt das einheitliche Portal-Design.', NULL), + ('2.2.1', 'editorial', 'Die Rückmeldung zu Kalender-Terminen (Bin da / Bin nicht da) passt sich jetzt dem hellen und dunklen Design an, und das Logo in der Seitenleiste ist im dunklen Design wieder sichtbar.', NULL) +ON CONFLICT ("version", "audience") DO NOTHING; diff --git a/drizzle/meta/0004_snapshot.json b/drizzle/meta/0004_snapshot.json new file mode 100644 index 0000000..b481da7 --- /dev/null +++ b/drizzle/meta/0004_snapshot.json @@ -0,0 +1,2491 @@ +{ + "id": "b051f9ca-ec38-4d8a-a1ce-d4dbc9754cbd", + "prevId": "2da521e8-f513-403e-84a8-db5502923df2", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.activity_events": { + "name": "activity_events", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "editorial_account_id": { + "name": "editorial_account_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "immich_album_id": { + "name": "immich_album_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "immich_asset_id": { + "name": "immich_asset_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "query": { + "name": "query", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "occurred_at": { + "name": "occurred_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "activity_events_occurred_at_idx": { + "name": "activity_events_occurred_at_idx", + "columns": [ + { + "expression": "occurred_at", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "activity_events_editorial_occurred_idx": { + "name": "activity_events_editorial_occurred_idx", + "columns": [ + { + "expression": "editorial_account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "occurred_at", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "activity_events_type_occurred_idx": { + "name": "activity_events_type_occurred_idx", + "columns": [ + { + "expression": "event_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "occurred_at", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "activity_events_editorial_account_id_editorial_accounts_id_fk": { + "name": "activity_events_editorial_account_id_editorial_accounts_id_fk", + "tableFrom": "activity_events", + "columnsFrom": [ + "editorial_account_id" + ], + "tableTo": "editorial_accounts", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "activity_events_event_type_check": { + "name": "activity_events_event_type_check", + "value": "\"activity_events\".\"event_type\" in ('album_view', 'search', 'lightbox_view')" + } + }, + "isRLSEnabled": false + }, + "public.album_grants": { + "name": "album_grants", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "editorial_account_id": { + "name": "editorial_account_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "immich_album_id": { + "name": "immich_album_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "granted_at": { + "name": "granted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "revoked_at": { + "name": "revoked_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "granted_by_user_id": { + "name": "granted_by_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'admin'" + } + }, + "indexes": { + "album_grants_editorial_account_id_idx": { + "name": "album_grants_editorial_account_id_idx", + "columns": [ + { + "expression": "editorial_account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "album_grants_immich_album_id_idx": { + "name": "album_grants_immich_album_id_idx", + "columns": [ + { + "expression": "immich_album_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "album_grants_editorial_active_album_unique": { + "name": "album_grants_editorial_active_album_unique", + "columns": [ + { + "expression": "editorial_account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "lower(\"immich_album_id\")", + "isExpression": true, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "where": "\"album_grants\".\"revoked_at\" is null", + "concurrently": false + } + }, + "foreignKeys": { + "album_grants_editorial_account_id_editorial_accounts_id_fk": { + "name": "album_grants_editorial_account_id_editorial_accounts_id_fk", + "tableFrom": "album_grants", + "columnsFrom": [ + "editorial_account_id" + ], + "tableTo": "editorial_accounts", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + }, + "album_grants_granted_by_user_id_user_id_fk": { + "name": "album_grants_granted_by_user_id_user_id_fk", + "tableFrom": "album_grants", + "columnsFrom": [ + "granted_by_user_id" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "album_grants_immich_album_id_uuid_check": { + "name": "album_grants_immich_album_id_uuid_check", + "value": "\"album_grants\".\"immich_album_id\" ~* '^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'" + }, + "album_grants_source_check": { + "name": "album_grants_source_check", + "value": "\"album_grants\".\"source\" in ('admin', 'auto_rule', 'self_service')" + } + }, + "isRLSEnabled": false + }, + "public.announcements": { + "name": "announcements", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "event_date": { + "name": "event_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by_user_id": { + "name": "created_by_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "announcements_created_by_user_id_user_id_fk": { + "name": "announcements_created_by_user_id_user_id_fk", + "tableFrom": "announcements", + "columnsFrom": [ + "created_by_user_id" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.audit_events": { + "name": "audit_events", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "actor_user_id": { + "name": "actor_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "actor_type": { + "name": "actor_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'system'" + }, + "entity_type": { + "name": "entity_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "previous_values": { + "name": "previous_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "new_values": { + "name": "new_values", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "occurred_at": { + "name": "occurred_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "request_id": { + "name": "request_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "audit_events_actor_user_id_user_id_fk": { + "name": "audit_events_actor_user_id_user_id_fk", + "tableFrom": "audit_events", + "columnsFrom": [ + "actor_user_id" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.account": { + "name": "account", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "account_user_id_user_id_fk": { + "name": "account_user_id_user_id_fk", + "tableFrom": "account", + "columnsFrom": [ + "user_id" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "columnsFrom": [ + "user_id" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "session_token_unique": { + "name": "session_token_unique", + "columns": [ + "token" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.two_factor": { + "name": "two_factor", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "secret": { + "name": "secret", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "backup_codes": { + "name": "backup_codes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "verified": { + "name": "verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "failed_verification_count": { + "name": "failed_verification_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "locked_until": { + "name": "locked_until", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "two_factor_user_id_user_id_fk": { + "name": "two_factor_user_id_user_id_fk", + "tableFrom": "two_factor", + "columnsFrom": [ + "user_id" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "two_factor_user_id_unique": { + "name": "two_factor_user_id_unique", + "columns": [ + "user_id" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email_verified": { + "name": "email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "portal_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'EDITORIAL'" + }, + "two_factor_enabled": { + "name": "two_factor_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_email_unique": { + "name": "user_email_unique", + "columns": [ + "email" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verification": { + "name": "verification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.album_auto_rules": { + "name": "album_auto_rules", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "editorial_account_id": { + "name": "editorial_account_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "keyword": { + "name": "keyword", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by_user_id": { + "name": "created_by_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "album_auto_rules_editorial_account_id_keyword_idx": { + "name": "album_auto_rules_editorial_account_id_keyword_idx", + "columns": [ + { + "expression": "editorial_account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "lower(\"keyword\")", + "isExpression": true, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "album_auto_rules_editorial_account_id_editorial_accounts_id_fk": { + "name": "album_auto_rules_editorial_account_id_editorial_accounts_id_fk", + "tableFrom": "album_auto_rules", + "columnsFrom": [ + "editorial_account_id" + ], + "tableTo": "editorial_accounts", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + }, + "album_auto_rules_created_by_user_id_user_id_fk": { + "name": "album_auto_rules_created_by_user_id_user_id_fk", + "tableFrom": "album_auto_rules", + "columnsFrom": [ + "created_by_user_id" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.billing_report_items": { + "name": "billing_report_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "billing_report_id": { + "name": "billing_report_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "usage_id": { + "name": "usage_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "immich_asset_id_snapshot": { + "name": "immich_asset_id_snapshot", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "filename_snapshot": { + "name": "filename_snapshot", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "album_name_snapshot": { + "name": "album_name_snapshot", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "purpose_snapshot": { + "name": "purpose_snapshot", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "internal_reference_snapshot": { + "name": "internal_reference_snapshot", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "price_cents": { + "name": "price_cents", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "collab": { + "name": "collab", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "billing_report_items_report_usage_unique": { + "name": "billing_report_items_report_usage_unique", + "columns": [ + { + "expression": "billing_report_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "usage_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "billing_report_items_billing_report_id_billing_reports_id_fk": { + "name": "billing_report_items_billing_report_id_billing_reports_id_fk", + "tableFrom": "billing_report_items", + "columnsFrom": [ + "billing_report_id" + ], + "tableTo": "billing_reports", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + }, + "billing_report_items_usage_id_usages_id_fk": { + "name": "billing_report_items_usage_id_usages_id_fk", + "tableFrom": "billing_report_items", + "columnsFrom": [ + "usage_id" + ], + "tableTo": "usages", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.billing_reports": { + "name": "billing_reports", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "report_number": { + "name": "report_number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "editorial_account_id": { + "name": "editorial_account_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "period_starts_at": { + "name": "period_starts_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "period_ends_at": { + "name": "period_ends_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "billing_address_snapshot": { + "name": "billing_address_snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "invoice_number": { + "name": "invoice_number", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "net_total_cents": { + "name": "net_total_cents", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "flatrate_cents_snapshot": { + "name": "flatrate_cents_snapshot", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "report_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'draft'" + }, + "pdf": { + "name": "pdf", + "type": "bytea", + "primaryKey": false, + "notNull": false + }, + "pdf_sha256": { + "name": "pdf_sha256", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "invoice_pdf": { + "name": "invoice_pdf", + "type": "bytea", + "primaryKey": false, + "notNull": false + }, + "invoice_pdf_sha256": { + "name": "invoice_pdf_sha256", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "invoice_pdf_filename": { + "name": "invoice_pdf_filename", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "invoice_uploaded_at": { + "name": "invoice_uploaded_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "invoice_email_status": { + "name": "invoice_email_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'not_sent'" + }, + "invoice_email_sent_at": { + "name": "invoice_email_sent_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "invoice_email_error": { + "name": "invoice_email_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by_user_id": { + "name": "created_by_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "finalized_at": { + "name": "finalized_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "cancelled_at": { + "name": "cancelled_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "cancellation_reason": { + "name": "cancellation_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cancelled_by_user_id": { + "name": "cancelled_by_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "billing_reports_report_number_unique": { + "name": "billing_reports_report_number_unique", + "columns": [ + { + "expression": "report_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + }, + "billing_reports_invoice_number_unique": { + "name": "billing_reports_invoice_number_unique", + "columns": [ + { + "expression": "invoice_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "billing_reports_editorial_account_id_editorial_accounts_id_fk": { + "name": "billing_reports_editorial_account_id_editorial_accounts_id_fk", + "tableFrom": "billing_reports", + "columnsFrom": [ + "editorial_account_id" + ], + "tableTo": "editorial_accounts", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + }, + "billing_reports_created_by_user_id_user_id_fk": { + "name": "billing_reports_created_by_user_id_user_id_fk", + "tableFrom": "billing_reports", + "columnsFrom": [ + "created_by_user_id" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + }, + "billing_reports_cancelled_by_user_id_user_id_fk": { + "name": "billing_reports_cancelled_by_user_id_user_id_fk", + "tableFrom": "billing_reports", + "columnsFrom": [ + "cancelled_by_user_id" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "billing_reports_pdf_sha256_hex_check": { + "name": "billing_reports_pdf_sha256_hex_check", + "value": "\"billing_reports\".\"pdf_sha256\" ~ '^[0-9a-f]{64}$'" + }, + "billing_reports_invoice_pdf_sha256_hex_check": { + "name": "billing_reports_invoice_pdf_sha256_hex_check", + "value": "\"billing_reports\".\"invoice_pdf_sha256\" IS NULL OR \"billing_reports\".\"invoice_pdf_sha256\" ~ '^[0-9a-f]{64}$'" + }, + "billing_reports_invoice_email_status_check": { + "name": "billing_reports_invoice_email_status_check", + "value": "\"billing_reports\".\"invoice_email_status\" in ('not_sent', 'sent', 'failed')" + }, + "billing_reports_final_pdf_check": { + "name": "billing_reports_final_pdf_check", + "value": "\"billing_reports\".\"status\" <> 'final' OR (\"billing_reports\".\"pdf\" IS NOT NULL AND \"billing_reports\".\"pdf_sha256\" IS NOT NULL)" + } + }, + "isRLSEnabled": false + }, + "public.calendar_events": { + "name": "calendar_events", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "event_date": { + "name": "event_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "immich_album_id": { + "name": "immich_album_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by_user_id": { + "name": "created_by_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "calendar_events_created_by_user_id_user_id_fk": { + "name": "calendar_events_created_by_user_id_user_id_fk", + "tableFrom": "calendar_events", + "columnsFrom": [ + "created_by_user_id" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.event_responses": { + "name": "event_responses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "event_id": { + "name": "event_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "editorial_account_id": { + "name": "editorial_account_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "event_responses_event_editorial_unique": { + "name": "event_responses_event_editorial_unique", + "columns": [ + { + "expression": "event_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "editorial_account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "event_responses_event_id_calendar_events_id_fk": { + "name": "event_responses_event_id_calendar_events_id_fk", + "tableFrom": "event_responses", + "columnsFrom": [ + "event_id" + ], + "tableTo": "calendar_events", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + }, + "event_responses_editorial_account_id_editorial_accounts_id_fk": { + "name": "event_responses_editorial_account_id_editorial_accounts_id_fk", + "tableFrom": "event_responses", + "columnsFrom": [ + "editorial_account_id" + ], + "tableTo": "editorial_accounts", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "event_responses_status_check": { + "name": "event_responses_status_check", + "value": "\"event_responses\".\"status\" in ('attending', 'not_attending')" + } + }, + "isRLSEnabled": false + }, + "public.billing_address_versions": { + "name": "billing_address_versions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "editorial_account_id": { + "name": "editorial_account_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "company_name": { + "name": "company_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "contact_name": { + "name": "contact_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "address_line_1": { + "name": "address_line_1", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "address_line_2": { + "name": "address_line_2", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "postal_code": { + "name": "postal_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "city": { + "name": "city", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country_code": { + "name": "country_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "valid_from": { + "name": "valid_from", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "superseded_by_id": { + "name": "superseded_by_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_by_user_id": { + "name": "created_by_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "billing_address_versions_editorial_account_id_editorial_accounts_id_fk": { + "name": "billing_address_versions_editorial_account_id_editorial_accounts_id_fk", + "tableFrom": "billing_address_versions", + "columnsFrom": [ + "editorial_account_id" + ], + "tableTo": "editorial_accounts", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + }, + "billing_address_versions_superseded_by_id_billing_address_versions_id_fk": { + "name": "billing_address_versions_superseded_by_id_billing_address_versions_id_fk", + "tableFrom": "billing_address_versions", + "columnsFrom": [ + "superseded_by_id" + ], + "tableTo": "billing_address_versions", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + }, + "billing_address_versions_created_by_user_id_user_id_fk": { + "name": "billing_address_versions_created_by_user_id_user_id_fk", + "tableFrom": "billing_address_versions", + "columnsFrom": [ + "created_by_user_id" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.editorial_accounts": { + "name": "editorial_accounts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "contact_name": { + "name": "contact_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "login_email": { + "name": "login_email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "account_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending_email'" + }, + "current_price_cents": { + "name": "current_price_cents", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "flatrate_active": { + "name": "flatrate_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "flatrate_price_cents": { + "name": "flatrate_price_cents", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "flatrate_asset_limit": { + "name": "flatrate_asset_limit", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "collab_enabled": { + "name": "collab_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "approval_notice_status": { + "name": "approval_notice_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'not_requested'" + }, + "current_billing_address_version_id": { + "name": "current_billing_address_version_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "email_verified_at": { + "name": "email_verified_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "accepted_terms_version": { + "name": "accepted_terms_version", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "accepted_terms_at": { + "name": "accepted_terms_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "privacy_acknowledged_at": { + "name": "privacy_acknowledged_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "archived_by_user_id": { + "name": "archived_by_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "editorial_accounts_user_id_user_id_fk": { + "name": "editorial_accounts_user_id_user_id_fk", + "tableFrom": "editorial_accounts", + "columnsFrom": [ + "user_id" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + }, + "editorial_accounts_current_billing_address_version_id_billing_address_versions_id_fk": { + "name": "editorial_accounts_current_billing_address_version_id_billing_address_versions_id_fk", + "tableFrom": "editorial_accounts", + "columnsFrom": [ + "current_billing_address_version_id" + ], + "tableTo": "billing_address_versions", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + }, + "editorial_accounts_archived_by_user_id_user_id_fk": { + "name": "editorial_accounts_archived_by_user_id_user_id_fk", + "tableFrom": "editorial_accounts", + "columnsFrom": [ + "archived_by_user_id" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "editorial_accounts_user_id_unique": { + "name": "editorial_accounts_user_id_unique", + "columns": [ + "user_id" + ], + "nullsNotDistinct": false + }, + "editorial_accounts_login_email_unique": { + "name": "editorial_accounts_login_email_unique", + "columns": [ + "login_email" + ], + "nullsNotDistinct": false + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.lightbox_items": { + "name": "lightbox_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "editorial_account_id": { + "name": "editorial_account_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "asset_id": { + "name": "asset_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "added_at": { + "name": "added_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "lightbox_items_editorial_asset_idx": { + "name": "lightbox_items_editorial_asset_idx", + "columns": [ + { + "expression": "editorial_account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "asset_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "lightbox_items_editorial_account_id_editorial_accounts_id_fk": { + "name": "lightbox_items_editorial_account_id_editorial_accounts_id_fk", + "tableFrom": "lightbox_items", + "columnsFrom": [ + "editorial_account_id" + ], + "tableTo": "editorial_accounts", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rate_limits": { + "name": "rate_limits", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "window_boundary": { + "name": "window_boundary", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "count": { + "name": "count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "rate_limits_key_window_boundary_pk": { + "name": "rate_limits_key_window_boundary_pk", + "columns": [ + "key", + "window_boundary" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.release_notes": { + "name": "release_notes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "audience": { + "name": "audience", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'both'" + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by_user_id": { + "name": "created_by_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "release_notes_version_audience_unique": { + "name": "release_notes_version_audience_unique", + "columns": [ + { + "expression": "version", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "audience", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "release_notes_created_by_user_id_user_id_fk": { + "name": "release_notes_created_by_user_id_user_id_fk", + "tableFrom": "release_notes", + "columnsFrom": [ + "created_by_user_id" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "release_notes_audience_check": { + "name": "release_notes_audience_check", + "value": "\"release_notes\".\"audience\" in ('admin', 'editorial', 'both')" + }, + "release_notes_version_check": { + "name": "release_notes_version_check", + "value": "\"release_notes\".\"version\" ~ '^[0-9]+\\.[0-9]+(\\.[0-9]+)?$'" + } + }, + "isRLSEnabled": false + }, + "public.download_events": { + "name": "download_events", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "editorial_account_id": { + "name": "editorial_account_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "usage_id": { + "name": "usage_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "immich_asset_id": { + "name": "immich_asset_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "authorized_at": { + "name": "authorized_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "started_at": { + "name": "started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "download_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'authorized'" + }, + "transferred_bytes": { + "name": "transferred_bytes", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "repeat_download_note": { + "name": "repeat_download_note", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "request_id": { + "name": "request_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "idempotency_key": { + "name": "idempotency_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "intent_kind": { + "name": "intent_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'new_usage'" + }, + "request_fingerprint": { + "name": "request_fingerprint", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true + }, + "legacy_intent": { + "name": "legacy_intent", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "download_events_editorial_authorized_id_idx": { + "name": "download_events_editorial_authorized_id_idx", + "columns": [ + { + "expression": "editorial_account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "authorized_at", + "isExpression": false, + "asc": false, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "download_events_editorial_idempotency_key_unique": { + "name": "download_events_editorial_idempotency_key_unique", + "columns": [ + { + "expression": "editorial_account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "idempotency_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "download_events_editorial_account_id_editorial_accounts_id_fk": { + "name": "download_events_editorial_account_id_editorial_accounts_id_fk", + "tableFrom": "download_events", + "columnsFrom": [ + "editorial_account_id" + ], + "tableTo": "editorial_accounts", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + }, + "download_events_usage_id_usages_id_fk": { + "name": "download_events_usage_id_usages_id_fk", + "tableFrom": "download_events", + "columnsFrom": [ + "usage_id" + ], + "tableTo": "usages", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "download_events_intent_kind_check": { + "name": "download_events_intent_kind_check", + "value": "\"download_events\".\"intent_kind\" in ('new_usage', 'repeat_download', 'legacy')" + }, + "download_events_request_fingerprint_hex_check": { + "name": "download_events_request_fingerprint_hex_check", + "value": "\"download_events\".\"request_fingerprint\" ~ '^[0-9a-f]{64}$'" + }, + "download_events_canonical_idempotency_key_check": { + "name": "download_events_canonical_idempotency_key_check", + "value": "\"download_events\".\"legacy_intent\" OR \"download_events\".\"idempotency_key\" ~ '^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'" + }, + "download_events_canonical_immich_asset_id_check": { + "name": "download_events_canonical_immich_asset_id_check", + "value": "\"download_events\".\"immich_asset_id\" ~ '^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'" + } + }, + "isRLSEnabled": false + }, + "public.usages": { + "name": "usages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "editorial_account_id": { + "name": "editorial_account_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "immich_asset_id": { + "name": "immich_asset_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "filename_snapshot": { + "name": "filename_snapshot", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "immich_album_id_snapshot": { + "name": "immich_album_id_snapshot", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "album_name_snapshot": { + "name": "album_name_snapshot", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "purpose": { + "name": "purpose", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "internal_reference": { + "name": "internal_reference", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "price_cents": { + "name": "price_cents", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "collab": { + "name": "collab", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "billing_status": { + "name": "billing_status", + "type": "usage_billing_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'open'" + }, + "billing_report_id": { + "name": "billing_report_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "usages_editorial_created_id_idx": { + "name": "usages_editorial_created_id_idx", + "columns": [ + { + "expression": "editorial_account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": false, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + }, + "usages_created_at_idx": { + "name": "usages_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "with": {}, + "method": "btree", + "concurrently": false + } + }, + "foreignKeys": { + "usages_editorial_account_id_editorial_accounts_id_fk": { + "name": "usages_editorial_account_id_editorial_accounts_id_fk", + "tableFrom": "usages", + "columnsFrom": [ + "editorial_account_id" + ], + "tableTo": "editorial_accounts", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + }, + "usages_billing_report_id_billing_reports_id_fk": { + "name": "usages_billing_report_id_billing_reports_id_fk", + "tableFrom": "usages", + "columnsFrom": [ + "billing_report_id" + ], + "tableTo": "billing_reports", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "usages_canonical_immich_asset_id_check": { + "name": "usages_canonical_immich_asset_id_check", + "value": "\"usages\".\"immich_asset_id\" ~ '^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'" + }, + "usages_canonical_immich_album_id_check": { + "name": "usages_canonical_immich_album_id_check", + "value": "\"usages\".\"immich_album_id_snapshot\" ~ '^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'" + } + }, + "isRLSEnabled": false + } + }, + "enums": { + "public.portal_role": { + "name": "portal_role", + "schema": "public", + "values": [ + "ADMIN", + "EDITORIAL" + ] + }, + "public.report_status": { + "name": "report_status", + "schema": "public", + "values": [ + "draft", + "final", + "cancelled" + ] + }, + "public.account_status": { + "name": "account_status", + "schema": "public", + "values": [ + "pending_email", + "pending_approval", + "active", + "suspended", + "rejected" + ] + }, + "public.download_status": { + "name": "download_status", + "schema": "public", + "values": [ + "authorized", + "streaming", + "completed", + "failed_before_delivery", + "interrupted" + ] + }, + "public.usage_billing_status": { + "name": "usage_billing_status", + "schema": "public", + "values": [ + "open", + "billed", + "reopened", + "voided" + ] + } + }, + "schemas": {}, + "views": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index c8eb1b4..2298930 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -29,6 +29,13 @@ "when": 1796067598623, "tag": "0003_collab_invoice_activity", "breakpoints": true + }, + { + "idx": 4, + "version": "7", + "when": 1796073940910, + "tag": "0004_release_notes_2_2_1", + "breakpoints": true } ] } \ No newline at end of file diff --git a/src/app/admin/abrechnungen/[editorialId]/BillingSelection.test.tsx b/src/app/admin/abrechnungen/[editorialId]/BillingSelection.test.tsx index 1e8036e..4166f50 100644 --- a/src/app/admin/abrechnungen/[editorialId]/BillingSelection.test.tsx +++ b/src/app/admin/abrechnungen/[editorialId]/BillingSelection.test.tsx @@ -70,10 +70,8 @@ const defaultProps = { editorialId: "e1", repeatDownloads: [] as RepeatDownloadPosition[], year: 2026, - month: 8 as number | null, - quarter: null as number | null, - isQuarter: false, - periodLabel: "August 2026", + quarter: 3, + periodLabel: "Q3 2026", reports: [] as FinalizedReportSummary[], }; @@ -110,7 +108,7 @@ test("disables the checkbox for billed positions and shows report reference", () expect(screen.getByText(/RE-2026-042/)).toBeTruthy(); }); -test("selects all open positions via Alle offenen im Monat", () => { +test("selects all open positions via Alle offenen im Quartal", () => { render( { />, ); - fireEvent.click(screen.getByRole("button", { name: /Alle offenen im Monat/i })); + fireEvent.click(screen.getByRole("button", { name: /Alle offenen im Quartal/i })); expect(getCheckbox("jubel.jpg").checked).toBe(true); expect(getCheckbox("redaktion.jpg").checked).toBe(true); @@ -149,7 +147,7 @@ test("displays selected count and cents-derived EUR total", () => { />, ); - fireEvent.click(screen.getByRole("button", { name: /Alle offenen im Monat/i })); + fireEvent.click(screen.getByRole("button", { name: /Alle offenen im Quartal/i })); const summary = container.querySelector(".billing-summary"); expect(summary?.textContent ?? "").toMatch(/2 Nutzungen ausgewählt/); @@ -180,30 +178,11 @@ test("shows empty state when no billable positions exist", () => { expect(screen.getByText(/Keine abrechenbaren Nutzungen/)).toBeTruthy(); }); -test("links to quarter view from month view", () => { - render( - , - ); +test("offers only quarterly periods", () => { + render(); - const quarterLink = screen.getByRole("link", { name: /Ganzes Quartal/i }); - expect(quarterLink.getAttribute("href") ?? "").toContain("quarter=3"); + expect(screen.queryByRole("link", { name: /Monatsansicht/i })).toBeNull(); + expect(screen.queryByText("Monat")).toBeNull(); + expect(screen.getByText("Quartal")).toBeTruthy(); + expect(screen.getByText(/Zeitraum: Q3 2026/)).toBeTruthy(); }); - -test("links to month view from quarter view", () => { - render( - , - ); - - const monthLink = screen.getByRole("link", { name: /Monatsansicht/i }); - expect(monthLink.getAttribute("href") ?? "").toContain("month="); -}); \ No newline at end of file diff --git a/src/app/admin/abrechnungen/[editorialId]/BillingSelection.tsx b/src/app/admin/abrechnungen/[editorialId]/BillingSelection.tsx index d30615f..844e5c2 100644 --- a/src/app/admin/abrechnungen/[editorialId]/BillingSelection.tsx +++ b/src/app/admin/abrechnungen/[editorialId]/BillingSelection.tsx @@ -1,7 +1,6 @@ "use client"; import { useMemo, useState } from "react"; -import Link from "next/link"; import { Alert, Badge, Checkbox, EmptyState, Table, Textarea } from "@sakaniui/react"; import { IconDownload, IconFileText } from "@sakaniui/react/icons"; @@ -17,28 +16,11 @@ type BillingSelectionProps = { positions: BillingPosition[]; repeatDownloads: RepeatDownloadPosition[]; year: number; - month: number | null; - quarter: number | null; - isQuarter: boolean; + quarter: number; periodLabel: string; reports: FinalizedReportSummary[]; }; -const MONTHS = [ - "Januar", - "Februar", - "März", - "April", - "Mai", - "Juni", - "Juli", - "August", - "September", - "Oktober", - "November", - "Dezember", -]; - const STATUS_LABELS: Record = { open: "Offen", billed: "Abgerechnet", @@ -62,9 +44,7 @@ export function BillingSelection({ positions, repeatDownloads, year, - month, quarter, - isQuarter, periodLabel, reports, }: BillingSelectionProps) { @@ -107,7 +87,7 @@ export function BillingSelection({ setSelectedIds(new Set()); } - const periodPayload = { year, ...(isQuarter ? { quarter: quarter ?? 1 } : { month: month ?? 1 }) }; + const periodPayload = { year, quarter }; async function handlePreview() { if (selectedIds.size === 0) return; @@ -195,22 +175,14 @@ export function BillingSelection({ } } - const quarterParam = isQuarter ? null : Math.ceil((month ?? 1) / 3); - const quarterHref = quarter - ? `/admin/abrechnungen/${editorialId}?year=${year}&quarter=${quarter}` - : `/admin/abrechnungen/${editorialId}?year=${year}&quarter=${quarterParam}`; - const monthHref = `/admin/abrechnungen/${editorialId}?year=${year}&month=${month ?? (quarter ? (quarter - 1) * 3 + 1 : new Date().getUTCMonth() + 1)}`; return ( <> - +
- diff --git a/src/app/admin/abrechnungen/[editorialId]/page-content.test.ts b/src/app/admin/abrechnungen/[editorialId]/page-content.test.ts new file mode 100644 index 0000000..553cdd4 --- /dev/null +++ b/src/app/admin/abrechnungen/[editorialId]/page-content.test.ts @@ -0,0 +1,13 @@ +import { expect, test } from "vitest"; + +import { resolvePeriod } from "./page-content"; + +test("resolvePeriod is always quarterly", () => { + expect(resolvePeriod({ year: "2026", quarter: "4" })).toMatchObject({ year: 2026, quarter: 4, periodLabel: "Q4 2026" }); + // Old month links land in their quarter. + expect(resolvePeriod({ year: "2026", month: "8" })).toMatchObject({ quarter: 3, periodLabel: "Q3 2026" }); + // Invalid quarters fall back to the current one instead of throwing. + const current = Math.floor(new Date().getUTCMonth() / 3) + 1; + expect(resolvePeriod({ year: "2026", quarter: "7" }).quarter).toBe(current); + expect(resolvePeriod({}).quarter).toBe(current); +}); diff --git a/src/app/admin/abrechnungen/[editorialId]/page-content.ts b/src/app/admin/abrechnungen/[editorialId]/page-content.ts index d9b229f..907f78f 100644 --- a/src/app/admin/abrechnungen/[editorialId]/page-content.ts +++ b/src/app/admin/abrechnungen/[editorialId]/page-content.ts @@ -5,7 +5,7 @@ import { desc, eq } from "drizzle-orm"; import { db } from "@/db/client"; import { billingReports, editorialAccounts } from "@/db/schema"; import { queries } from "@/modules/billing/queries"; -import { monthPeriod, quarterPeriod, type BillingPeriod } from "@/modules/billing/period"; +import { quarterPeriod, type BillingPeriod } from "@/modules/billing/period"; import type { BillingPosition, RepeatDownloadPosition } from "@/modules/billing/queries"; export type FinalizedReportSummary = { @@ -25,10 +25,8 @@ export type BillingSelectionData = { editorial: { id: string; name: string }; period: BillingPeriod; periodLabel: string; - isQuarter: boolean; year: number; - month: number | null; - quarter: number | null; + quarter: number; positions: BillingPosition[]; repeatDownloads: RepeatDownloadPosition[]; reports: FinalizedReportSummary[]; @@ -45,7 +43,7 @@ export async function loadBillingSelection( .limit(1); if (!editorial) return null; - const { period, isQuarter, year, month, quarter, periodLabel } = resolvePeriod(searchParams); + const { period, year, quarter, periodLabel } = resolvePeriod(searchParams); const [positions, repeatDownloads, reportRows] = await Promise.all([ queries.listBillablePositions(editorialId, period), @@ -72,9 +70,7 @@ export async function loadBillingSelection( editorial, period, periodLabel, - isQuarter, year, - month, quarter, positions, repeatDownloads, @@ -93,60 +89,26 @@ export async function loadBillingSelection( }; } +/** + * Billing is always quarterly. An old `?month=` link resolves to its quarter; + * invalid values fall back to the current quarter. + */ export function resolvePeriod(searchParams: Record): { period: BillingPeriod; - isQuarter: boolean; year: number; - month: number | null; - quarter: number | null; + quarter: number; periodLabel: string; } { const now = new Date(); - const defaultYear = now.getUTCFullYear(); - const defaultMonth = now.getUTCMonth() + 1; - - const year = parseNumberParam(searchParams.year, defaultYear); - const quarterParam = firstParam(searchParams.quarter); - - if (quarterParam !== undefined) { - const quarter = parseNumberParam(searchParams.quarter, Math.floor((defaultMonth - 1) / 3) + 1); - return { - period: quarterPeriod(year, quarter), - isQuarter: true, - year, - month: null, - quarter, - periodLabel: `Q${quarter} ${year}`, - }; - } - - const month = parseNumberParam(searchParams.month, defaultMonth); - return { - period: monthPeriod(year, month), - isQuarter: false, - year, - month, - quarter: null, - periodLabel: monthLabel(year, month), - }; -} - -function monthLabel(year: number, month: number): string { - const names = [ - "Januar", - "Februar", - "März", - "April", - "Mai", - "Juni", - "Juli", - "August", - "September", - "Oktober", - "November", - "Dezember", - ]; - return `${names[month - 1]} ${year}`; + const currentQuarter = Math.floor(now.getUTCMonth() / 3) + 1; + const year = parseNumberParam(searchParams.year, now.getUTCFullYear()); + const month = parseNumberParam(searchParams.month, 0); + const requested = parseNumberParam( + searchParams.quarter, + month >= 1 && month <= 12 ? Math.floor((month - 1) / 3) + 1 : currentQuarter, + ); + const quarter = requested >= 1 && requested <= 4 ? requested : currentQuarter; + return { period: quarterPeriod(year, quarter), year, quarter, periodLabel: `Q${quarter} ${year}` }; } function parseNumberParam( diff --git a/src/app/admin/abrechnungen/[editorialId]/page.tsx b/src/app/admin/abrechnungen/[editorialId]/page.tsx index 6d1d160..711a394 100644 --- a/src/app/admin/abrechnungen/[editorialId]/page.tsx +++ b/src/app/admin/abrechnungen/[editorialId]/page.tsx @@ -32,9 +32,7 @@ export default async function BillingSelectionPage({ positions={data.positions} repeatDownloads={data.repeatDownloads} year={data.year} - month={data.month} quarter={data.quarter} - isQuarter={data.isQuarter} periodLabel={data.periodLabel} reports={data.reports} /> diff --git a/src/app/admin/abrechnungen/page.tsx b/src/app/admin/abrechnungen/page.tsx index 5ce1035..28e342a 100644 --- a/src/app/admin/abrechnungen/page.tsx +++ b/src/app/admin/abrechnungen/page.tsx @@ -27,7 +27,7 @@ export default async function BillingOverviewPage() { kicker="Abrechnungen" title="Redaktionen" titleId="billing-title" - description="Wählen Sie eine Redaktion, um deren abrechenbare Nutzungen für einen Monat oder ein Quartal auszuwählen." + description="Wählen Sie eine Redaktion, um deren abrechenbare Nutzungen für ein Quartal auszuwählen." /> {editorials.length === 0 ? ( diff --git a/src/app/admin/kalender/CalendarEventForm.tsx b/src/app/admin/kalender/CalendarEventForm.tsx index 4340d10..f6704a1 100644 --- a/src/app/admin/kalender/CalendarEventForm.tsx +++ b/src/app/admin/kalender/CalendarEventForm.tsx @@ -2,8 +2,10 @@ import { useId, useState, useTransition } from "react"; +import { Alert, Input } from "@sakaniui/react"; + import { Button } from "@/components/ui/button"; -import { Input } from "@/components/ui/input"; +import { Card, FormSelect } from "@/components/ui/sakani"; import type { CalendarActionResult } from "./actions"; @@ -18,7 +20,6 @@ export function CalendarEventForm({ }>) { const titleId = useId(); const dateId = useId(); - const albumId = useId(); const [state, setState] = useState({ ok: true, message: "" }); const [pending, startTransition] = useTransition(); const [title, setTitle] = useState(""); @@ -34,66 +35,45 @@ export function CalendarEventForm({ }; return ( -
-
- + + setTitle(event.target.value)} + label="Titel (Spielpaarung oder Event)" maxLength={200} - required + name="title" + onChange={(event) => setTitle(event.target.value)} placeholder="z. B. Hamburger SV - VfL Wolfsburg" + required + value={title} /> -

- Ohne direkte Album-Auswahl wird automatisch verknüpft, sobald ein Album exakt - {" „{Titel}“ "}oder{" „{Titel} | TT.MM.JJJJ“ "}heißt (Datum dieses Termins). -

-
-
-
- - +
+
+ +
+
+ ({ label: album.albumName, value: album.id })), + ]} + /> +
-
- - +
+
-
- - {state.message ? ( -

- {state.message} -

- ) : null} - + {state.message ? ( +
+ +
+ ) : null} + + ); } diff --git a/src/app/admin/versionen/ReleaseNoteForm.tsx b/src/app/admin/versionen/ReleaseNoteForm.tsx index 0f2346e..7631c24 100644 --- a/src/app/admin/versionen/ReleaseNoteForm.tsx +++ b/src/app/admin/versionen/ReleaseNoteForm.tsx @@ -2,8 +2,10 @@ import { useId, useState, useTransition } from "react"; +import { Alert, Input, Textarea } from "@sakaniui/react"; + import { Button } from "@/components/ui/button"; -import { Input } from "@/components/ui/input"; +import { Card, FormSelect } from "@/components/ui/sakani"; import type { ReleaseNoteActionResult } from "./actions"; @@ -13,7 +15,6 @@ export function ReleaseNoteForm({ action: (state: ReleaseNoteActionResult, formData: FormData) => Promise; }>) { const versionId = useId(); - const audienceId = useId(); const bodyId = useId(); const [state, setState] = useState({ ok: true, message: "" }); const [pending, startTransition] = useTransition(); @@ -30,62 +31,48 @@ export function ReleaseNoteForm({ }; return ( -
-
-
- - + + +
+
+ +
+
+ +
-
- - -
-
-
- -