Merged PR 423: API IF実装(アカウント削除API)
## 概要 [Task2668: API IF実装](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2668) - 元PBI or タスクへのリンク(内容・目的などはそちらにあるはず) - 何をどう変更したか、追加したライブラリなど - このPull Requestでの対象/対象外 - 影響範囲(他の機能にも影響があるか) 特になし ## レビューポイント メソッド名が適切か。 ## UIの変更 なし ## 動作確認状況 - ローカルで確認 ## 補足 - 相談、参考資料などがあれば
This commit is contained in:
parent
e7bd7b52fa
commit
4a68653c69
@ -226,7 +226,7 @@
|
||||
"security": [{ "bearer": [] }]
|
||||
},
|
||||
"post": {
|
||||
"operationId": "me",
|
||||
"operationId": "updateAccountInfo",
|
||||
"summary": "",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
@ -1181,6 +1181,51 @@
|
||||
"security": [{ "bearer": [] }]
|
||||
}
|
||||
},
|
||||
"/accounts/delete": {
|
||||
"post": {
|
||||
"operationId": "deleteAccount",
|
||||
"summary": "",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/DeleteAccountRequest" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功時のレスポンス",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UpdateAccountInfoResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "認証エラー",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/ErrorResponse" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "DBアクセスに失敗しログインできる状態で処理が終了した場合",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/ErrorResponse" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": ["accounts"],
|
||||
"security": [{ "bearer": [] }]
|
||||
}
|
||||
},
|
||||
"/users/confirm": {
|
||||
"post": {
|
||||
"operationId": "confirmUser",
|
||||
@ -3399,6 +3444,13 @@
|
||||
"required": ["delegationPermission", "primaryAdminUserId"]
|
||||
},
|
||||
"UpdateAccountInfoResponse": { "type": "object", "properties": {} },
|
||||
"DeleteAccountRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"accountId": { "type": "number", "description": "アカウントID" }
|
||||
},
|
||||
"required": ["accountId"]
|
||||
},
|
||||
"ConfirmRequest": {
|
||||
"type": "object",
|
||||
"properties": { "token": { "type": "string" } },
|
||||
|
||||
@ -60,6 +60,8 @@ import {
|
||||
PostActiveWorktypeResponse,
|
||||
UpdateAccountInfoRequest,
|
||||
UpdateAccountInfoResponse,
|
||||
DeleteAccountRequest,
|
||||
DeleteAccountResponse,
|
||||
} from './types/types';
|
||||
import { USER_ROLES, ADMIN_ROLES, TIERS } from '../../constants';
|
||||
import { AuthGuard } from '../../common/guards/auth/authguards';
|
||||
@ -983,7 +985,7 @@ export class AccountsController {
|
||||
description: '想定外のサーバーエラー',
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiOperation({ operationId: 'me' })
|
||||
@ApiOperation({ operationId: 'updateAccountInfo' })
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(AuthGuard)
|
||||
@UseGuards(
|
||||
@ -1017,4 +1019,46 @@ export class AccountsController {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@Post('/delete')
|
||||
@ApiResponse({
|
||||
status: HttpStatus.OK,
|
||||
type: UpdateAccountInfoResponse,
|
||||
description: '成功時のレスポンス',
|
||||
})
|
||||
@ApiResponse({
|
||||
status: HttpStatus.UNAUTHORIZED,
|
||||
description: '認証エラー',
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiResponse({
|
||||
status: HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
description: 'DBアクセスに失敗しログインできる状態で処理が終了した場合',
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiOperation({ operationId: 'deleteAccount' })
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(AuthGuard)
|
||||
@UseGuards(
|
||||
RoleGuard.requireds({
|
||||
roles: [ADMIN_ROLES.ADMIN],
|
||||
}),
|
||||
)
|
||||
async deleteAccount(
|
||||
@Req() req: Request,
|
||||
@Body() body: DeleteAccountRequest,
|
||||
): Promise<DeleteAccountResponse> {
|
||||
const { accountId } = body;
|
||||
const token = retrieveAuthorizationToken(req);
|
||||
const { userId } = jwt.decode(token, { json: true }) as AccessToken;
|
||||
const context = makeContext(userId);
|
||||
|
||||
/* TODO 仮実装、別タスクで実装する
|
||||
await this.accountService.deleteAccount(
|
||||
context,
|
||||
accountId
|
||||
);
|
||||
*/
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -558,3 +558,10 @@ export class UpdateAccountInfoRequest {
|
||||
}
|
||||
|
||||
export class UpdateAccountInfoResponse {}
|
||||
|
||||
export class DeleteAccountRequest {
|
||||
@ApiProperty({ description: 'アカウントID' })
|
||||
accountId: number;
|
||||
}
|
||||
|
||||
export class DeleteAccountResponse {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user