Skip to content

Commit

Permalink
Revert "refactor: bug fix related to indexing"
Browse files Browse the repository at this point in the history
This reverts commit b73d70d.
  • Loading branch information
Pratap2018 committed Apr 27, 2024
1 parent b0a3f4f commit 3702434
Showing 1 changed file with 18 additions and 23 deletions.
41 changes: 18 additions & 23 deletions src/user-vault/services/user-vault.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,34 +43,29 @@ export class UserVaultService {

// await this.documentRepository.connectDB(documentVaultId);

const documents = flag ? await (async () => {
const equalsDbQuery = [];

query.equals?.forEach((e) => {
equalsDbQuery.push({
'indexed.attributes.name': Object.keys(e)[0],
'indexed.attributes.value': Object.values(e)[0],
});
});

return await this.documentRepository.queryDocuments({
$and: equalsDbQuery,
});




const documents = flag ? await (async () => {

const name = Object.keys(query.equals[0])
const value = Object.values(query.equals[0])
return await this.documentRepository.queryDocuments({
'indexed.attributes.name': name[0],
'indexed.attributes.value': value[0]
})
})()
: await (async () => {
const hasDbQuery = [];
: await this.documentRepository.queryDocuments(
{
'indexed.attributes.name': query.has[0]
}
);

query.has?.forEach((e) => {
hasDbQuery.push({
'indexed.attributes.name': e,
});
});

return await this.documentRepository.queryDocuments({
$and: hasDbQuery,
});
})();

// await this.documentRepository.disconnectDB();

return documents as unknown as Array<DocumentResponseDTO>;

Expand Down

0 comments on commit 3702434

Please sign in to comment.