Fix: ManageUsers component missing useAuth() - caused blank admin page

The ManageUsers sub-component referenced user?.role for conditional
role dropdown options but didn't call useAuth() to get the user object.
This caused 'user is not defined' JS errors and blank admin pages.

Browser E2E: 20/20 tests pass.
This commit is contained in:
BizzleBot
2026-02-16 20:24:34 +00:00
parent f718a76153
commit 70ed672381
11 changed files with 231 additions and 72 deletions
+4 -2
View File
@@ -1,4 +1,6 @@
DB_PASSWORD=coastal_secret
# Set to "true" to enable daily pg_dump backups
JWT_SECRET=Ts8pLm3QvK5nRw9sYzB4jFc7hE0aGd2U
JWT_REFRESH_SECRET=Rf6kMn2QpT8wLs4vYzA7jFb9hD0eGc5U
NODE_ENV=production
CORS_ORIGINS=https://ts.bizzle.cloud
ENABLE_BACKUPS=false
BACKUP_DIR=/backups
+3
View File
@@ -41,6 +41,9 @@ COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/src ./src
COPY --from=builder /app/package.json ./
# Fix ownership so non-root user can regenerate Prisma client
RUN chown -R coastal:coastal /app
# Switch to non-root user
USER coastal
+29 -19
View File
@@ -1,19 +1,16 @@
version: '3.9'
name: timesheet
services:
# ─── PostgreSQL ─────────────────────────────────────────
db:
image: postgres:16-alpine
container_name: coastal-db
restart: always
container_name: timesheet-db
restart: unless-stopped
environment:
POSTGRES_USER: coastal
POSTGRES_PASSWORD: ${DB_PASSWORD:-coastal_secret}
POSTGRES_DB: coastal_timesheet
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- '127.0.0.1:5432:5432'
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U coastal -d coastal_timesheet']
interval: 10s
@@ -22,14 +19,17 @@ services:
start_period: 10s
networks:
- coastal
deploy:
resources:
limits:
memory: 256M
# ─── Backend API ────────────────────────────────────────
backend:
build:
context: ../
dockerfile: docker/backend/Dockerfile
container_name: coastal-backend
restart: always
container_name: timesheet-backend
restart: unless-stopped
depends_on:
db:
condition: service_healthy
@@ -37,9 +37,9 @@ services:
DATABASE_URL: postgresql://coastal:${DB_PASSWORD:-coastal_secret}@db:5432/coastal_timesheet
JWT_SECRET: ${JWT_SECRET:-change-me-in-production-jwt-secret-2026}
JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET:-change-me-in-production-refresh-secret-2026}
PORT: '3001'
NODE_ENV: ${NODE_ENV:-production}
CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost,http://localhost:3000,http://100.94.106.120:8080}
PORT: '3004'
NODE_ENV: production
CORS_ORIGINS: https://ts.bizzle.cloud,http://localhost
SMTP_HOST: ${SMTP_HOST:-}
SMTP_PORT: ${SMTP_PORT:-587}
SMTP_USER: ${SMTP_USER:-}
@@ -47,28 +47,33 @@ services:
SMTP_FROM: ${SMTP_FROM:-}
ADMIN_EMAIL: ${ADMIN_EMAIL:-bizzle@coastalcontracting.com}
ports:
- '127.0.0.1:3001:3001'
- '127.0.0.1:3004:3004'
- '172.18.0.1:3004:3004'
healthcheck:
test: ['CMD', 'node', '-e', "fetch('http://localhost:3001/api/health').then(r=>{if(!r.ok)throw 1}).catch(()=>process.exit(1))"]
test: ['CMD', 'node', '-e', "fetch('http://localhost:3004/api/health').then(r=>{if(!r.ok)throw 1}).catch(()=>process.exit(1))"]
interval: 15s
timeout: 5s
retries: 3
start_period: 30s
networks:
- coastal
deploy:
resources:
limits:
memory: 256M
# ─── Frontend (Nginx) ──────────────────────────────────
frontend:
build:
context: ../
dockerfile: docker/frontend/Dockerfile
container_name: coastal-frontend
restart: always
container_name: timesheet-frontend
restart: unless-stopped
depends_on:
backend:
condition: service_healthy
ports:
- '100.94.106.120:8080:80'
- '127.0.0.1:8083:80'
- '172.18.0.1:8083:80'
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
healthcheck:
@@ -79,10 +84,15 @@ services:
start_period: 10s
networks:
- coastal
deploy:
resources:
limits:
memory: 128M
volumes:
pgdata:
driver: local
external: true
name: coastal_pgdata
networks:
coastal:
+1 -1
View File
@@ -3,7 +3,7 @@
# /* → frontend static files
upstream backend_api {
server backend:3001;
server backend:3004;
keepalive 16;
}