16 lines
353 B
JavaScript
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
|
||
|
})()
|