Files
NextChair/docker/entrypoint.sh
T
Stefan Lazic 9e39908ea7 Post Phase 8 - Fixes 1
Delivered:

Super Administrator — env-var provisioned, no StaffProfile at all (structural exclusion from Team/barber-picker/appointments/staff-totals, not a filter). hasPermission short-circuit + new getActingBusinessContext() helper retrofitted across 16 owner pages so it can actually manage the business.
Media Manager — one upload/library/external-URL modal + field picker, backing every image field app-wide. Local-disk storage + Docker volume, SVG rejected, size-capped.
Welcome backgrounds — desktop/mobile images with CSS breakpoint swap.
Business Branding settings — logo/cover/welcome/favicon/icon/colours all editable post-install; cover image finally rendered (was dead config).
Service descriptions — now surfaced on Home and in the booking flow.
Loyalty card — live preview, ColorPicker/MediaPicker/IconPicker, flip removed for a static premium-styled card, Loyalty added to bottom nav. Fixed a real pre-existing bug where the card's configured colour/image/icon were stored but never actually rendered.
Home Screen Redesign — hero gallery + sticky Services/Portfolio/Reviews/Details tabs, backed by a new unified gallery model/service (no hero/portfolio duplication). Details tab surfaces social links and a map that were never shown before.
Google Reviews — real sync pipeline (24h cron, CRON_SECRET-gated, mirrors the existing notification cron exactly), DB-only customer reads, owner hide/unhide + policy management page.
Architecture cleanup — SettingsPageShell extracted from 6 duplicated page wrappers; fixed a second pre-existing bug where branding image fields could never actually be cleared once set.
Verification: 418 tests passing (236 unit + 182 integration, all against a real MySQL database), full typecheck/lint clean across src, and a real Docker build+run cycle — which caught and fixed a genuine bug (scripts/ wasn't copied into the production image, so Super Admin sync would have crashed on every real deployment).
2026-08-04 17:10:30 +01:00

29 lines
1.5 KiB
Bash

#!/bin/sh
# Entrypoint for the `next-chair` app container — see docker-compose.local.yaml.
# `migrate deploy` (never `migrate reset`) is safe to run on every
# container start: it only applies migrations not yet recorded in
# `_prisma_migrations`, so a restart with an already-up-to-date schema is
# a fast no-op, never destructive. It intentionally does NOT seed —
# development fixtures are a separate, explicit opt-in service (see
# `next-chair-seed` in docker-compose.local.yaml and the brief's own
# "production installation versus development seed" distinction); a
# fresh container is left empty and shows the installation wizard.
set -e
echo "[entrypoint] Applying database migrations..."
npx prisma migrate deploy
# Optional — only provisions/syncs a Super Administrator when
# SUPER_ADMIN_EMAIL is set (see scripts/ensure-super-admin.ts). Runs after
# migrations so the User.isSuperAdmin column always exists by this point.
echo "[entrypoint] Syncing Super Administrator..."
npx tsx scripts/ensure-super-admin.ts
echo "[entrypoint] Starting application..."
# `exec` + calling the `next` binary directly (not `npm run start`) so
# the Next.js server process itself receives SIGTERM directly from
# Docker on `docker stop` / `docker compose down` — routing through npm
# as an intermediary process can swallow the signal and force a slower
# SIGKILL after Compose's stop-grace-period instead of a clean shutdown.
exec node_modules/.bin/next start -p "${PORT:-3000}"