mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-19 11:39:36 +02:00
Weather settings form update functionality. API: update multiple values in one Config query
This commit is contained in:
parent
316bc49f5c
commit
88c8eee982
4 changed files with 95 additions and 70 deletions
|
@ -86,6 +86,22 @@ exports.updateValue = asyncWrapper(async (req, res, next) => {
|
|||
})
|
||||
})
|
||||
|
||||
// @desc Update multiple values
|
||||
// @route PUT /api/config/
|
||||
// @access Public
|
||||
exports.updateValues = asyncWrapper(async (req, res, next) => {
|
||||
Object.entries(req.body).forEach(async ([key, value]) => {
|
||||
await Config.update({ value }, {
|
||||
where: { key }
|
||||
})
|
||||
})
|
||||
|
||||
res.status(200).send({
|
||||
success: true,
|
||||
data: {}
|
||||
})
|
||||
})
|
||||
|
||||
// @desc Delete key:value pair
|
||||
// @route DELETE /api/config/:key
|
||||
// @access Public
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue