6 Commits

Author SHA1 Message Date
jesxion
8d560524f9 feat: sync released server and h5 updates
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-26 21:12:52 +08:00
jesxion
7a7cf25e50 feat: split platform and project auth users
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-25 16:31:56 +08:00
jesxion
2d64632a0e fix: update hazards schema and remove redundant auth check
- Update schema.sql with correct hazards table structure:
  - UUID/string id instead of auto-increment
  - Severity values: general, serious, major
  - Status values: pending, assigned, resolved
  - JSON photos field
  - GPS lat/lng fields
  - Reporter/assignee/resolver fields and timestamps
- Remove redundant req.auth check after requireAuth middleware
- Add TypeScript non-null assertions where middleware guarantees auth

All tests passing, build successful.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-24 11:38:30 +08:00
jesxion
4775604971 Fix spec review issues for add-auth-project-context
- Source role and project_id from users table in auth flow
- Update UserRow interface to include role and project_id fields
- Update schema.sql to add role and project_id columns to users table
- Remove dotenv import from server/src/index.ts
- Trim auth.test.ts to only required test case
- Update auth route to use database values instead of hardcoded

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-24 11:06:21 +08:00
jesxion
f8e50deb7d Fix review issues for config/db schema
- Use Zod v4 'issues' property instead of 'errors' in env.ts
- Integrate database pool cleanup in graceful shutdown
- Increase users.password_hash to VARCHAR(512) for future-proofing
- Add updated_at column to oss_files table

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-24 10:41:57 +08:00
jesxion
fe0272ea49 feat: add server config, database schema, and MySQL connection pool
- Add .env.example with PORT, MySQL, JWT, and OSS configuration
- Create schema.sql with users, projects, oss_files, and hazards tables
- Implement env.ts with Zod-based environment variable parsing
- Implement db.ts with MySQL connection pool using mysql2/promise
- Update /health endpoint to return service metadata
- Update health test to verify service name
- Install zod and mysql2 dependencies

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-24 10:36:03 +08:00