Merged PR 87: IF実装(テンプレートファイルダウンロード先取得API/次ファイル情報取得要求API)
## 概要 [Task1646: IF実装(テンプレートファイルダウンロード先取得API/次ファイル情報取得要求API)](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/1646) - 以下の外部連携APIのIFを実装しました。 - テンプレートファイルダウンロード先取得API - 次ファイル情報取得要求AP ## レビューポイント - 次ファイル情報取得要求APIについてFilesフォルダを掘って新規に追加したがフォルダ構成に問題はないか。 - IFの応答ステータスは適切か。 - リクエスト/レスポンスは想定通りか ## UIの変更 - なし ## 動作確認状況 - ローカルで確認Swaggerで確認
This commit is contained in:
parent
469eb6542c
commit
728bd6dfeb
@ -463,6 +463,61 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/files/audio/next": {
|
||||
"get": {
|
||||
"operationId": "getNextAudioFile",
|
||||
"summary": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "endedFileId",
|
||||
"required": true,
|
||||
"in": "query",
|
||||
"description": "文字起こし完了したタスクの音声ファイルID",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功時のレスポンス",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/AudioNextResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "認証エラー",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "想定外のサーバーエラー",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": ["files"],
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/notification/register": {
|
||||
"post": {
|
||||
"operationId": "register",
|
||||
@ -627,6 +682,61 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/files/template/download-location": {
|
||||
"get": {
|
||||
"operationId": "downloadTemplateLocation",
|
||||
"summary": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "audioFileId",
|
||||
"required": true,
|
||||
"in": "query",
|
||||
"description": "文字起こし対象の音声ファイルID",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功時のレスポンス",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TemplateDownloadLocationResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "認証エラー",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "想定外のサーバーエラー",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": ["files"],
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"info": {
|
||||
@ -1039,6 +1149,16 @@
|
||||
"prompt"
|
||||
]
|
||||
},
|
||||
"AudioNextResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"nextFileId": {
|
||||
"type": "string",
|
||||
"description": "OMDS Cloud上の次の音声ファイルID"
|
||||
}
|
||||
},
|
||||
"required": ["nextFileId"]
|
||||
},
|
||||
"RegisterRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -1074,6 +1194,15 @@
|
||||
}
|
||||
},
|
||||
"required": ["url"]
|
||||
},
|
||||
"TemplateDownloadLocationResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"url": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["url"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,6 +23,9 @@ import { NotificationhubModule } from './gateways/notificationhub/notificationhu
|
||||
import { NotificationhubService } from './gateways/notificationhub/notificationhub.service';
|
||||
import { NotificationModule } from './features/notification/notification.module';
|
||||
import { BlobModule } from './features/blob/blob.module';
|
||||
import { FilesModule } from './features/files/files.module';
|
||||
import { FilesController } from './features/files/files.controller';
|
||||
import { FilesService } from './features/files/files.service';
|
||||
import { TaskController } from './features/task/task.controller';
|
||||
import { TaskService } from './features/task/task.service';
|
||||
import { TaskModule } from './features/task/task.module';
|
||||
@ -42,6 +45,7 @@ import { TaskModule } from './features/task/task.module';
|
||||
AccountsModule,
|
||||
TaskModule,
|
||||
UsersModule,
|
||||
FilesModule,
|
||||
SendGridModule,
|
||||
AccountsRepositoryModule,
|
||||
UsersRepositoryModule,
|
||||
@ -69,6 +73,7 @@ import { TaskModule } from './features/task/task.module';
|
||||
AccountsController,
|
||||
TaskController,
|
||||
UsersController,
|
||||
FilesController,
|
||||
],
|
||||
providers: [
|
||||
AuthService,
|
||||
@ -76,6 +81,7 @@ import { TaskModule } from './features/task/task.module';
|
||||
TaskService,
|
||||
UsersService,
|
||||
NotificationhubService,
|
||||
FilesService,
|
||||
],
|
||||
})
|
||||
export class AppModule {
|
||||
|
||||
@ -12,6 +12,8 @@ import {
|
||||
AudioUploadLocationRequest,
|
||||
AudioDownloadLocationResponse,
|
||||
AudioDownloadLocationRequest,
|
||||
TemplateDownloadLocationResponse,
|
||||
TemplateDownloadLocationRequest,
|
||||
} from './types/types';
|
||||
|
||||
@ApiTags('files')
|
||||
@ -76,4 +78,33 @@ export class BlobController {
|
||||
|
||||
return { url: '' };
|
||||
}
|
||||
|
||||
@Get('template/download-location')
|
||||
@ApiResponse({
|
||||
status: HttpStatus.OK,
|
||||
type: TemplateDownloadLocationResponse,
|
||||
description: '成功時のレスポンス',
|
||||
})
|
||||
@ApiResponse({
|
||||
status: HttpStatus.UNAUTHORIZED,
|
||||
description: '認証エラー',
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiResponse({
|
||||
status: HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
description: '想定外のサーバーエラー',
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiOperation({ operationId: 'downloadTemplateLocation' })
|
||||
@ApiBearerAuth()
|
||||
async downloadTemplateLocation(
|
||||
@Headers() headers,
|
||||
@Query() body: TemplateDownloadLocationRequest,
|
||||
): Promise<TemplateDownloadLocationResponse> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const { audioFileId } = body;
|
||||
// コンテナ作成処理の前にアクセストークンの認証を行う
|
||||
|
||||
return { url: '' };
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,3 +16,13 @@ export class AudioDownloadLocationResponse {
|
||||
@ApiProperty()
|
||||
url: string;
|
||||
}
|
||||
|
||||
export class TemplateDownloadLocationRequest {
|
||||
@ApiProperty({ description: '文字起こし対象の音声ファイルID' })
|
||||
audioFileId: string;
|
||||
}
|
||||
|
||||
export class TemplateDownloadLocationResponse {
|
||||
@ApiProperty()
|
||||
url: string;
|
||||
}
|
||||
|
||||
23
dictation_server/src/features/files/files.controller.spec.ts
Normal file
23
dictation_server/src/features/files/files.controller.spec.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { FilesController } from './files.controller';
|
||||
import { FilesService } from './files.service';
|
||||
|
||||
describe('FilesController', () => {
|
||||
let controller: FilesController;
|
||||
const mockFilesService = {};
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [FilesController],
|
||||
providers: [FilesService],
|
||||
})
|
||||
.overrideProvider(FilesService)
|
||||
.useValue(mockFilesService)
|
||||
.compile();
|
||||
|
||||
controller = module.get<FilesController>(FilesController);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
||||
44
dictation_server/src/features/files/files.controller.ts
Normal file
44
dictation_server/src/features/files/files.controller.ts
Normal file
@ -0,0 +1,44 @@
|
||||
import { Controller, Get, Headers, HttpStatus, Query } from '@nestjs/common';
|
||||
import {
|
||||
ApiResponse,
|
||||
ApiOperation,
|
||||
ApiBearerAuth,
|
||||
ApiTags,
|
||||
} from '@nestjs/swagger';
|
||||
import { ErrorResponse } from '../../common/error/types/types';
|
||||
import { FilesService } from './files.service';
|
||||
import { AudioNextRequest, AudioNextResponse } from './types/types';
|
||||
|
||||
@ApiTags('files')
|
||||
@Controller('files')
|
||||
export class FilesController {
|
||||
constructor(private readonly filesService: FilesService) {}
|
||||
|
||||
@Get('audio/next')
|
||||
@ApiResponse({
|
||||
status: HttpStatus.OK,
|
||||
type: AudioNextResponse,
|
||||
description: '成功時のレスポンス',
|
||||
})
|
||||
@ApiResponse({
|
||||
status: HttpStatus.UNAUTHORIZED,
|
||||
description: '認証エラー',
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiResponse({
|
||||
status: HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
description: '想定外のサーバーエラー',
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiOperation({ operationId: 'getNextAudioFile' })
|
||||
@ApiBearerAuth()
|
||||
async getNextAudioFile(
|
||||
@Headers() headers,
|
||||
@Query() body: AudioNextRequest,
|
||||
): Promise<AudioNextResponse> {
|
||||
const { endedFileId } = body;
|
||||
console.log(endedFileId);
|
||||
|
||||
return { nextFileId: '1234' };
|
||||
}
|
||||
}
|
||||
9
dictation_server/src/features/files/files.module.ts
Normal file
9
dictation_server/src/features/files/files.module.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { FilesService } from './files.service';
|
||||
import { FilesController } from './files.controller';
|
||||
|
||||
@Module({
|
||||
providers: [FilesService],
|
||||
controllers: [FilesController],
|
||||
})
|
||||
export class FilesModule {}
|
||||
18
dictation_server/src/features/files/files.service.spec.ts
Normal file
18
dictation_server/src/features/files/files.service.spec.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { FilesService } from './files.service';
|
||||
|
||||
describe('FilesService', () => {
|
||||
let service: FilesService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [FilesService],
|
||||
}).compile();
|
||||
|
||||
service = module.get<FilesService>(FilesService);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
});
|
||||
4
dictation_server/src/features/files/files.service.ts
Normal file
4
dictation_server/src/features/files/files.service.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class FilesService {}
|
||||
11
dictation_server/src/features/files/types/types.ts
Normal file
11
dictation_server/src/features/files/types/types.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class AudioNextRequest {
|
||||
@ApiProperty({ description: '文字起こし完了したタスクの音声ファイルID' })
|
||||
endedFileId: string;
|
||||
}
|
||||
|
||||
export class AudioNextResponse {
|
||||
@ApiProperty({ description: 'OMDS Cloud上の次の音声ファイルID' })
|
||||
nextFileId: string;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user