Skip to content

Commit 6e7ad7c

Browse files
author
Roman Snapko
committed
Change app connections list pagination order to DESC by updated column
1 parent 26a6771 commit 6e7ad7c

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

packages/server/api/src/app/app-connection/app-connection-service/app-connection-service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,14 @@ export const appConnectionService = {
232232
entity: AppConnectionEntity,
233233
query: {
234234
limit,
235-
order: 'ASC',
235+
order: 'DESC',
236236
afterCursor: decodedCursor.nextCursor,
237237
beforeCursor: decodedCursor.previousCursor,
238238
},
239+
customPaginationColumn: {
240+
columnPath: 'updated',
241+
columnName: 'updated',
242+
},
239243
});
240244

241245
const querySelector: Record<string, string | FindOperator<string>> = {

packages/server/api/test/unit/app-connection/app-connection-service.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ import {
6666
} from '@openops/shared';
6767
import { appConnectionService } from '../../../src/app/app-connection/app-connection-service/app-connection-service';
6868
import { restoreRedactedSecrets } from '../../../src/app/app-connection/app-connection-utils';
69+
import { buildPaginator } from '../../../src/app/helper/pagination/build-paginator';
6970

7071
describe('appConnectionService.update', () => {
7172
const projectId = 'project-123';
@@ -201,6 +202,20 @@ describe('appConnectionService.list', () => {
201202
authProviders,
202203
});
203204

205+
expect(buildPaginator).toHaveBeenCalledWith({
206+
entity: expect.any(Object),
207+
query: {
208+
limit: 10,
209+
order: 'DESC',
210+
afterCursor: null,
211+
beforeCursor: null,
212+
},
213+
customPaginationColumn: {
214+
columnPath: 'updated',
215+
columnName: 'updated',
216+
},
217+
});
218+
204219
expect(andWhereMock).toHaveBeenCalledWith(
205220
'LOWER(app_connection.authProviderKey) IN (:...authProviders)',
206221
{ authProviders: ['github', 'slack'] },

0 commit comments

Comments
 (0)