Multiple changes, basic rental CRUD backend implemented.

All responses are now in their own object with context name.

Added limit to user based recent results for matches.

Moved all code in endpoints inside try and catch.

Renamed authentication guard function.
This commit is contained in:
2022-04-05 11:50:35 -05:00
parent a7885ecf53
commit 8f96a2e5c9
8 changed files with 273 additions and 116 deletions

View File

@@ -17,7 +17,7 @@ if (process.env.NODE_ENV === "production") {
}
export const userSession = session(sessionConf);
export async function authenticationGuard(req, res, next) {
export async function requireAuthenticated(req, res, next) {
if (req.session.userId) {
req.user = await userModel.findById(req.session.userId);
next();
@@ -26,7 +26,3 @@ export async function authenticationGuard(req, res, next) {
return;
}
}
// TODO: Authentication
// TODO: Identity
// TODO: Authority