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

@@ -70,11 +70,22 @@ const deleteWines = () => {
return PreLotteryWine.deleteMany();
};
const wineSchema = () => {
let schema = { ...PreLotteryWine.schema.obj };
let nulledSchema = Object.keys(schema).reduce((accumulator, current) => {
accumulator[current] = "";
return accumulator;
}, {});
return Promise.resolve(nulledSchema);
};
module.exports = {
allWines,
addWines,
wineById,
updateWineById,
deleteWineById,
deleteWines
deleteWines,
wineSchema
};