Added get All users by Login Token

This commit is contained in:
Jyotirmoy Bandyopadhayaya 2022-03-24 15:22:22 +05:30
parent c7df506708
commit f3b175d87b
2 changed files with 13 additions and 1 deletions

View File

@ -47,7 +47,7 @@ module.exports.addURL = async (req, res) => {
Minfy.create({
originalUrl: req.body.originalUrl,
alias: alias,
minifiedUrl: minifiedUrl
minifiedUrl: minifiedUrl,
})
.then((data) => {
res.json(data)
@ -118,3 +118,14 @@ module.exports.visitor = async (req, res) => {
res.sendStatus(500)
})
}
module.exports.getAllurlsforUser = async (req, res) => {
Minfy.find({ createdBy: req.user.data.email })
.then((data) => {
res.send(data)
})
.catch((err) => {
console.error(err)
res.sendStatus(500)
})
}

View File

@ -10,6 +10,7 @@ router.get('/alias/:alias', controller.getURLData)
router.post('/add', controller.addURL)
router.post('/add/custom', auth, controller.addURLAuthed)
router.get('/all/user', auth, controller.getAllurlsforUser)
router.patch('/edit/:id', auth, controller.updateUrlData)