From e24bca245ea33c3097b448e9cead836060301c43 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Sat, 16 Nov 2019 19:37:45 -0500 Subject: [PATCH] add acc info GET --- src/api/routes/Account.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/api/routes/Account.ts b/src/api/routes/Account.ts index 7b5aa4c..6e4115e 100644 --- a/src/api/routes/Account.ts +++ b/src/api/routes/Account.ts @@ -17,5 +17,20 @@ export default class Account extends Route { if (!authResult) return res.status(401).json({ code: this.constants.codes.UNAUTHORIZED, message: 'UNAUTHORIZED' }); next(); }); + + this.router.get('/', async (req, res) => { + const url = new URL(req.url); + const account = await this.server.client.db.Account.findOne({ username: url.username }); + const acc: any = {}; + acc.username = account.username; + acc.userID = account.userID; + acc.email = account.emailAddress; + acc.locked = account.locked; + acc.root = account.root; + acc.createdAt = account.createdAt; + acc.createdBy = account.createdBy; + acc.permissions = account.permissions; + res.status(200).json({ code: this.constants.codes.SUCCESS, message: acc }); + }); } }