Added unit and api tests
This commit is contained in:
parent
9f4204cc73
commit
fedf1eb4c5
34 changed files with 9205 additions and 20 deletions
2
backend/dist/middleware/auth.d.ts
vendored
2
backend/dist/middleware/auth.d.ts
vendored
|
|
@ -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>>>;
|
||||
|
|
|
|||
2
backend/dist/middleware/auth.js
vendored
2
backend/dist/middleware/auth.js
vendored
|
|
@ -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' });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue