Skip to content

Commit

Permalink
fixup! more minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
bajtos committed Mar 19, 2019
1 parent 1e199e8 commit 1f8df53
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/repository/src/relations/has-one/has-one.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {Getter} from '@loopback/context';
import {Count, DataObject, Options} from '../../common-types';
import {EntityNotFoundError} from '../../errors';
import {Entity} from '../../model';
import {Filter, Where} from '../../query';
import {Filter} from '../../query';
import {
constrainDataObject,
constrainFilter,
Expand Down Expand Up @@ -105,7 +105,10 @@ export class DefaultHasOneRepository<
}
async delete(options?: Options): Promise<Count> {
const targetRepository = await this.getTargetRepository();
return targetRepository.deleteAll(this.constraint, options);
return targetRepository.deleteAll(
constrainWhere({}, this.constraint),
options,
);
}

async patch(
Expand All @@ -115,7 +118,8 @@ export class DefaultHasOneRepository<
const targetRepository = await this.getTargetRepository();
return await targetRepository.updateAll(
constrainDataObject(dataObject, this.constraint),
constrainWhere({}, this.constraint as Where<TargetEntity>),
constrainWhere({}, this.constraint),
options,
);
}
}

0 comments on commit 1f8df53

Please sign in to comment.