Skip to content

Commit

Permalink
upgrade keq
Browse files Browse the repository at this point in the history
  • Loading branch information
Val-istar-Guo committed Jun 2, 2024
1 parent d07267d commit ea38979
Show file tree
Hide file tree
Showing 93 changed files with 1,605 additions and 1,028 deletions.
2 changes: 1 addition & 1 deletion app/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"fs-extra": "^11.2.0",
"get-stream": "^9.0.1",
"into-stream": "^8.0.1",
"keq": "^2.5.2",
"keq": "^2.6.4",
"keq-debug": "^2.0.3",
"keq-headers": "^2.0.1",
"mime": "^4.0.3",
Expand Down
30 changes: 18 additions & 12 deletions app/backend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions app/backend/src/modules/sheet/dto/update-sheet.dto.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import { OmitType, PartialType } from '@nestjs/swagger'
import { SheetPullCrontabDTO } from './sheet-pull-crontab.dto'
import { Type } from 'class-transformer'
import { IsOptional, ValidateNested } from 'class-validator'
import { IsOptional, IsString, ValidateNested } from 'class-validator'
import { CreateSheetDTO } from './create-sheet.dto'
import { SheetType } from '../constants/sheet-type.enum'
import { SheetMode } from '../constants/sheet-mode.enum'


