function deleteProjectApis (projectId) { return Apis.update({ state: 0 }, { where: { project_id: projectId } }) // return Apis.destroy({ // where: { project_id: projectId } // }) }
static merge(userId, data) { let values = {} PUBLIC_FIELDS.forEach(field => { if (data[field]) { values[field] = data[field] } }) return db.User.update(values, { where: { id: userId }, }) .then(() => UserRepository.getOne(userId)) }
/** * Updates an existing Shipment. * * @param {Object} shipmentModel */ function updateShipment(shipmentModel) { const { id } = shipmentModel; return Shipment.update(shipmentModel, { where: { id } }) .then(([affectedCount, affectedRows]) => ({ affectedCount, affectedRows })); }
/** * 更新角色 */ router.post("/:id/update", function(req, res, next) { Role.update(req.body, { where: { id: req.params.id } }).then(function(role) { res.json({ status: 1, data: role }) }).catch(next); });
pokemon.patch('/:id', async (req, res) => { const id = req.params.id; const { name, cp } = req.body; await Pokemon.update( { name, cp }, { where: { id: id } } ); let pokemonAtualizado = await Pokemon.findByPk(id); res.json(pokemonAtualizado); });
router.get('/update_face', function (req, res, next) { if (req.query.uid == null || req.query.token == null || req.query.timestamp == null || req.query.face == null) { return res.jsonp({status: 1000, msg: MESSAGE.PARAMETER_ERROR}) } UserModel.update({ face: req.query.face }, { where: { id: req.query.uid } }).then(function () { UserModel.findOne({ where: { id: req.query.uid } }).then(function (user) { return res.jsonp({status: 0, user: user, msg: MESSAGE.SUCCESS}) }); }) });
server.route({ method: 'PUT', path: '/task/{id}', handler: (req, h) => { if (!req.payload.task_name) { return { error: 'Bad Data' } } else { return Task.update( { task_name: req.payload.task_name }, { where: { id: req.params.id } } ) .then(() => { return { status: 'Task Updated!' } }) .error(err => handleError(err)) } } })
var update_contact= function (req,res,next) { var _id=req.params.id; Contact.update( req.body.contact, { where: { id: _id } } ) .then(result => { res.json(result) } ) .catch(err => { res.json(0); } ); }
var update_job= function (req,res,next) { var _id=req.params.id; Job.update( req.body.job, { where: { id: _id } } ) .then(result => { res.json(result) } ) .catch(err => { res.json(0); } ); }
var update_license= function (req,res,next) { var _id=req.params.id; License.update( req.body.license, { where: { id: _id } } ) .then(result => { res.json(result) } ) .catch(err => { res.json(0); } ); }
var update_organization= function (req,res,next) { var _id=req.params.id; Organization.update( req.body.organization, { where: { id: _id } } ) .then(result => { res.json(result) } ) .catch(err => { res.json(0); } ); }
function deleteApi(id) { return Apis.update({ state: 0 }, { where: { id: id } }) // return Apis.destroy({ // where: { id: id } // }) }
static update(userId, data) { let values = {} PUBLIC_FIELDS.forEach(field => { values[field] = data[field] || null }) return db.User.update(values, { where: { id: userId }, }) .then(() => UserRepository.getOne(userId)) }
function updateApi (content, condition) { return Apis.update(content, condition) }
/** * 更新某个地址 */ router.post("/:id/update", function(req, res, next) { Address.update(req.body, { where: { id: req.params.id } }).then(function(address) { res.json({ status: 1, data: address }); }).catch(next); });