Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Commit

Permalink
feat: generic page args input (#17)
Browse files Browse the repository at this point in the history
* feat: enable generic page args input

* fix: generic type defaults
  • Loading branch information
Nicky Lenaers authored Jun 14, 2019
1 parent d3e9cf8 commit 04df810
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/pagination/types/page-args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ export interface PageArgsFilter {
}

/** Order By Option */
export interface OrderByOption {
field: string;
direction: 'ASC' | 'DESC';
export interface OrderByOption<S = string, D = ('ASC' | 'DESC')> {
field: S;
direction: D;
}

/** Order By Options */
export type OrderByOptions = OrderByOption[];
export type OrderByOptions<S = string, D = ('ASC' | 'DESC')> = Array<OrderByOption<S, D>>;

/** Page Arguments */
export interface PageArgs {
filters?: PageArgsFilter[];
export interface PageArgs<S = string, D = ('ASC' | 'DESC'), F = PageArgsFilter> {
filters?: F[];
queryOptions?: {
first?: number;
last?: number;
before?: string;
after?: string;
orderBy?: OrderByOptions;
orderBy?: OrderByOptions<S, D>;
};
}

Expand Down

0 comments on commit 04df810

Please sign in to comment.