From 6f92313e9a0d260bdb29bebbe5523915dc2636ca Mon Sep 17 00:00:00 2001 From: "makabe.t" Date: Wed, 12 Jul 2023 00:06:14 +0000 Subject: [PATCH] =?UTF-8?q?Merged=20PR=20232:=20Typist=E3=81=AE=E9=9F=B3?= =?UTF-8?q?=E5=A3=B0=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E5=8F=96=E5=BE=97?= =?UTF-8?q?=E3=81=A7=E5=A4=B1=E6=95=97=E3=81=99=E3=82=8B=E4=BB=B6=E3=81=AE?= =?UTF-8?q?=E8=AA=BF=E6=9F=BB=E3=83=BB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 概要 [Task2172: Typistの音声ファイル取得で失敗する件の調査・修正](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2172) - 音声ファイルダウンロードURLの取得時にTypistの場合、音声ファイルが見つからない問題を修正しました。 - ファイルパスを構築する際に実行ユーザーIDを材料にしていたのでTypistの場合が存在しないパスとなっていました。 - ファイル所有者IDから構成するように修正しました。 ## レビューポイント - ファイルパスの作り方に問題はないか ## UIの変更 なし ## 動作確認状況 - ローカルで確認 --- .../src/features/files/files.service.spec.ts | 19 +++++++++++++++++-- .../src/features/files/files.service.ts | 3 ++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/dictation_server/src/features/files/files.service.spec.ts b/dictation_server/src/features/files/files.service.spec.ts index 7b677bf..ddd9973 100644 --- a/dictation_server/src/features/files/files.service.spec.ts +++ b/dictation_server/src/features/files/files.service.spec.ts @@ -340,7 +340,15 @@ describe('音声ファイルダウンロードURL取得', () => { 'typist-user-external-id', 'typist', ); - const url = `https://saodmsusdev.blob.core.windows.net/account-${accountId}/${userId}`; + const { userId: authorUserId } = await createUser( + source, + accountId, + 'author-user-external-id', + 'author', + 'AUTHOR_ID', + ); + + const url = `https://saodmsusdev.blob.core.windows.net/account-${accountId}/${authorUserId}`; const { audioFileId } = await createTask( source, @@ -379,7 +387,14 @@ describe('音声ファイルダウンロードURL取得', () => { 'other-typist-user-external-id', 'typist', ); - const url = `https://saodmsusdev.blob.core.windows.net/account-${accountId}/${userId}`; + const { userId: authorUserId } = await createUser( + source, + accountId, + 'author-user-external-id', + 'author', + 'AUTHOR_ID', + ); + const url = `https://saodmsusdev.blob.core.windows.net/account-${accountId}/${authorUserId}`; const { audioFileId } = await createTask( source, diff --git a/dictation_server/src/features/files/files.service.ts b/dictation_server/src/features/files/files.service.ts index 94b196e..5d2a04e 100644 --- a/dictation_server/src/features/files/files.service.ts +++ b/dictation_server/src/features/files/files.service.ts @@ -291,7 +291,7 @@ export class FilesService { ); } - const filePath = `${userId}/${file.file_name}`; + const filePath = `${file.owner_user_id}/${file.file_name}`; const isFileExist = await this.blobStorageService.fileExists( accountId, @@ -300,6 +300,7 @@ export class FilesService { ); if (!isFileExist) { + this.logger.log(`filePath:${filePath}`); throw new AudioFileNotFoundError( `Audio file is not exists in blob storage. audio_file_id:${audioFileId}, url:${file.url}, fileName:${file.file_name}`, );