From b3ab401cbc90c8b79607b086cae1dd176e52518f Mon Sep 17 00:00:00 2001 From: "makabe.t" Date: Mon, 8 May 2023 08:26:24 +0000 Subject: [PATCH] =?UTF-8?q?Merged=20PR=2090:=20=E5=85=A8=E4=BD=93=E8=A6=8B?= =?UTF-8?q?=E7=9B=B4=E3=81=97=E3=82=92=E3=81=8B=E3=81=91=E3=80=81=E3=83=AC?= =?UTF-8?q?=E3=83=93=E3=83=A5=E3=83=BC=E4=BE=9D=E9=A0=BC=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 概要 [Task1677: 全体見直しをかけ、レビュー依頼する](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/1677) - 外部連携API IFについて見直し、各APIに説明を追加しました。 - ユーザー情報取得API - 認証情報再生成API - 音声ファイルアップロード完了API(タスク追加API) - ステータス変更API - チェックアウト - チェックイン - キャンセル - 中断 - 差し戻し - バックアップ - テンプレートファイルダウンロード先取得API - 次ファイル情報取得API - 音声ファイル、タスク情報取得API - 認証情報生成API ## レビューポイント - 外部連携API IFの実装としても漏れはないか - 各APIの説明は適切か - 各APIのパス、パラメータは適切か - API間で文言の統一はできているか ## UIの変更 無し ## 動作確認状況 - ローカルで確認 --- dictation_server/src/api/odms/openapi.json | 210 ++++++++++-------- .../src/features/auth/auth.controller.ts | 11 +- .../src/features/files/files.controller.ts | 54 ++--- .../src/features/files/types/types.ts | 24 +- .../src/features/tasks/tasks.controller.ts | 80 ++++++- .../src/features/tasks/types/types.ts | 47 ++-- .../src/features/users/types/types.ts | 19 +- .../src/features/users/users.controller.ts | 13 +- 8 files changed, 273 insertions(+), 185 deletions(-) diff --git a/dictation_server/src/api/odms/openapi.json b/dictation_server/src/api/odms/openapi.json index c09bd8a..4f47b53 100644 --- a/dictation_server/src/api/odms/openapi.json +++ b/dictation_server/src/api/odms/openapi.json @@ -17,6 +17,7 @@ "post": { "operationId": "token", "summary": "", + "description": "AzureADB2Cでのサインイン後に払いだされるIDトークンを元に認証用のアクセストークンとリフレッシュトークンを生成します", "parameters": [], "requestBody": { "required": true, @@ -67,6 +68,7 @@ "post": { "operationId": "accessToken", "summary": "", + "description": "リフレッシュトークンを元にアクセストークンを再生成します", "parameters": [], "responses": { "200": { @@ -368,10 +370,11 @@ ] } }, - "/users/user-info": { + "/users/relations": { "get": { - "operationId": "getUserInfo", + "operationId": "getRelations", "summary": "", + "description": "ログインしているユーザーに関連する各種情報を取得します", "parameters": [], "responses": { "200": { @@ -379,7 +382,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GetUserInfoResponse" + "$ref": "#/components/schemas/GetRelationsResponse" } } } @@ -415,8 +418,9 @@ }, "/files/audio/upload-finished": { "post": { - "operationId": "createTask", + "operationId": "uploadFinished", "summary": "", + "description": "アップロードが完了した音声ファイルの情報を登録し、文字起こしタスクを生成します", "parameters": [], "requestBody": { "required": true, @@ -467,6 +471,7 @@ "get": { "operationId": "uploadLocation", "summary": "", + "description": "ログイン中ユーザー用のBlob Storage上の音声ファイルのアップロード先アクセスURLを取得します", "parameters": [], "responses": { "200": { @@ -512,12 +517,13 @@ "get": { "operationId": "downloadLocation", "summary": "", + "description": "指定した音声ファイルのBlob Storage上のダウンロード先アクセスURLを取得します", "parameters": [ { "name": "audioFileId", "required": true, "in": "query", - "description": "音声ファイル情報をDBから取得するためのID", + "description": "ODMSCloud上で管理する音声ファイルのID", "schema": { "type": "number" } @@ -567,6 +573,7 @@ "get": { "operationId": "downloadTemplateLocation", "summary": "", + "description": "指定した音声ファイルに対応したテンプレートファイルのBlob Storage上のダウンロード先アクセスURLを取得します", "parameters": [ { "name": "audioFileId", @@ -618,83 +625,29 @@ ] } }, - "/files/audio/next": { - "get": { - "operationId": "getNextAudioFile", - "summary": "", - "parameters": [ - { - "name": "endedFileId", - "required": true, - "in": "query", - "description": "文字起こし完了したタスクの音声ファイルID", - "schema": { - "type": "number" - } - } - ], - "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": [] - } - ] - } - }, "/tasks": { "get": { "operationId": "getTasks", "summary": "", + "description": "音声ファイル・文字起こしタスク情報をページ指定して取得します。", "parameters": [ { - "name": "pageNumber", - "required": true, + "name": "limit", + "required": false, "in": "query", - "description": "ページ番号(ページサイズごとに区切った何ページ目を取得するか)", + "description": "タスクの取得件数(指定しない場合はデフォルト値)", "schema": { - "minimum": 1, + "default": 200, "type": "number" } }, { - "name": "pageSize", - "required": true, + "name": "offset", + "required": false, "in": "query", - "description": "ページサイズ(一度に何件のタスクを取得するか)", + "description": "オフセット(何件目から取得するか 設定しない場合はデフォルト値)", "schema": { - "minimum": 1, + "default": 0, "type": "number" } } @@ -739,10 +692,67 @@ ] } }, + "/tasks/next": { + "get": { + "operationId": "getNextAudioFile", + "summary": "", + "description": "指定した文字起こしタスクの次のタスクに紐づく音声ファイルIDを取得します", + "parameters": [ + { + "name": "endedFileId", + "required": true, + "in": "query", + "description": "文字起こし完了したタスクの音声ファイルID", + "schema": { + "type": "number" + } + } + ], + "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": ["tasks"], + "security": [ + { + "bearer": [] + } + ] + } + }, "/tasks/{audioFileId}/checkout": { "post": { "operationId": "checkout", "summary": "", + "description": "指定した文字起こしタスクをチェックアウトします(ステータスをInprogressにします)", "parameters": [ { "name": "audioFileId", @@ -808,6 +818,7 @@ "post": { "operationId": "checkin", "summary": "", + "description": "指定した文字起こしタスクをチェックインします(ステータスをFinishedにします)", "parameters": [ { "name": "audioFileId", @@ -873,6 +884,7 @@ "post": { "operationId": "cancel", "summary": "", + "description": "指定した文字起こしタスクをキャンセルします(ステータスをUploadedにします)", "parameters": [ { "name": "audioFileId", @@ -938,6 +950,7 @@ "post": { "operationId": "suspend", "summary": "", + "description": "指定した文字起こしタスクを一時中断します(ステータスをPendingにします)", "parameters": [ { "name": "audioFileId", @@ -1003,6 +1016,7 @@ "post": { "operationId": "sendBack", "summary": "", + "description": "指定した文字起こしタスクを差し戻します(ステータスをPendingにします)", "parameters": [ { "name": "audioFileId", @@ -1068,6 +1082,7 @@ "post": { "operationId": "backup", "summary": "", + "description": "指定した文字起こしタスクをバックアップします(ステータスをBackupにします)", "parameters": [ { "name": "audioFileId", @@ -1460,12 +1475,12 @@ }, "required": ["workTypeId", "optionItemList"] }, - "GetUserInfoResponse": { + "GetRelationsResponse": { "type": "object", "properties": { "authorId": { "type": "string", - "description": "自分自身(ログイン認証)したAuthorID" + "description": "ログインしたユーザーのAuthorID(Authorでない場合は空文字)" }, "authorIdList": { "description": "属しているアカウントのAuthorID List(全て)", @@ -1476,7 +1491,7 @@ }, "workTypeList": { "maxItems": 20, - "description": "Authorに設定されているWorktypeIDのリスト(最大20個)", + "description": "アカウントに設定されているWorktypeIDのリスト(最大20個)", "type": "array", "items": { "$ref": "#/components/schemas/OptionItemList" @@ -1484,16 +1499,16 @@ }, "isEncrypted": { "type": "boolean", - "description": "音声ファイルを暗号化するかどうか" + "description": "ユーザーが音声ファイルを暗号化するかどうか" }, "encryptionPassword": { "type": "string", - "description": "Encryptionで暗号化を掛ける場合のパスワード", + "description": "ユーザーが暗号化を掛ける場合のパスワード", "nullable": true }, "activeWorktype": { "type": "string", - "description": "デフォルトで利用するWorkTypeID(アカウントに紐づくWorkTypeIDから一つ指定)" + "description": "アカウントがデフォルトで利用するWorkTypeID(アカウントに紐づくWorkTypeIDから一つ指定)" }, "audioFormat": { "type": "string", @@ -1501,7 +1516,7 @@ }, "prompt": { "type": "boolean", - "description": "デバイス上で、Option Itemを表示するかどうか" + "description": "デバイス上で自動的にWorkTypeの選択画面を表示するかどうかのユーザーごとの設定(Authorでない場合はfalse)" } }, "required": [ @@ -1538,7 +1553,7 @@ "type": "string", "description": "音声ファイルの録音作成日時(開始日時)(yyyy-mm-ddThh:mm:ss.sss)" }, - "completedDate": { + "finishedDate": { "type": "string", "description": "音声ファイルの録音作成終了日時(yyyy-mm-ddThh:mm:ss.sss)" }, @@ -1583,7 +1598,7 @@ "fileName", "duration", "createdDate", - "completedDate", + "finishedDate", "uploadedDate", "fileSize", "priority", @@ -1609,7 +1624,8 @@ "type": "object", "properties": { "url": { - "type": "string" + "type": "string", + "description": "Blob StorageにアクセスするためのSASトークン入りのアクセスURL" } }, "required": ["url"] @@ -1618,7 +1634,8 @@ "type": "object", "properties": { "url": { - "type": "string" + "type": "string", + "description": "Blob StorageにアクセスするためのSASトークン入りのアクセスURL" } }, "required": ["url"] @@ -1632,16 +1649,6 @@ }, "required": ["url"] }, - "AudioNextResponse": { - "type": "object", - "properties": { - "nextFileId": { - "type": "number", - "description": "ODMS Cloud上の次の音声ファイルID(存在しなければ空文字)" - } - }, - "required": ["nextFileId"] - }, "Typist": { "type": "object", "properties": { @@ -1686,7 +1693,7 @@ }, "url": { "type": "string", - "description": "アップロード先Blob Storage(ファイル名含む)" + "description": "音声ファイルのBlob Storage上での保存場所(ファイル名含む)のURL" }, "fileName": { "type": "string", @@ -1747,8 +1754,8 @@ } }, "status": { - "type": "number", - "description": "音声ファイルのファイルステータス 1:Uploaded(Cancel) / 2:Pending / 3:InProgress / 4:Finished / 5:Backup" + "type": "string", + "description": "音声ファイルのファイルステータス Uploaded / Pending / InProgress / Finished / Backup" }, "transcriptionStartedDate": { "type": "string", @@ -1786,13 +1793,13 @@ "TasksResponse": { "type": "object", "properties": { - "pageNumber": { + "limit": { "type": "number", - "description": "ページ番号(ページサイズごとに区切った何ページ目か。 ページ番号が存在しない場合は末尾のページ)" + "description": "タスクの取得件数(指定しない場合はデフォルト値)" }, - "pageSize": { + "offset": { "type": "number", - "description": "ページサイズ(一度に何件のタスクを取得するか)" + "description": "オフセット(何件目から取得するか 設定しない場合はデフォルト値)" }, "total": { "type": "number", @@ -1806,7 +1813,16 @@ } } }, - "required": ["pageNumber", "pageSize", "total", "tasks"] + "required": ["limit", "offset", "total", "tasks"] + }, + "AudioNextResponse": { + "type": "object", + "properties": { + "nextFileId": { + "type": "number", + "description": "ODMS Cloud上の次の音声ファイルID(存在しなければundefind)" + } + } }, "ChangeStatusResponse": { "type": "object", diff --git a/dictation_server/src/features/auth/auth.controller.ts b/dictation_server/src/features/auth/auth.controller.ts index 245f5de..c6b2fb1 100644 --- a/dictation_server/src/features/auth/auth.controller.ts +++ b/dictation_server/src/features/auth/auth.controller.ts @@ -42,7 +42,11 @@ export class AuthController { description: '想定外のサーバーエラー', type: ErrorResponse, }) - @ApiOperation({ operationId: 'token' }) + @ApiOperation({ + description: + 'AzureADB2Cでのサインイン後に払いだされるIDトークンを元に認証用のアクセストークンとリフレッシュトークンを生成します', + operationId: 'token', + }) async token(@Body() body: TokenRequest): Promise { console.log(body); const idToken = await this.authService.getVerifiedIdToken(body.idToken); @@ -86,7 +90,10 @@ export class AuthController { description: '想定外のサーバーエラー', type: ErrorResponse, }) - @ApiOperation({ operationId: 'accessToken' }) + @ApiOperation({ + operationId: 'accessToken', + description: 'リフレッシュトークンを元にアクセストークンを再生成します', + }) async accessToken(@Headers() headers): Promise { console.log(headers['authorization']); const header = headers['authorization']; diff --git a/dictation_server/src/features/files/files.controller.ts b/dictation_server/src/features/files/files.controller.ts index f1add0b..59e64bc 100644 --- a/dictation_server/src/features/files/files.controller.ts +++ b/dictation_server/src/features/files/files.controller.ts @@ -18,8 +18,6 @@ import { FilesService } from './files.service'; import { AudioDownloadLocationRequest, AudioDownloadLocationResponse, - AudioNextRequest, - AudioNextResponse, AudioUploadFinishedRequest, AudioUploadFinishedResponse, AudioUploadLocationRequest, @@ -48,7 +46,11 @@ export class FilesController { description: '想定外のサーバーエラー', type: ErrorResponse, }) - @ApiOperation({ operationId: 'createTask' }) + @ApiOperation({ + operationId: 'uploadFinished', + description: + 'アップロードが完了した音声ファイルの情報を登録し、文字起こしタスクを生成します', + }) @Post('audio/upload-finished') async uploadFinished( @Body() body: AudioUploadFinishedRequest, @@ -73,7 +75,11 @@ export class FilesController { description: '想定外のサーバーエラー', type: ErrorResponse, }) - @ApiOperation({ operationId: 'uploadLocation' }) + @ApiOperation({ + operationId: 'uploadLocation', + description: + 'ログイン中ユーザー用のBlob Storage上の音声ファイルのアップロード先アクセスURLを取得します', + }) @ApiBearerAuth() async uploadLocation( @Headers() headers, @@ -102,7 +108,11 @@ export class FilesController { description: '想定外のサーバーエラー', type: ErrorResponse, }) - @ApiOperation({ operationId: 'downloadLocation' }) + @ApiOperation({ + operationId: 'downloadLocation', + description: + '指定した音声ファイルのBlob Storage上のダウンロード先アクセスURLを取得します', + }) @ApiBearerAuth() async downloadLocation( @Headers() headers, @@ -132,7 +142,11 @@ export class FilesController { description: '想定外のサーバーエラー', type: ErrorResponse, }) - @ApiOperation({ operationId: 'downloadTemplateLocation' }) + @ApiOperation({ + operationId: 'downloadTemplateLocation', + description: + '指定した音声ファイルに対応したテンプレートファイルのBlob Storage上のダウンロード先アクセスURLを取得します', + }) @ApiBearerAuth() async downloadTemplateLocation( @Headers() headers, @@ -144,32 +158,4 @@ export class FilesController { return { url: '' }; } - - @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 { - const { endedFileId } = body; - console.log(endedFileId); - - return { nextFileId: 1234 }; - } } diff --git a/dictation_server/src/features/files/types/types.ts b/dictation_server/src/features/files/types/types.ts index 1f6b38d..872cb65 100644 --- a/dictation_server/src/features/files/types/types.ts +++ b/dictation_server/src/features/files/types/types.ts @@ -1,31 +1,23 @@ import { ApiProperty } from '@nestjs/swagger'; -export class AudioNextRequest { - @ApiProperty({ description: '文字起こし完了したタスクの音声ファイルID' }) - endedFileId: number; -} - -export class AudioNextResponse { - @ApiProperty({ - description: 'ODMS Cloud上の次の音声ファイルID(存在しなければ空文字)', - }) - nextFileId: number; -} - export class AudioUploadLocationRequest {} export class AudioUploadLocationResponse { - @ApiProperty() + @ApiProperty({ + description: 'Blob StorageにアクセスするためのSASトークン入りのアクセスURL', + }) url: string; } export class AudioDownloadLocationRequest { - @ApiProperty({ description: '音声ファイル情報をDBから取得するためのID' }) + @ApiProperty({ description: 'ODMSCloud上で管理する音声ファイルのID' }) audioFileId: number; } export class AudioDownloadLocationResponse { - @ApiProperty() + @ApiProperty({ + description: 'Blob StorageにアクセスするためのSASトークン入りのアクセスURL', + }) url: string; } @@ -58,7 +50,7 @@ export class AudioUploadFinishedRequest { @ApiProperty({ description: '音声ファイルの録音作成終了日時(yyyy-mm-ddThh:mm:ss.sss)', }) - completedDate: string; + finishedDate: string; @ApiProperty({ description: '音声ファイルのアップロード日時(yyyy-mm-ddThh:mm:ss.sss)', }) diff --git a/dictation_server/src/features/tasks/tasks.controller.ts b/dictation_server/src/features/tasks/tasks.controller.ts index b5e99bc..87ea84b 100644 --- a/dictation_server/src/features/tasks/tasks.controller.ts +++ b/dictation_server/src/features/tasks/tasks.controller.ts @@ -16,6 +16,8 @@ import { import { ErrorResponse } from '../../common/error/types/types'; import { TasksService } from './tasks.service'; import { + AudioNextRequest, + AudioNextResponse, ChangeStatusRequest, ChangeStatusResponse, TasksRequest, @@ -42,7 +44,11 @@ export class TasksController { description: '想定外のサーバーエラー', type: ErrorResponse, }) - @ApiOperation({ operationId: 'getTasks' }) + @ApiOperation({ + operationId: 'getTasks', + description: + '音声ファイル・文字起こしタスク情報をページ指定して取得します。', + }) @ApiBearerAuth() @Get() async getTasks( @@ -52,13 +58,45 @@ export class TasksController { console.log(headers); console.log(body); return { - pageNumber: 1, - pageSize: 1, + limit: 200, + offset: 0, total: 0, tasks: [], }; } + @Get('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', + description: + '指定した文字起こしタスクの次のタスクに紐づく音声ファイルIDを取得します', + }) + @ApiBearerAuth() + async getNextAudioFile( + @Headers() headers, + @Query() body: AudioNextRequest, + ): Promise { + const { endedFileId } = body; + console.log(endedFileId); + + return { nextFileId: 1234 }; + } + @Post(':audioFileId/checkout') @ApiResponse({ status: HttpStatus.OK, @@ -80,7 +118,11 @@ export class TasksController { description: '想定外のサーバーエラー', type: ErrorResponse, }) - @ApiOperation({ operationId: 'checkout' }) + @ApiOperation({ + operationId: 'checkout', + description: + '指定した文字起こしタスクをチェックアウトします(ステータスをInprogressにします)', + }) @ApiBearerAuth() async checkout( @Headers() headers, @@ -113,7 +155,11 @@ export class TasksController { description: '想定外のサーバーエラー', type: ErrorResponse, }) - @ApiOperation({ operationId: 'checkin' }) + @ApiOperation({ + operationId: 'checkin', + description: + '指定した文字起こしタスクをチェックインします(ステータスをFinishedにします)', + }) @ApiBearerAuth() async checkin( @Headers() headers, @@ -146,7 +192,11 @@ export class TasksController { description: '想定外のサーバーエラー', type: ErrorResponse, }) - @ApiOperation({ operationId: 'cancel' }) + @ApiOperation({ + operationId: 'cancel', + description: + '指定した文字起こしタスクをキャンセルします(ステータスをUploadedにします)', + }) @ApiBearerAuth() async cancel( @Headers() headers, @@ -179,7 +229,11 @@ export class TasksController { description: '想定外のサーバーエラー', type: ErrorResponse, }) - @ApiOperation({ operationId: 'suspend' }) + @ApiOperation({ + operationId: 'suspend', + description: + '指定した文字起こしタスクを一時中断します(ステータスをPendingにします)', + }) @ApiBearerAuth() async suspend( @Headers() headers, @@ -212,7 +266,11 @@ export class TasksController { description: '想定外のサーバーエラー', type: ErrorResponse, }) - @ApiOperation({ operationId: 'sendBack' }) + @ApiOperation({ + operationId: 'sendBack', + description: + '指定した文字起こしタスクを差し戻します(ステータスをPendingにします)', + }) @ApiBearerAuth() async sendBack( @Headers() headers, @@ -245,7 +303,11 @@ export class TasksController { description: '想定外のサーバーエラー', type: ErrorResponse, }) - @ApiOperation({ operationId: 'backup' }) + @ApiOperation({ + operationId: 'backup', + description: + '指定した文字起こしタスクをバックアップします(ステータスをBackupにします)', + }) @ApiBearerAuth() async backup( @Headers() headers, diff --git a/dictation_server/src/features/tasks/types/types.ts b/dictation_server/src/features/tasks/types/types.ts index 45a07ac..4516647 100644 --- a/dictation_server/src/features/tasks/types/types.ts +++ b/dictation_server/src/features/tasks/types/types.ts @@ -2,16 +2,18 @@ import { ApiProperty } from '@nestjs/swagger'; export class TasksRequest { @ApiProperty({ - minimum: 1, - description: - 'ページ番号(ページサイズごとに区切った何ページ目を取得するか)', + required: false, + default: 200, + description: 'タスクの取得件数(指定しない場合はデフォルト値)', }) - pageNumber: number; + limit: number; @ApiProperty({ - minimum: 1, - description: 'ページサイズ(一度に何件のタスクを取得するか)', + required: false, + default: 0, + description: + 'オフセット(何件目から取得するか 設定しない場合はデフォルト値)', }) - pageSize: number; + offset: number; } export class Typist { @@ -40,7 +42,10 @@ export class Task { optionItemLabel: string; @ApiProperty({ minLength: 1, maxLength: 20 }) optionItemValue: string; - @ApiProperty({ description: 'アップロード先Blob Storage(ファイル名含む)' }) + @ApiProperty({ + description: + '音声ファイルのBlob Storage上での保存場所(ファイル名含む)のURL', + }) url: string; @ApiProperty({ description: '音声ファイル名' }) fileName: string; @@ -85,9 +90,9 @@ export class Task { assignees: Typist[]; @ApiProperty({ description: - '音声ファイルのファイルステータス 1:Uploaded(Cancel) / 2:Pending / 3:InProgress / 4:Finished / 5:Backup', + '音声ファイルのファイルステータス Uploaded / Pending / InProgress / Finished / Backup', }) - status: number; + status: string; @ApiProperty({ description: '文字起こし開始日時(yyyy-mm-ddThh:mm:ss.sss)' }) transcriptionStartedDate: string; @ApiProperty({ description: '文字起こし終了日時(yyyy-mm-ddThh:mm:ss.sss)' }) @@ -96,14 +101,14 @@ export class Task { export class TasksResponse { @ApiProperty({ - description: - 'ページ番号(ページサイズごとに区切った何ページ目か。 ページ番号が存在しない場合は末尾のページ)', + description: 'タスクの取得件数(指定しない場合はデフォルト値)', }) - pageNumber: number; + limit: number; @ApiProperty({ - description: 'ページサイズ(一度に何件のタスクを取得するか)', + description: + 'オフセット(何件目から取得するか 設定しない場合はデフォルト値)', }) - pageSize: number; + offset: number; @ApiProperty({ description: 'タスクの総件数', }) @@ -115,6 +120,18 @@ export class TasksResponse { }) tasks: Task[]; } +export class AudioNextRequest { + @ApiProperty({ description: '文字起こし完了したタスクの音声ファイルID' }) + endedFileId: number; +} + +export class AudioNextResponse { + @ApiProperty({ + required: false, + description: 'ODMS Cloud上の次の音声ファイルID(存在しなければundefind)', + }) + nextFileId?: number | undefined; +} export class ChangeStatusRequest { @ApiProperty({ description: 'ODMS Cloud上の音声ファイルID' }) diff --git a/dictation_server/src/features/users/types/types.ts b/dictation_server/src/features/users/types/types.ts index dd55487..6d6116f 100644 --- a/dictation_server/src/features/users/types/types.ts +++ b/dictation_server/src/features/users/types/types.ts @@ -96,31 +96,36 @@ export class OptionItemList { optionItemList: OptionItem[]; } -export class GetUserInfoResponse { - @ApiProperty({ description: '自分自身(ログイン認証)したAuthorID' }) +export class GetRelationsResponse { + @ApiProperty({ + description: 'ログインしたユーザーのAuthorID(Authorでない場合は空文字)', + }) authorId: string; @ApiProperty({ description: '属しているアカウントのAuthorID List(全て)' }) authorIdList: string[]; @ApiProperty({ type: [OptionItemList], maxItems: 20, - description: 'Authorに設定されているWorktypeIDのリスト(最大20個)', + description: 'アカウントに設定されているWorktypeIDのリスト(最大20個)', }) workTypeList: OptionItemList[]; - @ApiProperty({ description: '音声ファイルを暗号化するかどうか' }) + @ApiProperty({ description: 'ユーザーが音声ファイルを暗号化するかどうか' }) isEncrypted: boolean; @ApiProperty({ - description: 'Encryptionで暗号化を掛ける場合のパスワード', + description: 'ユーザーが暗号化を掛ける場合のパスワード', nullable: true, }) encryptionPassword?: string | undefined; @ApiProperty({ description: - 'デフォルトで利用するWorkTypeID(アカウントに紐づくWorkTypeIDから一つ指定)', + 'アカウントがデフォルトで利用するWorkTypeID(アカウントに紐づくWorkTypeIDから一つ指定)', }) activeWorktype: string; @ApiProperty({ description: '録音形式: DSS/DS2(SP)/DS2(QP): DS2固定' }) audioFormat: string; - @ApiProperty({ description: 'デバイス上で、Option Itemを表示するかどうか' }) + @ApiProperty({ + description: + 'デバイス上で自動的にWorkTypeの選択画面を表示するかどうかのユーザーごとの設定(Authorでない場合はfalse)', + }) prompt: boolean; } diff --git a/dictation_server/src/features/users/users.controller.ts b/dictation_server/src/features/users/users.controller.ts index 8b78df8..c5cab28 100644 --- a/dictation_server/src/features/users/users.controller.ts +++ b/dictation_server/src/features/users/users.controller.ts @@ -9,7 +9,7 @@ import { ErrorResponse } from '../../common/error/types/types'; import { ConfirmRequest, ConfirmResponse, - GetUserInfoResponse, + GetRelationsResponse, GetUsersResponse, SignupRequest, SignupResponse, @@ -125,7 +125,7 @@ export class UsersController { @ApiResponse({ status: HttpStatus.OK, - type: GetUserInfoResponse, + type: GetRelationsResponse, description: '成功時のレスポンス', }) @ApiResponse({ @@ -138,10 +138,13 @@ export class UsersController { description: '想定外のサーバーエラー', type: ErrorResponse, }) - @ApiOperation({ operationId: 'getUserInfo' }) + @ApiOperation({ + operationId: 'getRelations', + description: 'ログインしているユーザーに関連する各種情報を取得します', + }) @ApiBearerAuth() - @Get('user-info') - async getUserInfo(@Req() req: Request): Promise { + @Get('relations') + async getRelations(@Req() req: Request): Promise { console.log(req.header('Authorization')); return { authorId: 'AUTHOR',