1
0
Fork 0

add acc info GET

refactor/models
Matthew 2019-11-16 19:37:45 -05:00
parent 1ec893b0fa
commit e24bca245e
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 15 additions and 0 deletions

View File

@ -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 });
});
}
}