Skip to content

Commit

Permalink
fix(types): allow pick any range filters, rather than just one
Browse files Browse the repository at this point in the history
  • Loading branch information
uladkasach committed Sep 14, 2024
1 parent 1b2caaf commit 3dfa7fc
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/domain/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PickOne } from 'type-fns';
import { PickAny, PickOne } from 'type-fns';

/**
* .what = the shape of pagination request inputs
Expand All @@ -10,10 +10,8 @@ import { PickOne } from 'type-fns';
* - .since => `>=`
* - .until => `<`
* - .uptil => `<=`
* - the page.range will specify the order to sort the items on the page with
* - .since => sort asc
* - .until => sort desc
* - .uptil => sort desc
* - the page.order will specify the order to sort the items on the page with
* - asc | desc
*
* todo
* - support range having more than one filter
Expand All @@ -22,29 +20,31 @@ export type PaginationInput<TRangeShape> = {
/**
* the range of items to include in this page
*/
range: PickOne<{
range: PickAny<{
/**
* .what = filter to items with values of this range key
* - filter on `item.value >= since.value`
* - order on values ASC
*/
since: TRangeShape;

/**
* .what = filter to items with values of this range key
* - filter on `item.value < since.value`
* - order on values DESC
*/
until: TRangeShape;

/**
* .what = filter to items with values of this range key
* - filter on `item.value <= since.value`
* - order on values DESC
*/
uptil: TRangeShape;
}>;

/**
* the order with which to sort on the range key
*/
order: 'ASC' | 'DESC';

/**
* the limit of items to include in this page
*/
Expand Down

0 comments on commit 3dfa7fc

Please sign in to comment.