newStaffLDB-API #48

Merged
fred.boniface merged 85 commits from newStaffLDB-API into main 2023-10-03 21:35:03 +01:00
4 changed files with 14 additions and 6 deletions
Showing only changes of commit 3410e6598a - Show all commits

View File

@ -6,7 +6,10 @@ module.exports = async function authCheck(req, res, next) {
try {
var uuid = req.headers.uuid;
} catch (err) {
log.out("authMiddlewares: UNABLE TO READ HEADER 'UUID' - User !isAuthed", "warn");
log.out(
"authMiddlewares: UNABLE TO READ HEADER 'UUID' - User !isAuthed",
"warn"
);
req.isAuthed = false;
return next();
}
@ -21,7 +24,10 @@ module.exports = async function authCheck(req, res, next) {
}
return next();
} catch (err) {
log.out("authMiddlewares: Unable to check auth, default to !isAuthed", "warn")
log.out(
"authMiddlewares: Unable to check auth, default to !isAuthed",
"warn"
);
req.isAuthed = false;
return next();
}

View File

@ -23,8 +23,8 @@ async function query(collection, query, returnId = false) {
}
log.out(`dbAccess.query: Running Query: ${JSON.stringify(query)}`, "info");
increment(collection);
log.out('dbAccess.query: Query response:')
console.log(await qcursor.toArray())
log.out("dbAccess.query: Query response:");
console.log(await qcursor.toArray());
return await qcursor.toArray();
}

View File

@ -78,7 +78,7 @@ async function arrDepBoardStaff(CRS) {
const _staffLdb = staffStationTransform(result);
console.log("Transformation Test Successful");
console.log(JSON.stringify(_staffLdb));
return _staffLdb
return _staffLdb;
} catch (err) {
console.log("Transformation Test Failed: " + err);
}

View File

@ -8,7 +8,9 @@ import { minifyMail } from "./minify.utils";
// Checks users registration key against issued keys
async function isAuthed(uuid: string): Promise<boolean> {
// Needs testing
const q = { /*uuid: uuid*/ };
const q = {
/*uuid: uuid*/
};
const res = await db.query("users", q);
logs.out(
"authUtils.checkUser: DB Query answer: " + JSON.stringify(res[0]),