update place api and admin ui

This commit is contained in:
lesion
2019-03-03 01:04:24 +01:00
parent f3dab2d315
commit c4940eaf12
4 changed files with 29 additions and 3 deletions

View File

@@ -22,6 +22,7 @@ api.route('/user')
api.get('/users', isAuth, isAdmin, userController.getAll)
api.put('/tag', isAuth, isAdmin, eventController.updateTag)
api.put('/place', isAuth, isAdmin, eventController.updatePlace)
api.route('/user/event')
.post(isAuth, upload.single('image'), userController.addEvent)

View File

@@ -32,7 +32,12 @@ const eventController = {
res.send(404)
}
},
async updatePlace (req, res) {
const place = await Place.findByPk(req.body.id)
console.log(place)
await place.update(req.body)
res.json(place)
},
async get (req, res) {
const id = req.params.event_id
const event = await Event.findByPk(id, { include: [User, Tag, Comment, Place] })