Files
shared/backend
GabrielandClaude Haiku 5.5 60befcd883 feat(media): port MediaViewer ratings and visible-only tag counts
MediaViewer committed these changes to its vendored shared copy
(e83afad, ca8a89e) without upstreaming them, so the next shared sync
would have removed them from MediaViewer and broken its build.

Ported here as a three-way merge against 74942e5, the snapshot
MediaViewer last synced from:

- media.MediaRecord.Rating, read in FindMedia and returned by ToJSON,
  with the rating column added in migrate.go
- tagSuggestions counts media items through the library's visibility
  rules instead of raw media_tags rows
- MediaPlayer autoplayMuted prop (defaults to false, so existing
  callers are unaffected)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-13 17:46:55 +01:00
..

Shared Go backend packages

The Go packages under this directory hold infrastructure shared by the services, not application-specific SQL or HTTP handlers.

  • config — environment string, required value, boolean, integer, and duration helpers.
  • postgres — validated DATABASE_URL configuration, pgxpool creation/ping, transaction wrapper, and PostgreSQL error classification.
  • auth — versioned bcrypt password hashes (HashPassword writes a bcrypt$ prefix; VerifyAndUpgradePassword rewrites older hashes on login), trusted-proxy client addresses (ParseTrustedProxies reads TRUSTED_PROXIES, a comma-separated CIDR list; X-Forwarded-For is honoured only from those peers), secure token generation/hashing, account/session schema (usernames are unique ignoring case once no clashing pair exists), account/session persistence, and attempt limits on the login and TOTP routes (per account and per client address, held in process memory).
  • authclient — HTTP client and net/http middleware for services that adopt the centralized AuthServer instead of embedding auth against their own database. WithClientIP(ctx, ip) makes the credential calls send the end user's address as X-Forwarded-For; AuthServer reads it only from peers in its own TRUSTED_PROXIES.
  • migrate — embedded filesystem adapter for Goose migrations.
  • logshipper — client adapter for OmniLogger (Web/OmniLogger): batches and ships log entries centrally while mirroring the same human-readable output and Debug/Info/Warn/Error/Critical/Audit/*Ctx method surface as each project's local internal/logging package.

Run go test ./... and go vet ./... from this directory. Tests that need PostgreSQL skip themselves unless DATABASE_URL (auth store) or SHARED_TEST_DATABASE_URL (platform users, media, migrate) names a scratch database; use go test -p 1 ./... when both are set. The module path is repos.gfranz.ch/Gabriel20xx/shared/backend; change it if the shared folder is hosted under a different repository path.

Application-specific table definitions and HTTP behavior stay in the service. That lets a service reuse reliable connection/auth plumbing without coupling its domain model to another project.