controller/store/update/information/name
unknown
plain_text
a year ago
670 B
11
Indexable
const db = require('../../../../models/index');
const name = (req, res) => {
const storeID = req.body.store_id;
const storeName = req.body.name;
const updateStoreName = (storeID, storeName, t) => {
return db.store.update({
name: storeName
}, { transaction: t })
.catch(err => {
throw new Error("[Fail to udpate store name" + err)
})
}
return db.sequelize.transaction(t => {
return updateStoreName(storeID, storeName, t)
})
.then(() => {
return res.status(200).send("Successfully update store name")
})
.catch(err => {
return res.status(400).send(err.message)
})
};
module.exports = name;Editor is loading...
Leave a Comment