UpdateMany
Classic update, receives as parameter the type array of IEntityDTO and execute multiple queries at once.
data: Array<IExampleDTO>;
const examples = await this.examplesRepository.findBy(
{ where: { name: 'example' } },
trx,
);
const examplesToUpdate = examples.map(example => {
return {
...example,
name: data.name,
description: data.description;
}
})
await this.examplesRepository.update(examplesToUpdate, trx);
Was this helpful?