4492-item.create-same-as-item.isLaid #1125
|
@ -51,12 +51,8 @@ module.exports = Self => {
|
|||
|
||||
const item = await models.Item.create(params, myOptions);
|
||||
|
||||
// set the item.isLaid to be the same as itemType.isLaid (itemType comes from item.typeFk)
|
||||
|
||||
const itemType = await models.ItemType.findById(item.typeFk, myOptions);
|
||||
pau marked this conversation as resolved
Outdated
|
||||
|
||||
// Update the item with the new isLaid value
|
||||
|
||||
item.isLaid = itemType.isLaid;
|
||||
|
||||
await item.save(myOptions);
|
||||
pau marked this conversation as resolved
Outdated
joan
commented
Evitar el save para no hacer dos consultas a la bd Evitar el save para no hacer dos consultas a la bd
|
||||
|
|
Loading…
Reference in New Issue
Mover esta linea arriba del create para poder crearlo directamente con el valor de la propiedad isLaid