Added get All users by Login Token
This commit is contained in:
parent
c7df506708
commit
f3b175d87b
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue