Merged PR 401: API-IF実装
## 概要 [Task2600: API-IF実装](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2600) アカウント設定APIのIFを実装しました。 ## レビューポイント なし ## UIの変更 なし ## 動作確認状況 ローカルのswaggerUIで確認済み ## 補足 なし
This commit is contained in:
parent
bb1dd6bce1
commit
9f7de83ae7
@ -224,6 +224,59 @@
|
||||
},
|
||||
"tags": ["accounts"],
|
||||
"security": [{ "bearer": [] }]
|
||||
},
|
||||
"post": {
|
||||
"operationId": "me",
|
||||
"summary": "",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UpdateAccountInfoRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功時のレスポンス",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UpdateAccountInfoResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "パラメータ不正/アカウント・ユーザー不在/管理者ユーザ不在",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/ErrorResponse" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "認証エラー",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/ErrorResponse" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "想定外のサーバーエラー",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/ErrorResponse" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": ["accounts"],
|
||||
"security": [{ "bearer": [] }]
|
||||
}
|
||||
},
|
||||
"/accounts/typists": {
|
||||
@ -3108,6 +3161,34 @@
|
||||
},
|
||||
"required": ["total", "partners"]
|
||||
},
|
||||
"UpdateAccountInfoRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"parentAccountId": {
|
||||
"type": "number",
|
||||
"description": "親アカウントのID"
|
||||
},
|
||||
"delegationPermission": {
|
||||
"type": "number",
|
||||
"description": "代行操作許可"
|
||||
},
|
||||
"primaryAdminUserId": {
|
||||
"type": "number",
|
||||
"description": "プライマリ管理者ID"
|
||||
},
|
||||
"secondryAdminUserId": {
|
||||
"type": "number",
|
||||
"description": "セカンダリ管理者ID"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"parentAccountId",
|
||||
"delegationPermission",
|
||||
"primaryAdminUserId",
|
||||
"secondryAdminUserId"
|
||||
]
|
||||
},
|
||||
"UpdateAccountInfoResponse": { "type": "object", "properties": {} },
|
||||
"ConfirmRequest": {
|
||||
"type": "object",
|
||||
"properties": { "token": { "type": "string" } },
|
||||
|
||||
@ -56,6 +56,8 @@ import {
|
||||
UpdateOptionItemsResponse,
|
||||
UpdateOptionItemsRequestParam,
|
||||
UpdateOptionItemsRequest,
|
||||
UpdateAccountInfoRequest,
|
||||
UpdateAccountInfoResponse,
|
||||
} from './types/types';
|
||||
import {
|
||||
USER_ROLES,
|
||||
@ -916,4 +918,60 @@ export class AccountsController {
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@Post('/me')
|
||||
@ApiResponse({
|
||||
status: HttpStatus.OK,
|
||||
type: UpdateAccountInfoResponse,
|
||||
description: '成功時のレスポンス',
|
||||
})
|
||||
@ApiResponse({
|
||||
status: HttpStatus.BAD_REQUEST,
|
||||
description: 'パラメータ不正/アカウント・ユーザー不在/管理者ユーザ不在',
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiResponse({
|
||||
status: HttpStatus.UNAUTHORIZED,
|
||||
description: '認証エラー',
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiResponse({
|
||||
status: HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
description: '想定外のサーバーエラー',
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiOperation({ operationId: 'me' })
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(AuthGuard)
|
||||
@UseGuards(
|
||||
RoleGuard.requireds({
|
||||
roles: [ADMIN_ROLES.ADMIN],
|
||||
}),
|
||||
)
|
||||
async updateAccountInfo(
|
||||
@Req() req: Request,
|
||||
@Body() body: UpdateAccountInfoRequest,
|
||||
): Promise<UpdateAccountInfoResponse> {
|
||||
const {
|
||||
parentAccountId,
|
||||
delegationPermission,
|
||||
primaryAdminUserId,
|
||||
secondryAdminUserId,
|
||||
} = body;
|
||||
const token = retrieveAuthorizationToken(req);
|
||||
const { userId } = jwt.decode(token, { json: true }) as AccessToken;
|
||||
|
||||
const context = makeContext(userId);
|
||||
// 仮。API実装で本実装
|
||||
// await this.accountService.updateAccountInfo(
|
||||
// context,
|
||||
// userId,
|
||||
// parentAccountId,
|
||||
// delegationPermission,
|
||||
// primaryAdminUserId,
|
||||
// secondryAdminUserId,
|
||||
// );
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -495,3 +495,18 @@ export type PartnerInfoFromDb = {
|
||||
primaryAccountExternalId: string;
|
||||
dealerManagement: boolean;
|
||||
};
|
||||
|
||||
export class UpdateAccountInfoRequest {
|
||||
@ApiProperty({ description: '親アカウントのID' })
|
||||
parentAccountId: number;
|
||||
@ApiProperty({ description: '代行操作許可' })
|
||||
delegationPermission: boolean;
|
||||
@ApiProperty({ description: 'プライマリ管理者ID' })
|
||||
@IsOptional()
|
||||
primaryAdminUserId?: number;
|
||||
@ApiProperty({ description: 'セカンダリ管理者ID' })
|
||||
@IsOptional()
|
||||
secondryAdminUserId?: number;
|
||||
}
|
||||
|
||||
export class UpdateAccountInfoResponse {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user