Skip to content

Commit

Permalink
Merge pull request #5 from yepes/master
Browse files Browse the repository at this point in the history
withDeleted not working with relations
  • Loading branch information
zaro committed Sep 8, 2022
2 parents 4d93111 + 6398238 commit ab8dee8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/crud-typeorm/src/typeorm-crud.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,13 @@ export class TypeOrmCrudService<T> extends CrudService<T, DeepPartial<T>> {
const select = this.getSelect(parsed, options.query);
// select fields
builder.select(select);

// if soft deleted is enabled add where statement to filter deleted records
if (this.entityHasDeleteColumn && options.query.softDelete) {
if (parsed.includeDeleted === 1 || withDeleted) {
builder.withDeleted();
}
}

// search
this.setSearchCondition(builder, parsed.search, options.operators?.custom);
Expand Down Expand Up @@ -340,13 +347,6 @@ export class TypeOrmCrudService<T> extends CrudService<T, DeepPartial<T>> {
}
}

// if soft deleted is enabled add where statement to filter deleted records
if (this.entityHasDeleteColumn && options.query.softDelete) {
if (parsed.includeDeleted === 1 || withDeleted) {
builder.withDeleted();
}
}

/* istanbul ignore else */
if (many) {
// set sort (order by)
Expand Down

0 comments on commit ab8dee8

Please sign in to comment.