pis #12
@ -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