SoftDelete

Security delete, receives as parameter the type of the entity to invalidate it or a { key: value } type and invalidates all related data (does not delete them).

const example = await this.examplesRepository.findBy(
  { where: { id: 123 } },
  trx,
);

if (!example) {
  throw new AppError("NOT_FOUND", "Example not found");
};

await this.examplesRepository.softDelete({ id: example.id }, trx);

// invalidate example
await this.examplesRepository.softDelete({ name: "example" }, trx);

// invalidate all where name = example