Files
vtuber-awards/Backend
AzuTear 6b3b0360e7
CI - Build & Verify / Build, Typecheck & Hygiene (push) Successful in 1m1s
CI - Build & Verify / Deploy to award.noveria.net (push) Successful in 1m30s
Add winner archive, host image upload and live demo data
Deliver the demo-ready feature set and seed data so the live site can be
presented end to end:

- Winner archive: ArchivedWinner domain, admin CRUD endpoints/view/manager
  and public archive surface, backed by AddArchivedWinners migration.
- Host presentation: host image upload and artist name on SiteSettings with
  public image endpoint and supporting migrations.
- Clip submissions: idempotent table-ensure migration plus current-season
  demo clips for review workflows.
- Demo seed data: sponsors, share links and 2025 archived winners, with a
  guarded RemoveDemoSeasons cleanup; all seeds guard against real data.
- EnsureRuntimeSchemaParity migration to align runtime schema defensively.
- Admin/home UI refinements; remove unused team role permissions modal and
  dead share-quick-links code.

All seed and schema migrations are idempotent (IF NOT EXISTS / ON CONFLICT)
and skip when real season data is present.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 21:47:52 +02:00
..

Backend

PostgreSQL

The API targets PostgreSQL through EF Core 8 and Npgsql.EntityFrameworkCore.PostgreSQL.

Local development is aligned with ../docker-compose.dev.yml and appsettings.Development.json:

Host=localhost;Port=5433;Database=vtuber_star_awards_dev;Username=vtsa_dev;Password=change-me-local-only

For production or shared deployments, keep checked-in appsettings empty and provide your own value through:

VTSA_POSTGRES
ConnectionStrings__Postgres

The API reads its connection string from:

  • environment variable VTSA_POSTGRES
  • environment variable ConnectionStrings__Postgres

Demo content is inserted through explicit demo-data migrations, not runtime startup seeding. Before production, create or activate a real season and delete any season marked as demo. The default app configuration migration contains only non-secret placeholders; restore private Twitch/demo/team credentials from environment variables or a local ignored backup.

If Docker is available locally, start a dev database from the repository root with:

docker compose -f docker-compose.dev.yml up -d

Commands

Restore and build:

dotnet restore
dotnet build

Create a migration:

dotnet ef migrations add <MigrationName>

Generate a SQL migration script when deployment needs a reviewed artifact:

dotnet ef migrations script --output Migrations/migration.sql

Apply migrations once PostgreSQL is running:

dotnet ef database update

Run the API:

ASPNETCORE_ENVIRONMENT=Development dotnet run --urls http://127.0.0.1:5084

Check the API and database wiring:

curl http://127.0.0.1:5084/api/health
curl http://127.0.0.1:5084/api/health/database

Development auth/session:

curl -X POST http://localhost:5084/api/auth/dev-login \
  -H "Content-Type: application/json" \
  -d '{"twitchUserId":"jayuhime_admin","displayName":"Jayuhime Admin","role":"admin"}'

Demo admin login for public presentations:

VTSA_DEMO_LOGIN_ENABLED=true
VTSA_DEMO_ADMIN_LOGIN=jayuhime_admin
VTSA_DEMO_ADMIN_EMAIL=admin@example.local
VTSA_DEMO_ADMIN_PASSWORD=<set-secure-demo-password>
VTSA_DEMO_ADMIN_TWITCH_ID=jayuhime_admin
VTSA_DEMO_ADMIN_DISPLAY_NAME=Jayuhime Admin

The frontend route is /login. VTSA_DEMO_ADMIN_LOGIN may be a username or an email-style identifier; the backend also accepts the configured email, Twitch ID, and display name for admin flexibility. Disable the demo login for release with VTSA_DEMO_LOGIN_ENABLED=false.

Team owner bootstrap credentials are separate from demo login credentials:

VTSA_TEAM_OWNER_PASSWORD=<set-secure-owner-password>
VTSA_TEAM_CREATOR_PASSWORD=<set-secure-creator-password>

These fixed owner/creator credentials are authoritative on API startup. If a personal team account gets locked out after an admin reset, redeploying with the configured environment password restores the login.

Frontend app-wide demo gate:

VITE_DEMO_GATE_ENABLED=true
  • true: if /api/public/site-status is unavailable, the Vue app still starts at /login until a session exists.
  • unset or false: if /api/public/site-status is unavailable, public pages such as / remain visible without the initial demo login.

When /api/public/site-status is reachable, the backend demoLoginEnabled flag is authoritative.