Skip to content

Commit

Permalink
refactor(service): users/auth: better name for paging links function
Browse files Browse the repository at this point in the history
  • Loading branch information
restjohn committed Nov 3, 2024
1 parent 2142181 commit 2eb9527
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions service/src/entities/entities.global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export interface Links {
prev: number | null
}

export function calculateLinks(paging: PagingParameters, totalCount: number | null): Links {
export function calculatePagingLinks(paging: PagingParameters, totalCount: number | null): Links {
const limit = paging.pageSize
const start = paging.pageIndex * limit
const next = start + paging.pageSize < (totalCount || 0) ? paging.pageIndex + 1 : null
Expand All @@ -101,7 +101,7 @@ export function calculateLinks(paging: PagingParameters, totalCount: number | nu

export const pageOf = <T>(items: T[], paging: PagingParameters, totalCount?: number | null): PageOf<T> => {
const resolvedTotalCount = totalCount || 0;
const links = calculateLinks(paging, resolvedTotalCount)
const links = calculatePagingLinks(paging, resolvedTotalCount)
return {
totalCount: totalCount || null,
pageSize: typeof paging.pageSize === 'number' ? paging.pageSize : -1,
Expand Down

0 comments on commit 2eb9527

Please sign in to comment.