import { type NextFunction, type Request, type Response } from "express"; import userModel, { values } from '../models/userModel'; async function checkAuthenticated(req: Request, res: Response, next: NextFunction) { const pass = req.body.pass; const password = await userModel.getValue(values.pass); if (pass && password) { if (pass == password) { return next(); } } return res.status(500).json({ message: 'Error when getting transactions.' }); } export default checkAuthenticated;