Skip to content

updateById

AGenson edited this page Mar 4, 2018 · 4 revisions

updateById

Update the entity with the given id


Parameters

Property Type Default Description
ctx Object required Will serve to call a service action: ctx.call
id any required The field id of the entity to update
update Object required Fields to update --> ex: { username: "user", age: 5 }

Return

Type: Promise

If the entity was updated successfully :

// res = new value of the entity updated
Promise.resolve({
	name: "Operation Successful",
	message: `Update Done: element (id: ${res.id}) updated in table`,
	data: res.id
});

Else (entity not found / an error occured) :

Promise.reject({ ... });

cf - details about errors

Clone this wiki locally