blog
This commit is contained in:
parent
09a977c9da
commit
5dce58d4be
@ -94,7 +94,7 @@ const generateControllers = (service, extraControllers = {}, options = {}) => {
|
|||||||
// https://sequelize.org/master/class/lib/model.js~Model.html#static-method-update
|
// https://sequelize.org/master/class/lib/model.js~Model.html#static-method-update
|
||||||
// Update devuelve un array de un elemento con el número de filas afectadas
|
// Update devuelve un array de un elemento con el número de filas afectadas
|
||||||
// por la operación. Por comodidad, devuelvo el valor, no el array.
|
// por la operación. Por comodidad, devuelvo el valor, no el array.
|
||||||
|
|
||||||
let result = response[0];
|
let result = response[0];
|
||||||
let status = httpStatus.OK;
|
let status = httpStatus.OK;
|
||||||
if (result < 1) {
|
if (result < 1) {
|
||||||
|
|||||||
@ -214,11 +214,11 @@ const generateService = (model, extraMethods = {}, options = defaultOptions) =>
|
|||||||
if (extraMethods.beforeUpdate) {
|
if (extraMethods.beforeUpdate) {
|
||||||
values = extraMethods.beforeUpdate(values, findOptions, context);
|
values = extraMethods.beforeUpdate(values, findOptions, context);
|
||||||
}
|
}
|
||||||
await model.scope(context.scopes).update(values, findOptions)
|
var result = await model.scope(context.scopes).update(values, findOptions)
|
||||||
var result = await defaultService.fetchOne(params, context);
|
var row = await defaultService.fetchOne(params, context);
|
||||||
|
|
||||||
if (extraMethods.afterUpdate) {
|
if (extraMethods.afterUpdate) {
|
||||||
result = extraMethods.afterUpdate(result, values, context);
|
row = extraMethods.afterUpdate(row, values, context);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user