-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from ThreeDify/pagination
Add pagination in reconstructions API.
- Loading branch information
Showing
13 changed files
with
302 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* @swagger | ||
* | ||
* components: | ||
* schemas: | ||
* PaginatedResult: | ||
* type: object | ||
* properties: | ||
* data: | ||
* type: array | ||
* items: {} | ||
* total: | ||
* type: number | ||
* pageSize: | ||
* type: number | ||
* currentPage: | ||
* type: number | ||
* hasNextPage: | ||
* type: boolean | ||
* hasPrevPage: | ||
* type: boolean | ||
* currentPageSize: | ||
* type: number | ||
*/ | ||
|
||
import { Model } from 'objection'; | ||
|
||
export interface PaginatedResult<T extends Model> { | ||
data: T[]; | ||
total: number; | ||
pageSize: number; | ||
currentPage: number; | ||
hasNextPage: boolean; | ||
hasPrevPage: boolean; | ||
currentPageSize: number; | ||
} | ||
|
||
export default PaginatedResult; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { SortOrder } from './PaginationQuery'; | ||
|
||
export interface PaginationConfig { | ||
minPageSize: number; | ||
defaultOrder: SortOrder; | ||
} | ||
|
||
export default PaginationConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* @swagger | ||
* | ||
* components: | ||
* parameters: | ||
* page: | ||
* in: query | ||
* name: page | ||
* description: The page to fetch data from. | ||
* schema: | ||
* type: number | ||
* minimum: 1 | ||
* default: 1 | ||
* size: | ||
* in: query | ||
* name: size | ||
* description: Size of the page. | ||
* schema: | ||
* type: number | ||
* minimum: 1 | ||
* default: 10 | ||
* filters: | ||
* in: query | ||
* name: filters | ||
* description: Filters to apply to generate pages. For multiple filters, use comma(,) separated value. | ||
* required: false | ||
* schema: | ||
* type: string | ||
* order: | ||
* in: query | ||
* name: order | ||
* description: The order to sort the result in . | ||
* schema: | ||
* type: string | ||
* enum: | ||
* - ASC | ||
* - DESC | ||
* default: ASC | ||
*/ | ||
|
||
export enum SortOrder { | ||
ASC = 'ASC', | ||
DSC = 'DESC', | ||
} | ||
|
||
export interface PaginationQuery { | ||
page: number; | ||
size: number; | ||
filters: string[]; | ||
order: SortOrder; | ||
} | ||
|
||
export default PaginationQuery; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.