Refactored - now includes fullstack AUTH

This commit is contained in:
Ben Elferink
2021-09-28 18:53:02 +03:00
parent c349907802
commit 2f40cf797c
34 changed files with 6684 additions and 695 deletions

View File

@@ -0,0 +1,20 @@
const Account = require('../../models/Account')
async function getAccount(request, response, next) {
try {
const {uid} = request.auth
// Get account from DB, existance not verified because we are already authorized at this point
const foundAccount = await Account.findOne({_id: uid}).select('-password')
response.status(200).json({
message: 'Account fetched',
data: foundAccount,
})
} catch (error) {
console.error(error)
response.status(500).send()
}
}
module.exports = getAccount