Added unit and api tests

This commit is contained in:
Brian McGonagill 2026-03-26 10:21:19 -05:00
parent 9f4204cc73
commit fedf1eb4c5
34 changed files with 9205 additions and 20 deletions

View file

@ -4,6 +4,8 @@ export interface AuthRequest extends Request {
id: string;
email: string;
name: string;
isAdmin?: boolean;
isApiEnabled?: boolean;
};
}
export declare const authenticate: (req: AuthRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>>>;

View file

@ -17,7 +17,7 @@ const authenticate = async (req, res, next) => {
const decoded = jsonwebtoken_1.default.verify(token, JWT_SECRET);
const user = await index_1.prisma.user.findUnique({
where: { id: decoded.userId },
select: { id: true, email: true, name: true }
select: { id: true, email: true, name: true, isAdmin: true, isApiEnabled: true }
});
if (!user) {
return res.status(401).json({ error: 'User not found' });