Skip to content

Commit

Permalink
feat(trust.js): add getAllTrustRelationships function
Browse files Browse the repository at this point in the history
Added `getAllTrustRelationships` in trust.js for filtered and paginated trust relationships.
  • Loading branch information
Mloweedgar committed Mar 17, 2024
1 parent 7e9b69b commit e40ba05
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions server/models/Trust.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,25 @@ class Trust {
return this._trustRepository.getByFilter(filter, { offset, limit });
}

/*
* Get all trust relationships by filters, setting filter to undefined to allow all data
*/
async getAllTrustRelationships({ state, type, request_type, offset, limit }) {
const filter = {
and: [],
};
if (state) {
filter.and.push({ state });
}
if (type) {
filter.and.push({ type });
}
if (request_type) {
filter.and.push({ request_type });
}
return this._trustRepository.getAllByFilter(filter, { offset, limit });
}

/*
* Get all relationships which has been accepted
*/
Expand Down

0 comments on commit e40ba05

Please sign in to comment.