Skip to content

Commit 5129e6a

Browse files
BKNDLSS-27109 Find by id sends a "pageSize" parameter (#227)
1 parent ceae6c8 commit 5129e6a

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/data/store.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ export default class DataStore {
131131
throw new Error('Object Id must be provided and must be a string or an object of primary keys.')
132132
}
133133

134+
if (query) {
135+
query.pageSize = null
136+
query.offset = null
137+
}
138+
134139
result = await this.app.request
135140
.get({
136141
url : this.app.urls.dataTableObject(this.className, objectId),

test/tsd.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,19 +487,19 @@ function testDataStoreClass() {
487487
promiseObject = dataStore.findById('myId');
488488
promiseObject = dataStore.findById('myId', dataQueryBuilder);
489489
promiseObject = dataStore.findById('myId', dataQueryObject);
490-
promiseObject = dataStore.findById('myId', {pageSize: 123});
490+
promiseObject = dataStore.findById('myId', {properties: ['foo']});
491491
promiseObject = dataStore.findById({foo: 'myId'});
492492
promiseObject = dataStore.findById({foo: 'myId'}, dataQueryBuilder);
493-
promiseObject = dataStore.findById({foo: 'myId'}, {pageSize: 123});
493+
promiseObject = dataStore.findById({foo: 'myId'}, {properties: ['foo']});
494494

495495
promisePerson = dataStore.findById<Person>('myId');
496496
promisePerson = dataStore.findById<Person>('myId', dataQueryBuilder);
497497
promisePerson = dataStore.findById<Person>('myId', dataQueryObject);
498-
promisePerson = dataStore.findById<Person>('myId', {pageSize: 123});
498+
promisePerson = dataStore.findById<Person>('myId', {properties: ['foo']});
499499
promisePerson = dataStore.findById<Person>({foo: 'myId'});
500500
promisePerson = dataStore.findById<Person>({foo: 'myId'}, dataQueryBuilder);
501501
promisePerson = dataStore.findById<Person>({foo: 'myId'}, dataQueryBuilder);
502-
promisePerson = dataStore.findById<Person>({foo: 'myId'}, {pageSize: 123});
502+
promisePerson = dataStore.findById<Person>({foo: 'myId'}, {properties: ['foo']});
503503

504504
promiseObject = dataStore.findFirst();
505505
promiseObject = dataStore.findFirst(dataQueryBuilder);

test/unit/specs/data/find.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,21 +255,21 @@ describe('<Data> Find', function() {
255255

256256
expect(req1).to.deep.include({
257257
method : 'GET',
258-
path : `${APP_PATH}/data/${tableName}/${objectId}?pageSize=50&offset=15&property=foo&property=bar&property=prop1&property=prop2&property=prop3&property=prop4&property=prop5&property=prop6&property=prop7&property=prop8&property=prop9&property=*&excludeProps=foo,bar,prop1,prop2,prop3,prop4,prop5,prop6,prop7,prop8&where=age%20%3E%3D%20100&having=age%20%3E%3D%20200&sortBy=created&groupBy=objectId&loadRelations=rel1,rel2,rel3&relationsDepth=3&relationsPageSize=25&distinct=true`,
258+
path : `${APP_PATH}/data/${tableName}/${objectId}?property=foo&property=bar&property=prop1&property=prop2&property=prop3&property=prop4&property=prop5&property=prop6&property=prop7&property=prop8&property=prop9&property=*&excludeProps=foo,bar,prop1,prop2,prop3,prop4,prop5,prop6,prop7,prop8&where=age%20%3E%3D%20100&having=age%20%3E%3D%20200&sortBy=created&groupBy=objectId&loadRelations=rel1,rel2,rel3&relationsDepth=3&relationsPageSize=25&distinct=true`,
259259
headers: {},
260260
body : undefined
261261
})
262262

263263
expect(req2).to.deep.include({
264264
method : 'GET',
265-
path : `${APP_PATH}/data/${tableName}/${objectId}?pageSize=10`,
265+
path : `${APP_PATH}/data/${tableName}/${objectId}`,
266266
headers: {},
267267
body : undefined
268268
})
269269

270270
expect(req3).to.deep.include({
271271
method : 'GET',
272-
path : `${APP_PATH}/data/${tableName}/${objectId}?pageSize=30&offset=40&property=prop-1&property=prop-2&excludeProps=prop-3,prop-3&where=test-where&having=test-having&sortBy=test-sortby&groupBy=test-groupby&loadRelations=rel-1,rel-2&relationsDepth=4&relationsPageSize=70`,
272+
path : `${APP_PATH}/data/${tableName}/${objectId}?property=prop-1&property=prop-2&excludeProps=prop-3,prop-3&where=test-where&having=test-having&sortBy=test-sortby&groupBy=test-groupby&loadRelations=rel-1,rel-2&relationsDepth=4&relationsPageSize=70`,
273273
headers: {},
274274
body : undefined
275275
})

0 commit comments

Comments
 (0)