Debugging req/reg functions
Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
parent
9cba7e7399
commit
90348f48f3
@ -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
|
||||
}
|
@ -36,6 +36,7 @@ async function regUser(req) {
|
||||
let uuid = await auth.generateKey()
|
||||
let apiKey = await db.addUser(uuid, res.domain)
|
||||
if (apiKey) {
|
||||
db.delRegReq(req.uuid)
|
||||
return {status: 201, message: "User added", api_key: uuid}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user