Add internal registry endpoint, self-registration, and workforce sync

- Register internalRoutes at /api/auth/internal (used by management)
- Add registerRoutes for staff self-registration flow
- Add workforce sync job (runs on schedule, fails gracefully if unconfigured)
- Add email.js for registration/invite emails

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-01 20:35:44 +00:00
parent 2d89fd9227
commit f08d53d702
10 changed files with 704 additions and 18 deletions

View file

@ -4,6 +4,9 @@ import cors from '@fastify/cors'
import { initDb } from './db.js'
import { authRoutes } from './routes/auth.js'
import { adminRoutes } from './routes/admin.js'
import { internalRoutes } from './routes/internal.js'
import { registerRoutes } from './routes/register.js'
import { startSyncJob } from './sync.js'
const app = Fastify({ logger: true, trustProxy: true })
@ -15,12 +18,15 @@ await app.register(cors, {
app.get('/health', async () => ({ status: 'healthy' }))
await app.register(authRoutes, { prefix: '/api/auth' })
await app.register(adminRoutes, { prefix: '/api/auth/admin' })
await app.register(authRoutes, { prefix: '/api/auth' })
await app.register(registerRoutes, { prefix: '/api/auth' })
await app.register(adminRoutes, { prefix: '/api/auth/admin' })
await app.register(internalRoutes, { prefix: '/api/auth/internal' })
try {
await initDb()
await app.listen({ port: 3001, host: '0.0.0.0' })
startSyncJob()
} catch (err) {
app.log.error(err)
process.exit(1)