diff --git a/dictation_server/src/features/accounts/types/types.ts b/dictation_server/src/features/accounts/types/types.ts index 6e45d8e..c587255 100644 --- a/dictation_server/src/features/accounts/types/types.ts +++ b/dictation_server/src/features/accounts/types/types.ts @@ -184,7 +184,7 @@ export class GetTypistGroupRequest { @ApiProperty() @Type(() => Number) @IsInt() - @Min(0) + @Min(1) typistGroupId: number; } export class GetTypistGroupResponse { @@ -203,7 +203,7 @@ export class CreateTypistGroupRequest { @ArrayMinSize(1) @IsArray() @IsInt({ each: true }) - @Min(0, { each: true }) + @Min(1, { each: true }) @IsUnique() typistIds: number[]; } @@ -219,7 +219,7 @@ export class UpdateTypistGroupRequest { @ArrayMinSize(1) @IsArray() @IsInt({ each: true }) - @Min(0, { each: true }) + @Min(1, { each: true }) @IsUnique() typistIds: number[]; } @@ -227,7 +227,7 @@ export class UpdateTypistGroupRequestParam { @ApiProperty() @Type(() => Number) @IsInt() - @Min(0) + @Min(1) typistGroupId: number; } export class UpdateTypistGroupResponse {} @@ -463,7 +463,7 @@ export class GetOptionItemsRequestParam { @ApiProperty({ description: 'Worktypeの内部ID' }) @Type(() => Number) @IsInt() - @Min(0) + @Min(1) id: number; } @@ -487,7 +487,7 @@ export class UpdateOptionItemsRequestParam { @ApiProperty({ description: 'Worktypeの内部ID' }) @Type(() => Number) @IsInt() - @Min(0) + @Min(1) id: number; } @@ -495,7 +495,7 @@ export class UpdateWorktypeRequestParam { @ApiProperty({ description: 'Worktypeの内部ID' }) @Type(() => Number) @IsInt() - @Min(0) + @Min(1) id: number; } @@ -503,7 +503,7 @@ export class DeleteWorktypeRequestParam { @ApiProperty({ description: 'Worktypeの内部ID' }) @Type(() => Number) @IsInt() - @Min(0) + @Min(1) id: number; } @@ -517,7 +517,7 @@ export class PostActiveWorktypeRequest { @IsOptional() @Type(() => Number) @IsInt() - @Min(0) + @Min(1) id?: number; } diff --git a/dictation_server/src/features/auth/types/types.ts b/dictation_server/src/features/auth/types/types.ts index c031508..023a982 100644 --- a/dictation_server/src/features/auth/types/types.ts +++ b/dictation_server/src/features/auth/types/types.ts @@ -1,10 +1,14 @@ import { ApiProperty } from '@nestjs/swagger'; -import { IsInt } from 'class-validator'; +import { IsIn, IsInt, IsNotEmpty, IsString } from 'class-validator'; export class TokenRequest { @ApiProperty() + @IsString() + @IsNotEmpty() idToken: string; @ApiProperty({ description: 'web or mobile or desktop' }) + @IsIn(['web', 'mobile', 'desktop'], { message: 'invalid type' }) + @IsNotEmpty() type: string; } export class TokenResponse { diff --git a/dictation_server/src/features/files/types/types.ts b/dictation_server/src/features/files/types/types.ts index 2fda838..3545a20 100644 --- a/dictation_server/src/features/files/types/types.ts +++ b/dictation_server/src/features/files/types/types.ts @@ -1,6 +1,17 @@ import { ApiProperty } from '@nestjs/swagger'; import { Type } from 'class-transformer'; -import { IsInt, Min } from 'class-validator'; +import { + ArrayMaxSize, + ArrayMinSize, + IsArray, + IsIn, + IsInt, + IsNotEmpty, + IsNumberString, + MaxLength, + Min, + MinLength, +} from 'class-validator'; export class AudioUploadLocationRequest {} @@ -13,6 +24,9 @@ export class AudioUploadLocationResponse { export class AudioDownloadLocationRequest { @ApiProperty({ description: 'ODMSCloud上で管理する音声ファイルのID' }) + @Type(() => Number) + @Min(1) + @IsInt() audioFileId: number; } @@ -26,7 +40,7 @@ export class AudioDownloadLocationResponse { export class TemplateDownloadLocationRequest { @ApiProperty({ description: '文字起こし対象の音声ファイルID' }) @Type(() => Number) - @Min(0) + @Min(1) @IsInt() audioFileId: number; } @@ -43,40 +57,58 @@ export class TemplateUploadLocationResponse { export class AudioOptionItem { @ApiProperty({ minLength: 1, maxLength: 16 }) + @MinLength(1) + @MaxLength(16) optionItemLabel: string; @ApiProperty({ minLength: 1, maxLength: 20 }) + @MinLength(1) + @MaxLength(20) optionItemValue: string; } export class AudioUploadFinishedRequest { @ApiProperty({ description: 'アップロード先Blob Storage(ファイル名含む)' }) + @IsNotEmpty() url: string; @ApiProperty({ description: '自分自身(ログイン認証)したAuthorID' }) + @IsNotEmpty() authorId: string; @ApiProperty({ description: '音声ファイル名' }) + @IsNotEmpty() fileName: string; @ApiProperty({ description: '音声ファイルの録音時間(ミリ秒の整数値)', }) + @IsNumberString() + @IsNotEmpty() duration: string; @ApiProperty({ description: '音声ファイルの録音作成日時(開始日時)(yyyy-mm-ddThh:mm:ss.sss)', }) + @IsNotEmpty() createdDate: string; @ApiProperty({ description: '音声ファイルの録音作成終了日時(yyyy-mm-ddThh:mm:ss.sss)', }) + @IsNotEmpty() finishedDate: string; @ApiProperty({ description: '音声ファイルのアップロード日時(yyyy-mm-ddThh:mm:ss.sss)', }) + @IsNotEmpty() uploadedDate: string; @ApiProperty({ description: '音声ファイルのファイルサイズ(Byte)' }) + @Type(() => Number) + @IsInt() + @IsNotEmpty() fileSize: number; @ApiProperty({ description: '優先度 "00":Normal / "01":High' }) + @IsIn(['00', '01'], { message: 'invalid priority' }) + @IsNotEmpty() priority: string; @ApiProperty({ description: '録音形式: DSS/DS2(SP)/DS2(QP)' }) + @IsNotEmpty() audioFormat: string; @ApiProperty() comment: string; @@ -88,6 +120,9 @@ export class AudioUploadFinishedRequest { minItems: 10, description: '音声ファイルに紐づくOption Itemの一覧(10個固定)', }) + @IsArray() + @ArrayMinSize(10) + @ArrayMaxSize(10) optionItemList: AudioOptionItem[]; @ApiProperty() isEncrypted: boolean; diff --git a/dictation_server/src/features/notification/types/types.ts b/dictation_server/src/features/notification/types/types.ts index b19bf08..433ea59 100644 --- a/dictation_server/src/features/notification/types/types.ts +++ b/dictation_server/src/features/notification/types/types.ts @@ -1,5 +1,5 @@ import { ApiProperty } from '@nestjs/swagger'; -import { IsIn } from 'class-validator'; +import { IsIn, IsNotEmpty, IsString } from 'class-validator'; import { PNS } from '../../../constants'; export class RegisterRequest { @@ -9,6 +9,8 @@ export class RegisterRequest { }) pns: string; @ApiProperty({ description: 'wnsのチャネルURI or apnsのデバイストークン' }) + @IsString() + @IsNotEmpty() handler: string; } diff --git a/dictation_server/src/features/tasks/types/types.ts b/dictation_server/src/features/tasks/types/types.ts index 80cff57..69b7c1d 100644 --- a/dictation_server/src/features/tasks/types/types.ts +++ b/dictation_server/src/features/tasks/types/types.ts @@ -22,7 +22,6 @@ export class TasksRequest { }) @IsInt() @Min(0) - @Type(() => Number) @IsOptional() @Type(() => Number) limit: number; @@ -35,7 +34,6 @@ export class TasksRequest { }) @IsInt() @Min(0) - @Type(() => Number) @IsOptional() @Type(() => Number) offset: number; @@ -192,6 +190,7 @@ export class AudioNextRequest { @ApiProperty({ description: '文字起こし完了したタスクの音声ファイルID' }) @Type(() => Number) @IsInt() + @Min(1) endedFileId: number; } diff --git a/dictation_server/src/features/workflows/types/types.ts b/dictation_server/src/features/workflows/types/types.ts index 87f77c0..e3e34df 100644 --- a/dictation_server/src/features/workflows/types/types.ts +++ b/dictation_server/src/features/workflows/types/types.ts @@ -53,19 +53,19 @@ export class CreateWorkflowsRequest { @ApiProperty({ description: 'Authorの内部ID' }) @Type(() => Number) @IsInt() - @Min(0) + @Min(1) authorId: number; @ApiProperty({ description: 'Worktypeの内部ID', required: false }) @IsOptional() @Type(() => Number) @IsInt() - @Min(0) + @Min(1) worktypeId?: number; @ApiProperty({ description: 'テンプレートの内部ID', required: false }) @IsOptional() @Type(() => Number) @IsInt() - @Min(0) + @Min(1) templateId?: number; @ApiProperty({ description: 'ルーティング候補のタイピストユーザー/タイピストグループ', @@ -84,7 +84,7 @@ export class UpdateWorkflowRequestParam { @ApiProperty({ description: 'ワークフローの内部ID' }) @Type(() => Number) @IsInt() - @Min(0) + @Min(1) workflowId: number; } @@ -92,19 +92,19 @@ export class UpdateWorkflowRequest { @ApiProperty({ description: 'Authorの内部ID' }) @Type(() => Number) @IsInt() - @Min(0) + @Min(1) authorId: number; @ApiProperty({ description: 'Worktypeの内部ID', required: false }) @IsOptional() @Type(() => Number) @IsInt() - @Min(0) + @Min(1) worktypeId?: number; @ApiProperty({ description: 'テンプレートの内部ID', required: false }) @IsOptional() @Type(() => Number) @IsInt() - @Min(0) + @Min(1) templateId?: number; @ApiProperty({ description: 'ルーティング候補のタイピストユーザー/タイピストグループ', @@ -123,7 +123,7 @@ export class DeleteWorkflowRequestParam { @ApiProperty({ description: 'ワークフローの内部ID' }) @Type(() => Number) @IsInt() - @Min(0) + @Min(1) workflowId: number; }