tibi-docs/api/hooks/rating/delete_delete.js
2024-03-11 17:26:10 +00:00

16 lines
353 B
JavaScript

;(function () {
const ratingId = context.request().param("id")
let rating = context.db.find("rating", {
filter: {
_id: ratingId,
},
})[0]
if (!rating.id)
throw {
status: 400,
error: "No id specified.",
}
// @ts-ignore
context["product"] = rating.productId
})()