Skip to content

Commit

Permalink
fix: fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
samwel141 committed Jul 16, 2024
1 parent ca93a95 commit 102e231
Showing 1 changed file with 26 additions and 29 deletions.
55 changes: 26 additions & 29 deletions server/models/Trust.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,31 @@ class Trust {
return this._trustRepository.getById(id);
}

static getTrustRelationshipFilter({ walletId, state, type, request_type }) {
const filter = {
and: [
{
or: [
{ actor_wallet_id: walletId },
{ target_wallet_id: walletId },
{ originator_wallet_id: walletId },
],
},
],
};
if (state) {
filter.and.push({ state });
}
if (type) {
filter.and.push({ type });
}
if (request_type) {
filter.and.push({ request_type });
}

return filter;
}

/*
* Get trust relationships by filters, setting filter to undefined to allow all data
*/
Expand Down Expand Up @@ -59,35 +84,7 @@ class Trust {
}
return this._trustRepository.getByFilter(filter, { offset, limit, sort_by, order });
}

/*
* Get trust relationships by filters, setting filter to undefined to allow all data
// */
// async getTrustRelationships({
// walletId,
// state,
// type,
// request_type,
// offset,
// limit,
// sort_by,
// order,
// }) {
// const filter = Trust.getTrustRelationshipFilter({
// walletId,
// state,
// type,
// request_type,
// });

// return this._trustRepository.getByFilter(filter, {
// offset,
// limit,
// sort_by,
// order,
// });
// }


async getTrustRelationshipsCount({ walletId, state, type, request_type }) {
const filter = Trust.getTrustRelationshipFilter({
walletId,
Expand Down

0 comments on commit 102e231

Please sign in to comment.