-
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 #16 from ThreeDify/dev
Dev => Master
- Loading branch information
Showing
17 changed files
with
352 additions
and
42 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
24 changes: 24 additions & 0 deletions
24
migrations/20201122143517_alter_reconstructions_table_add_state_column.ts
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,24 @@ | ||
import * as Knex from 'knex'; | ||
|
||
export async function up(knex: Knex): Promise<void> { | ||
await knex.schema.table( | ||
'reconstructions', | ||
(table: Knex.AlterTableBuilder) => { | ||
table | ||
.enu('state', ['INQUEUE', 'INPROGRESS', 'COMPLETED'], { | ||
useNative: true, | ||
enumName: 'ReconstructionState', | ||
}) | ||
.defaultTo('INQUEUE'); | ||
} | ||
); | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void> { | ||
await knex.schema.table( | ||
'reconstructions', | ||
(table: Knex.AlterTableBuilder) => { | ||
table.dropColumn('state'); | ||
} | ||
); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* @swagger | ||
* | ||
* components: | ||
* schemas: | ||
* ReconstructionState: | ||
* type: string | ||
* enum: | ||
* - INQUEUE | ||
* - INPROGRESS | ||
* - COMPLETED | ||
*/ | ||
|
||
export enum ReconstructionState { | ||
INQUEUE = 'INQUEUE', | ||
INPROGRESS = 'INPROGRESS', | ||
COMPLETED = 'COMPLETED', | ||
} | ||
|
||
export default ReconstructionState; |
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.