Immich v3 (server runs v3.1.0) returns search `nextPage` as an opaque cursor
string instead of a page number. The client schema validated `nextPage` as
`number`, so every album open failed schema validation and surfaced as
"Fotos momentan nicht erreichbar" (the catalog catch swallows the real
IMMICH_INVALID_RESPONSE into IMMICH_UNAVAILABLE).
Accept `string | number` for nextPage/previousPage in the schema and the
ImmichSearchPage type; we only use nextPage as a has-more-pages signal.
Pagination links are now derived from the current page number (currentPage ± 1)
instead of the returned nextPage value, since the v3 cursor can't be used as a
page number. Album page passes the normalized current page through.
Add a client test locking the v3 cursor-string response.
Co-Authored-By: Claude <noreply@anthropic.com>
Album assignment 500'd with IMMICH_UNAVAILABLE because grantAlbum verified the
album via getAlbum, which pulled the full album incl. all assets — large albums
blew the 15s timeout. Request ?withoutAssets=true so Immich returns metadata
only (no consumer reads .assets); make assets optional in the schema.
Album thumbnails 500'd because next/image rejected the ?albumId= query string
(images.localPatterns). Switch the album page to a plain <img>, matching the
editorial catalog (next/image was used in exactly one place).
Overhaul action error handling: grantAlbumAction/revokeAlbumAction/approveEditorialAction
returned a thrown Error, which Next.js turns into an opaque error-digest page —
the German message never reached the admin. They now return {ok,message}; new
client AlbumGrantForm + ApproveForm use useActionState to show the message
inline. Auth (requireAdmin) still throws (guarded by the layout). Update both
action test files to the result contract.
Co-Authored-By: Claude <noreply@anthropic.com>
Better Auth's parseUserOutput filters the session user to declared fields
only (filterOutputFields over getFields(options,'user','output')). The drizzle
adapter selects the custom `role` column, but because it was never declared in
the Better Auth config, parseUserOutput stripped it — session.user.role was
always undefined. That broke two things: the root redirect fell through to
/redaktion/alben for admins (role !== 'ADMIN'), and requireAdmin threw
ADMIN_REQUIRED on every /admin page (role !== 'ADMIN').
Declare role via user.additionalFields (the documented custom-field API; the
`fields` map only renames core columns). input:false keeps it unsettable on
signUp — the DB default and the admin seed own it — and defaultValue matches
the column default so inserts never send null into the NOT NULL portalRole enum.
Co-Authored-By: Claude <noreply@anthropic.com>
LoginForm mapped every signIn failure to one generic sentence. Better Auth
returns distinct codes in signIn order — password check, then
requireEmailVerification (EMAIL_NOT_VERIFIED), then the session.create.before
hook canCreateSession (FAILED_TO_CREATE_SESSION). Map those to specific
messages: unverified email, not-yet-approved account, invalid credentials.
canCreateSession returns true only for ADMIN or editorial status 'active', and
onEmailVerified → markPendingApproval leaves verified editorials at
pending_approval until an admin approves — so the not-approved message is the
common post-verification login block.
Co-Authored-By: Claude <noreply@anthropic.com>
Better Auth's default id generator emits a nanoid-style string, but
every id column in the schema is typed uuid. Better Auth passes its
generated id explicitly on insert (bypassing the column defaultRandom),
so Postgres rejected every signUp/session/verification insert with
'invalid input syntax for type uuid'. This broke live registration and
the admin seed alike. Configure advanced.database.generateId to return
crypto.randomUUID() so ids match the schema.
Co-Authored-By: Claude <noreply@anthropic.com>
- Wire admin approval UI to editorialService.approveEditorial so editorial
accounts can move pending_approval -> active and log in. The approve button
was permanently disabled and the service unreachable, so editorial users
could never sign in.
- Surface non-validation errors (e.g. SMTP failures) on the registration
form instead of silently redirecting to the confirmation page.
- Set BETTER_AUTH_URL default to the production domain in .env.example and
compose.yaml so verification/reset links and the login origin check
resolve against the live origin.
- Add scripts/check-smtp.ts to verify SMTP connectivity against the
configured transport.
Co-Authored-By: Claude <noreply@anthropic.com>
- Revert packageManager from pnpm@11.16.0 back to pnpm@10.34.5
(restore the plan's pinned version; the PATH pnpm is unaffected).
- Inject a deterministic PDFKit document /ID derived from
SHA-256(snapshot.documentId) so the same snapshot always produces
byte-identical output, making the stored SHA-256 a verifiable
integrity fingerprint.
- Add covering test: render same fixture twice, assert bytes.equals()
and sha256 equality.
Co-Authored-By: Claude <noreply@anthropic.com>