Skip to content

Commit

Permalink
Update packages/app-builder/src/models/pagination.ts
Browse files Browse the repository at this point in the history
Co-authored-by: Thomas Lathuiliere <[email protected]>

fix
  • Loading branch information
Pascal-Delange committed Jan 22, 2024
1 parent 6ee354b commit 248a933
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions packages/app-builder/src/models/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ export type PaginatedResponse<T> = {
endIndex: number;
};

export function fromPaginationDto(pagination: PaginationDto): Pagination {
export function adaptPagination(paginationDto: PaginationDto): Pagination {
return {
totalCount: {
value: pagination.total_count.value,
isMaxCount: pagination.total_count.is_max_count,
value: paginationDto.total_count.value,
isMaxCount: paginationDto.total_count.is_max_count,
},
startIndex: pagination.start_index,
endIndex: pagination.end_index,
startIndex: paginationDto.start_index,
endIndex: paginationDto.end_index,
};
}

Expand Down
4 changes: 2 additions & 2 deletions packages/app-builder/src/repositories/CaseRepository.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type MarbleApi } from '@app-builder/infra/marble-api';
import { adaptCaseDetailDto, type CaseDetail } from '@app-builder/models/cases';
import {
adaptPagination,
type FiltersWithPagination,
fromPaginationDto,
type PaginatedResponse,
} from '@app-builder/models/pagination';
import { add } from 'date-fns/add';
Expand Down Expand Up @@ -64,7 +64,7 @@ export function getCaseRepository() {

return {
items,
...fromPaginationDto(pagination),
...adaptPagination(pagination),
};
},
getCase: async ({ caseId }) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/app-builder/src/repositories/DecisionRepository.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type MarbleApi } from '@app-builder/infra/marble-api';
import {
adaptPagination,
type FiltersWithPagination,
fromPaginationDto,
type PaginatedResponse,
} from '@app-builder/models/pagination';
import { add } from 'date-fns/add';
Expand Down Expand Up @@ -55,7 +55,7 @@ export function getDecisionRepository() {

return {
items,
...fromPaginationDto(pagination),
...adaptPagination(pagination),
};
},
});
Expand Down

0 comments on commit 248a933

Please sign in to comment.