Delete
Exclusão clássica, recebe como parâmetro o tipo da entidade para excluí-la ou { chave: valor } para excluir todos os dados relacionados.
const example = await this.examplesRepository.findBy(
{ where: { id: 123 } },
trx,
);
if (!example) {
throw new AppError("NOT_FOUND", "Example not found");
};
await this.examplesRepository.delete({ id: example.id }, trx);
// exemplo de exclusão
await this.examplesRepository.delete({ name: "example" }, trx);
// deleta todos onde name = example
Was this helpful?