Skip to content

Commit

Permalink
perf(core): filter by isDeleted for credentials using tag query (#786)
Browse files Browse the repository at this point in the history
* feat(core): Filter by isDeleted for credentials using tag query

* remove redundant comment
  • Loading branch information
Sotatek-TungNguyen2a authored Oct 17, 2024
1 parent 2f8f84d commit 42dab78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/core/agent/records/credentialStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class CredentialStorage {
const records = await this.storageService.findAllByQuery(
{
...(isArchived !== undefined ? { isArchived } : {}),
isDeleted: false,
},
CredentialMetadataRecord
);
Expand Down
10 changes: 3 additions & 7 deletions src/core/agent/services/credentialService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,9 @@ class CredentialService extends AgentService {
const listMetadatas = await this.credentialStorage.getAllCredentialMetadata(
isGetArchive
);
// Only get credentials that are not deleted
// @TODO - foconnor: Should be filtering via SQL for the deleted ones.
return listMetadatas
.filter((item) => !item.isDeleted)
.map((element: CredentialMetadataRecord) =>
this.getCredentialShortDetails(element)
);
return listMetadatas.map((element: CredentialMetadataRecord) =>
this.getCredentialShortDetails(element)
);
}

private getCredentialShortDetails(
Expand Down

0 comments on commit 42dab78

Please sign in to comment.