chore: Add static current user temporarily
This commit is contained in:
18
packages/backend/src/helpers/authentication.ts
Normal file
18
packages/backend/src/helpers/authentication.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Request, Response, NextFunction } from 'express';
|
||||
import User from '../models/user';
|
||||
import UserType from '../types/user';
|
||||
|
||||
interface RequestWithCurrentUser extends Request {
|
||||
currentUser: UserType
|
||||
}
|
||||
|
||||
const authentication = async (req: RequestWithCurrentUser, _res: Response, next: NextFunction) => {
|
||||
// We set authentication to use the sample user we created temporarily.
|
||||
req.currentUser = await User.query().findOne({
|
||||
email: 'user@automatisch.com'
|
||||
})
|
||||
|
||||
next()
|
||||
}
|
||||
|
||||
export default authentication;
|
Reference in New Issue
Block a user