Endpoint for getting wine schema.

This is for manual registration of prelottery wines from the admin page.
This commit is contained in:
2021-02-15 22:36:49 +01:00
parent 57fe7d444b
commit 7292cf7983
3 changed files with 35 additions and 2 deletions

View File

@@ -169,11 +169,32 @@ const deleteWines = (req, res) => {
});
};
const wineSchema = (req, res) => {
return prelotteryWineRepository
.wineSchema()
.then(schema =>
res.send({
schema: schema,
message: `Wine schema template.`,
success: true
})
)
.catch(error => {
const { statusCode, message } = error;
return res.status(statusCode || 500).send({
success: false,
message: message || "Unable to fetch wine schema template."
});
});
};
module.exports = {
allWines,
addWines,
wineById,
updateWineById,
deleteWineById,
deleteWines
deleteWines,
wineSchema
};