Skip to content

Commit

Permalink
queryByKeys fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ackava committed Dec 9, 2024
1 parent 1dd0c51 commit c0d6a32
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/model/EntitySource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,15 @@ export class EntitySource<T = any> {
}

public loadByKeys(keys: Partial<T>): Promise<T> {
return (this.queryByKeys(keys) as any) .first() as Promise<T>;
}

public queryByKeys(keys: Partial<T>): IEntityQuery<T> {
const identity = IdentityService.getIdentity(this.model, keys);
const entry = this.context.changeSet.getByIdentity(identity);
if (entry) {
return entry.entity;
}
return (this.queryByKeys(keys) as any) .first() as Promise<T>;
}

public queryByKeys(keys: Partial<T>): IEntityQuery<T> {
const filter = [];
for (const iterator of this.model.keys) {
filter.push(`x.${iterator.name} === p.${iterator.name}`);
Expand Down

0 comments on commit c0d6a32

Please sign in to comment.