db to user_id
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 3m56s

This commit is contained in:
2025-11-24 13:02:30 -08:00
parent 1c08d2dab1
commit 3c567ea104
20 changed files with 129 additions and 73 deletions

View File

@@ -13,6 +13,7 @@ import publicRouter from './src/routes/public';
import userRouter from './src/routes/user';
import adminRouter from './src/routes/admin';
import aiRouter from './src/routes/ai';
import systemRouter from './src/routes/system';
// Environment variables are now loaded by the `tsx` command in package.json scripts.
// This ensures the correct .env file is used for development vs. testing.
@@ -68,7 +69,7 @@ const requestLogger = (req: Request, res: Response, next: NextFunction) => {
logger.debug(`[Request Logger] INCOMING: ${method} ${originalUrl}`);
res.on('finish', () => {
const user = req.user as { id?: string } | undefined;
const user = req.user as { user_id?: string } | undefined;
const durationInMilliseconds = getDurationInMilliseconds(start);
const { statusCode } = res;
const userIdentifier = user?.user_id ? ` (User: ${user.user_id})` : '';
@@ -98,6 +99,8 @@ if ((process.env.JWT_SECRET || 'your_super_secret_jwt_key_change_this') === 'you
app.use('/api', publicRouter);
// 2. Authentication routes for login, registration, etc.
app.use('/api/auth', authRouter);
// System routes for health checks, etc.
app.use('/api/system', systemRouter);
// 3. AI routes, some of which use optional authentication.
app.use('/api/ai', aiRouter);
// 4. Admin routes, which are all protected by admin-level checks.