export class UpdateSheetDTO extends PartialType(OmitType(CreateSheetDTO, ['code', 'application'])) {
@IsOptional()
order?
@IsString()
order?: number

@IsOptional()
type?
type?: SheetType

@IsOptional()
title?
@IsString()
title?: string

@IsOptional()
mode?
mode?: SheetMode

@IsOptional()
@Type(() => SheetPullCrontabDTO)
Expand Down
4 changes: 2 additions & 2 deletions app/backend/src/modules/sheet/entity/sheet.entity.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Cascade, Collection, Entity, Enum, ManyToOne, OneToMany, OneToOne, Opt, Property, Ref, Unique, t } from '@mikro-orm/core'
import { IsEnum, IsOptional, IsString, Matches, MaxLength } from 'class-validator'
import { IsEnum, IsInt, IsOptional, IsString, Matches, MaxLength } from 'class-validator'
import { BaseEntity } from '~/entities/base.entity'
import { SheetMode } from '../constants/sheet-mode.enum'
import { ApiHideProperty, ApiProperty } from '@nestjs/swagger'
Expand Down Expand Up @@ -43,7 +43,7 @@ export class Sheet extends BaseEntity {
/**
* 文档排序
*/
@IsString()
@IsInt()
@Property({
type: t.integer,
comment: '文档排序',
Expand Down
10 changes: 10 additions & 0 deletions app/frontend/.keqrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineKeqConfig, FileNamingStyle } from 'keq-cli'


export default defineKeqConfig({
outdir: './api',
fileNamingStyle: FileNamingStyle.snakeCase,
modules: {
backend: 'http://0.0.0.0:8080/swagger',
},
})
4 changes: 0 additions & 4 deletions app/frontend/.keqrc.yaml

This file was deleted.

58 changes: 2 additions & 56 deletions app/frontend/api/backend/check_health.ts
Original file line number Diff line number Diff line change
@@ -1,64 +1,10 @@
import { Keq } from 'keq'
import { request } from 'keq'
import type { RequestParameters, ResponseMap, Operation } from "./types/check_health.js"


interface ResponseMap {
"200": {
"status"?: string
"info"?: {
[key: string]: undefined | {
"status": string
[key: string]: undefined | any
}
} | null
"error"?: {
[key: string]: undefined | {
"status": string
[key: string]: undefined | any
}
} | null
"details"?: {
[key: string]: undefined | {
"status": string
[key: string]: undefined | any
}
}
}
"503": {
"status"?: string
"info"?: {
[key: string]: undefined | {
"status": string
[key: string]: undefined | any
}
} | null
"error"?: {
[key: string]: undefined | {
"status": string
[key: string]: undefined | any
}
} | null
"details"?: {
[key: string]: undefined | {
"status": string
[key: string]: undefined | any
}
}
}
}


interface QueryArg {
}

interface ParamArg {
}

interface HeaderArg {
}


export function checkHealth<STATUS extends keyof ResponseMap>(arg?: QueryArg & ParamArg & HeaderArg): Keq<ResponseMap[STATUS]> {
export function checkHealth<STATUS extends keyof ResponseMap>(arg?: RequestParameters): Keq<ResponseMap[STATUS], Operation<STATUS>> {
const req = request.get<ResponseMap[STATUS]>("/api/health")
.option('module', {
name: "backend",
Expand Down
4 changes: 2 additions & 2 deletions app/frontend/api/backend/components/schemas/api_file.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SheetVersion } from "./sheet_version"
import { EntityReferenceDTO } from "./entity_reference_dto"
import type { SheetVersion } from "./sheet_version.js"
import type { EntityReferenceDTO } from "./entity_reference_dto.js"


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApplicationIdReferenceDTO } from "./application_id_reference_dto"
import { ApplicationCodeReferenceDTO } from "./application_code_reference_dto"
import { SheetPullCrontabDTO } from "./sheet_pull_crontab_dto"
import type { ApplicationIdReferenceDTO } from "./application_id_reference_dto.js"
import type { ApplicationCodeReferenceDTO } from "./application_code_reference_dto.js"
import type { SheetPullCrontabDTO } from "./sheet_pull_crontab_dto.js"


/**
Expand Down
52 changes: 26 additions & 26 deletions app/frontend/api/backend/components/schemas/index.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
export * from "./example_dto"
export * from "./register_application_dto"
export * from "./create_application_dto"
export * from "./application"
export * from "./application_dto"
export * from "./response_of_pagination_dto"
export * from "./response_of_query_applications_dto"
export * from "./forbidden_application_code"
export * from "./create_forbidden_application_code_dto"
export * from "./register_sheet_dto"
export * from "./sheet_pull_crontab_dto"
export * from "./update_sheet_dto"
export * from "./sheet_pull_crontab"
export * from "./entity_reference_dto"
export * from "./sheet"
export * from "./application_id_reference_dto"
export * from "./application_code_reference_dto"
export * from "./create_sheet_dto"
export * from "./response_of_query_sheets_dto"
export * from "./sheet_version"
export * from "./api_file"
export * from "./response_of_query_api_files_dto"
export * from "./query_sheet_versions_response_dto"
export * from "./package_metadata_dto"
export * from "./sdk"
export * from "./response_of_query_sdks_dto"
export * from "./example_dto.js"
export * from "./register_application_dto.js"
export * from "./create_application_dto.js"
export * from "./application.js"
export * from "./application_dto.js"
export * from "./response_of_pagination_dto.js"
export * from "./response_of_query_applications_dto.js"
export * from "./forbidden_application_code.js"
export * from "./create_forbidden_application_code_dto.js"
export * from "./register_sheet_dto.js"
export * from "./sheet_pull_crontab_dto.js"
export * from "./update_sheet_dto.js"
export * from "./sheet_pull_crontab.js"
export * from "./entity_reference_dto.js"
export * from "./sheet.js"
export * from "./application_id_reference_dto.js"
export * from "./application_code_reference_dto.js"
export * from "./create_sheet_dto.js"
export * from "./response_of_query_sheets_dto.js"
export * from "./sheet_version.js"
export * from "./api_file.js"
export * from "./response_of_query_api_files_dto.js"
export * from "./query_sheet_versions_response_dto.js"
export * from "./package_metadata_dto.js"
export * from "./sdk.js"
export * from "./response_of_query_sdks_dto.js"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SheetVersion } from "./sheet_version"
import { ResponseOfPaginationDTO } from "./response_of_pagination_dto"
import type { ResponseOfPaginationDTO } from "./response_of_pagination_dto.js"
import type { SheetVersion } from "./sheet_version.js"


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApiFile } from "./api_file"
import { ResponseOfPaginationDTO } from "./response_of_pagination_dto"
import type { ResponseOfPaginationDTO } from "./response_of_pagination_dto.js"
import type { ApiFile } from "./api_file.js"


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApplicationDTO } from "./application_dto"
import { ResponseOfPaginationDTO } from "./response_of_pagination_dto"
import type { ResponseOfPaginationDTO } from "./response_of_pagination_dto.js"
import type { ApplicationDTO } from "./application_dto.js"


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Sdk } from "./sdk"
import { ResponseOfPaginationDTO } from "./response_of_pagination_dto"
import type { ResponseOfPaginationDTO } from "./response_of_pagination_dto.js"
import type { Sdk } from "./sdk.js"


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Sheet } from "./sheet"
import { ResponseOfPaginationDTO } from "./response_of_pagination_dto"
import type { ResponseOfPaginationDTO } from "./response_of_pagination_dto.js"
import type { Sheet } from "./sheet.js"


/**
Expand Down
4 changes: 2 additions & 2 deletions app/frontend/api/backend/components/schemas/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SheetVersion } from "./sheet_version"
import { EntityReferenceDTO } from "./entity_reference_dto"
import type { SheetVersion } from "./sheet_version.js"
import type { EntityReferenceDTO } from "./entity_reference_dto.js"


/**
Expand Down
4 changes: 2 additions & 2 deletions app/frontend/api/backend/components/schemas/sheet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SheetPullCrontab } from "./sheet_pull_crontab"
import { EntityReferenceDTO } from "./entity_reference_dto"
import type { SheetPullCrontab } from "./sheet_pull_crontab.js"
import type { EntityReferenceDTO } from "./entity_reference_dto.js"


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EntityReferenceDTO } from "./entity_reference_dto"
import type { EntityReferenceDTO } from "./entity_reference_dto.js"


/**
Expand Down
10 changes: 5 additions & 5 deletions app/frontend/api/backend/components/schemas/update_sheet_dto.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import { SheetPullCrontabDTO } from "./sheet_pull_crontab_dto"
import type { SheetPullCrontabDTO } from "./sheet_pull_crontab_dto.js"


/**
* @interface UpdateSheetDTO
* @export
*/
export interface UpdateSheetDTO {
/**
* 文档拉取定时任务(mode &#x3D; pull)
*/
"pullCrontab"?: SheetPullCrontabDTO
/**
* 文档排序
*/
Expand All @@ -23,4 +19,8 @@ export interface UpdateSheetDTO {
*/
"title"?: string
"mode"?: "pull" | "push"
/**
* 文档拉取定时任务(mode &#x3D; pull)
*/
"pullCrontab"?: SheetPullCrontabDTO
}
Loading

0 comments on commit ea38979

Please sign in to comment.