Skip to content

Commit

Permalink
Move internal type out of api-contract types
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya committed Mar 5, 2024
1 parent c4a595b commit 0713535
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
7 changes: 0 additions & 7 deletions src/api-contract/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,3 @@ export type ShlinkShortUrlsListParams = {
excludeMaxVisitsReached?: boolean;
excludePastValidUntil?: boolean;
};

export type ShlinkShortUrlsListNormalizedParams =
Omit<ShlinkShortUrlsListParams, 'orderBy' | 'excludeMaxVisitsReached' | 'excludePastValidUntil'> & {
orderBy?: string;
excludeMaxVisitsReached?: 'true';
excludePastValidUntil?: 'true';
};
13 changes: 8 additions & 5 deletions src/api/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import type {
ShlinkShortUrlsListNormalizedParams,
ShlinkShortUrlsListParams,
ShlinkShortUrlsOrder,
} from '../api-contract';
import type { ShlinkShortUrlsListParams, ShlinkShortUrlsOrder } from '../api-contract';

export type ApiVersion = 3;

Expand All @@ -12,6 +8,13 @@ const shortUrlsOrderToString = (order: ShlinkShortUrlsOrder): string | undefined
order.dir ? `${order.field}-${order.dir}` : undefined
);

type ShlinkShortUrlsListNormalizedParams =
Omit<ShlinkShortUrlsListParams, 'orderBy' | 'excludeMaxVisitsReached' | 'excludePastValidUntil'> & {
orderBy?: string;
excludeMaxVisitsReached?: 'true';
excludePastValidUntil?: 'true';
};

export const normalizeListParams = (
{ orderBy = {}, excludeMaxVisitsReached, excludePastValidUntil, ...rest }: ShlinkShortUrlsListParams,
): ShlinkShortUrlsListNormalizedParams => ({
Expand Down

0 comments on commit 0713535

Please sign in to comment.