Merged PR 177: 外部連携APIの認証ヘッダの形式を修正
## 概要 [Task2054: 外部連携APIの認証ヘッダの形式を修正](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2054) - 外部連携APIの認証ヘッダの設定がパラメータに出ているAPIがあったので元のbearerで設定するように修正しました。 - /files/audio/upload-finished - /files/audio/upload-location ## レビューポイント - 修正箇所は適切か - 修正内容は適切か - OpenAPIとしての内容は認識通りになっているか ## UIの変更 なし ## 動作確認状況 - ローカルで確認 - Swagger - DevTool
This commit is contained in:
parent
33fc741eee
commit
4fb982bf8c
File diff suppressed because it is too large
Load Diff
@ -6,6 +6,7 @@ import {
|
||||
HttpStatus,
|
||||
Post,
|
||||
Query,
|
||||
Req,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import {
|
||||
@ -31,6 +32,8 @@ import {
|
||||
import { AuthGuard } from '../../common/guards/auth/authguards';
|
||||
import { RoleGuard } from '../../common/guards/role/roleguards';
|
||||
import { USER_ROLES } from '../../constants';
|
||||
import { retrieveAuthorizationToken } from '../../common/http/helper';
|
||||
import { Request } from 'express';
|
||||
|
||||
@ApiTags('files')
|
||||
@Controller('files')
|
||||
@ -67,13 +70,11 @@ export class FilesController {
|
||||
@UseGuards(RoleGuard.requireds({ roles: [USER_ROLES.AUTHOR] }))
|
||||
@Post('audio/upload-finished')
|
||||
async uploadFinished(
|
||||
@Headers('authorization') authorization: string,
|
||||
@Req() req: Request,
|
||||
@Body() body: AudioUploadFinishedRequest,
|
||||
): Promise<AudioUploadFinishedResponse> {
|
||||
const accessToken = jwt.decode(
|
||||
authorization.substring('Bearer '.length, authorization.length),
|
||||
{ json: true },
|
||||
) as AccessToken;
|
||||
const token = retrieveAuthorizationToken(req);
|
||||
const accessToken = jwt.decode(token, { json: true }) as AccessToken;
|
||||
|
||||
const {
|
||||
url,
|
||||
@ -138,16 +139,13 @@ export class FilesController {
|
||||
@UseGuards(AuthGuard)
|
||||
@UseGuards(RoleGuard.requireds({ roles: [USER_ROLES.AUTHOR] }))
|
||||
async uploadLocation(
|
||||
@Headers('authorization') authorization: string,
|
||||
@Req() req: Request,
|
||||
// クエリパラメータ AudioUploadLocationRequest は空であるため内部で使用しない。
|
||||
// 使用しないことを宣言するために先頭にプレフィックス_(アンダースコア)をつけている
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
@Query() _query: AudioUploadLocationRequest,
|
||||
): Promise<AudioUploadLocationResponse> {
|
||||
const token = authorization.substring(
|
||||
'Bearer '.length,
|
||||
authorization.length,
|
||||
);
|
||||
const token = retrieveAuthorizationToken(req);
|
||||
const accessToken = jwt.decode(token, { json: true }) as AccessToken;
|
||||
const url = await this.filesService.publishUploadSas(accessToken);
|
||||
return { url };
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user