pis #12

Merged
fred.boniface merged 95 commits from pis into main 2023-05-06 21:54:51 +01:00
2 changed files with 13 additions and 3 deletions
Showing only changes of commit 90348f48f3 - Show all commits

View File

@ -30,7 +30,6 @@ async function increment(target) {
let update = {}
update[target] = 1
col.updateOne({target: "counters"}, {$inc:update})
return;
}
async function addUser(uuid, domain) { // Needs testing
@ -64,10 +63,20 @@ async function userAtime(uuid) { // Needs testing
return res;
}
// Deletes one single registration request entry from the DB
async function delRegReq(uuid) {
log.out(`dbAccess.delRegReq: Deleting a Registration Request`)
collection = "registrations"
await client.connect()
let col = db.collection(collection)
col.deleteOne({uuid: uuid})
}
module.exports = {
query,
increment,
addUser,
userAtime,
addRegReq
addRegReq,
delRegReq
}

View File

@ -35,7 +35,8 @@ async function regUser(req) {
if (res.result) {
let uuid = await auth.generateKey()
let apiKey = await db.addUser(uuid, res.domain)
if (apiKey) {
if (apiKey) {
db.delRegReq(req.uuid)
return {status: 201, message: "User added", api_key: uuid}
}
}