Skip to content

Commit ab6967d

Browse files
refactor: use bulkOnly filter on fetchDatasetOrderbook
1 parent 61a1318 commit ab6967d

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

packages/sdk/src/lib/dataProtectorCore/getGrantedAccess.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,11 @@ export const getGrantedAccess = async ({
5151
isAppStrict: true,
5252
page: vPage,
5353
pageSize: vPageSize,
54+
bulkOnly: vBulkOnly,
5455
});
55-
let grantedAccess = orders?.map((order) =>
56+
const grantedAccess = orders?.map((order) =>
5657
formatGrantedAccess(order.order, order.remaining)
5758
);
58-
59-
// Filter for bulk orders if bulkOnly is true
60-
if (vBulkOnly && grantedAccess) {
61-
grantedAccess = grantedAccess.filter(
62-
(access) => access.volume === utils.DATASET_INFINITE_VOLUME.toString()
63-
);
64-
}
65-
6659
return { count, grantedAccess };
6760
} catch (e) {
6861
handleIfProtocolError(e);

packages/sdk/tests/unit/dataProtectorCore/getGrantedAccess.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ describe('getGrantedAccess', () => {
125125
pageSize: 10,
126126
isRequesterStrict: true,
127127
isAppStrict: true,
128+
bulkOnly: false,
128129
});
129130
});
130131
});
@@ -242,6 +243,7 @@ describe('getGrantedAccess', () => {
242243
pageSize: undefined,
243244
isRequesterStrict: false,
244245
isAppStrict: true,
246+
bulkOnly: false,
245247
});
246248

247249
expect(grantedAccessResult.count).toBe(1);

0 commit comments

Comments
 (0)