Colubrina/backend/routes/feedback.js

26 lines
586 B
JavaScript
Raw Permalink Normal View History

2022-08-31 20:26:08 +10:00
const express = require("express")
const router = express.Router()
const Errors = require("../lib/errors.js")
const auth = require("../lib/authorize.js")
const { Feedback } = require("../models")
router.post("/", auth, async (req, res, next) => {
try {
await Feedback.create({
feedbackText: req.body.text,
starRating: req.body.starRating,
debug: {
client: req.body.debug
},
route: req.body.route,
userId: req.user.id,
tenant: "colubrina"
})
res.sendStatus(204)
} catch (e) {
next(e)
}
})
module.exports = router