newStaffLDB-API #48

Merged
fred.boniface merged 85 commits from newStaffLDB-API into main 2023-10-03 21:35:03 +01:00
Showing only changes of commit 588efcad3d - Show all commits

View File

@ -22,10 +22,11 @@ async function isAuthed(uuid: string): Promise<boolean> {
} }
// Checks whether a registration request key is valid // Checks whether a registration request key is valid
async function checkRequest(key: string) { async function checkRequest(key: string) { // For some reason db.query seems to return correctly, but the second logs.out statement prints []??? so registration fails!!
const collection = "registrations"; const collection = "registrations";
const query = { uuid: key }; const query = { uuid: key };
const res = await db.query(collection, query); const res = await db.query(collection, query);
logs.out("authUtils.checkRequest: Raw Result: " + res, "dbug")
logs.out( logs.out(
"authUtils.checkRequest: DB Query result: " + JSON.stringify(res), "authUtils.checkRequest: DB Query result: " + JSON.stringify(res),
"dbug" "dbug"
@ -39,7 +40,7 @@ async function checkRequest(key: string) {
// Creates an API key for a user // Creates an API key for a user
async function generateKey() { async function generateKey() {
// Needs testing & moving to 'register.utils' // Needs testing & moving to 'register.utils' ??? Why does it need moving?
return crypt.randomUUID(); return crypt.randomUUID();
} }