Files
squares_game/docker-entrypoint.sh
Philip e7b7536e70 Add password change, rename Viewer→Commissioner, fix login logo
- Rename VIEWER role to COMMISSIONER throughout (schema, middleware,
  admin layout, users page); add psql pre-migration step in entrypoint
  to rename the PostgreSQL enum value without data loss
- Install postgresql-client in Docker runner stage for psql access
- Login page: fetch sbLogo from settings API instead of hardcoded path
- Password change for all authenticated users:
  - New PATCH /api/users/me endpoint (verifies current password, hashes new)
  - Change Password button/modal on /my-squares page
  - Change Password link in admin sidebar (links to /my-squares)
  - New password_change email template (seeded, editable in admin)
  - sendPasswordChangedEmail auto-email triggered on change

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 10:36:16 -07:00

20 lines
632 B
Bash

#!/bin/sh
set -e
mkdir -p /app/public/uploads
echo "Running pre-migration fixes..."
# Rename VIEWER enum value to COMMISSIONER if it still exists (one-time migration)
# Strip Prisma-specific query params (e.g. ?schema=public) before passing to psql
PSQL_URL=$(echo "$DATABASE_URL" | sed 's/?.*//')
psql "$PSQL_URL" -c "ALTER TYPE \"Role\" RENAME VALUE 'VIEWER' TO 'COMMISSIONER';" 2>/dev/null || true
echo "Running Prisma migrations..."
npx prisma db push --skip-generate
echo "Seeding database..."
node prisma/seed.js || echo "Seed skipped (may already exist)"
echo "Starting server..."
exec node server.js