Skip to content

Commit d821090

Browse files
author
Roman Snapko
authored
Change app connections list pagination order to DESC by updated column (#2122)
<!-- Ensure the title clearly reflects what was changed. Provide a clear and concise description of the changes made. The PR should only contain the changes related to the issue, and no other unrelated changes. --> Fixes OPS-3870
1 parent e10c2ea commit d821090

2 files changed

Lines changed: 21 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: 'app_connection.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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ 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 { AppConnectionEntity } from '../../../src/app/app-connection/app-connection.entity';
70+
import { buildPaginator } from '../../../src/app/helper/pagination/build-paginator';
6971

7072
describe('appConnectionService.update', () => {
7173
const projectId = 'project-123';
@@ -201,6 +203,20 @@ describe('appConnectionService.list', () => {
201203
authProviders,
202204
});
203205

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

0 commit comments

Comments
 (0)