Merged PR 720: API IF実装
## 概要 [Task3534: API IF実装](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3534) - タイピストグループ削除APIのIFを実装し、OpenAPIを更新しました。 ## レビューポイント - パラメータとバリデータは想定通りでしょうか? ## UIの変更 - なし ## 動作確認状況 - ローカルで確認
This commit is contained in:
parent
92193d499a
commit
9f7c8c99c0
@ -651,6 +651,59 @@
|
|||||||
"security": [{ "bearer": [] }]
|
"security": [{ "bearer": [] }]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/accounts/typist-groups/{typistGroupId}/delete": {
|
||||||
|
"post": {
|
||||||
|
"operationId": "deleteTypistGroup",
|
||||||
|
"summary": "",
|
||||||
|
"description": "ログインしているユーザーのアカウント配下でIDで指定されたタイピストグループを削除します",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "typistGroupId",
|
||||||
|
"required": true,
|
||||||
|
"in": "path",
|
||||||
|
"schema": { "type": "number" }
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "成功時のレスポンス",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/DeleteTypistGroupResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"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/partner": {
|
"/accounts/partner": {
|
||||||
"post": {
|
"post": {
|
||||||
"operationId": "createPartnerAccount",
|
"operationId": "createPartnerAccount",
|
||||||
@ -3823,6 +3876,7 @@
|
|||||||
},
|
},
|
||||||
"required": ["typistGroupName", "typistIds"]
|
"required": ["typistGroupName", "typistIds"]
|
||||||
},
|
},
|
||||||
|
"DeleteTypistGroupResponse": { "type": "object", "properties": {} },
|
||||||
"CreatePartnerAccountRequest": {
|
"CreatePartnerAccountRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
@ -71,6 +71,8 @@ import {
|
|||||||
DeleteWorktypeResponse,
|
DeleteWorktypeResponse,
|
||||||
GetCompanyNameRequest,
|
GetCompanyNameRequest,
|
||||||
GetCompanyNameResponse,
|
GetCompanyNameResponse,
|
||||||
|
DeleteTypistGroupRequestParam,
|
||||||
|
DeleteTypistGroupResponse,
|
||||||
} from './types/types';
|
} from './types/types';
|
||||||
import { USER_ROLES, ADMIN_ROLES, TIERS } from '../../constants';
|
import { USER_ROLES, ADMIN_ROLES, TIERS } from '../../constants';
|
||||||
import { AuthGuard } from '../../common/guards/auth/authguards';
|
import { AuthGuard } from '../../common/guards/auth/authguards';
|
||||||
@ -755,6 +757,86 @@ export class AccountsController {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiResponse({
|
||||||
|
status: HttpStatus.OK,
|
||||||
|
type: DeleteTypistGroupResponse,
|
||||||
|
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: 'deleteTypistGroup',
|
||||||
|
description:
|
||||||
|
'ログインしているユーザーのアカウント配下でIDで指定されたタイピストグループを削除します',
|
||||||
|
})
|
||||||
|
@ApiBearerAuth()
|
||||||
|
@UseGuards(AuthGuard)
|
||||||
|
@UseGuards(
|
||||||
|
RoleGuard.requireds({ roles: [ADMIN_ROLES.ADMIN], delegation: true }),
|
||||||
|
)
|
||||||
|
@Post('typist-groups/:typistGroupId/delete')
|
||||||
|
async deleteTypistGroup(
|
||||||
|
@Req() req: Request,
|
||||||
|
@Param() param: DeleteTypistGroupRequestParam,
|
||||||
|
): Promise<DeleteTypistGroupResponse> {
|
||||||
|
const { typistGroupId } = param;
|
||||||
|
|
||||||
|
// アクセストークン取得
|
||||||
|
|
||||||
|
const accessToken = retrieveAuthorizationToken(req);
|
||||||
|
if (!accessToken) {
|
||||||
|
throw new HttpException(
|
||||||
|
makeErrorResponse('E000107'),
|
||||||
|
HttpStatus.UNAUTHORIZED,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ip = retrieveIp(req);
|
||||||
|
if (!ip) {
|
||||||
|
throw new HttpException(
|
||||||
|
makeErrorResponse('E000401'),
|
||||||
|
HttpStatus.UNAUTHORIZED,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const requestId = retrieveRequestId(req);
|
||||||
|
if (!requestId) {
|
||||||
|
throw new HttpException(
|
||||||
|
makeErrorResponse('E000501'),
|
||||||
|
HttpStatus.INTERNAL_SERVER_ERROR,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const decodedAccessToken = jwt.decode(accessToken, { json: true });
|
||||||
|
if (!decodedAccessToken) {
|
||||||
|
throw new HttpException(
|
||||||
|
makeErrorResponse('E000101'),
|
||||||
|
HttpStatus.UNAUTHORIZED,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const { userId } = decodedAccessToken as AccessToken;
|
||||||
|
|
||||||
|
const context = makeContext(userId, requestId);
|
||||||
|
this.logger.log(`[${context.getTrackingId()}] ip : ${ip}`);
|
||||||
|
|
||||||
|
// TODO: 削除処理
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
@Post('partner')
|
@Post('partner')
|
||||||
@ApiResponse({
|
@ApiResponse({
|
||||||
status: HttpStatus.OK,
|
status: HttpStatus.OK,
|
||||||
|
|||||||
@ -120,6 +120,14 @@ export class UpdateTypistGroupRequestParam {
|
|||||||
@Min(1)
|
@Min(1)
|
||||||
typistGroupId: number;
|
typistGroupId: number;
|
||||||
}
|
}
|
||||||
|
export class DeleteTypistGroupRequestParam {
|
||||||
|
@ApiProperty()
|
||||||
|
@Type(() => Number)
|
||||||
|
@IsInt()
|
||||||
|
@Min(1)
|
||||||
|
typistGroupId: number;
|
||||||
|
}
|
||||||
|
|
||||||
export class CreatePartnerAccountRequest {
|
export class CreatePartnerAccountRequest {
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
@MaxLength(255)
|
@MaxLength(255)
|
||||||
@ -481,6 +489,8 @@ export class CreateTypistGroupResponse {}
|
|||||||
|
|
||||||
export class UpdateTypistGroupResponse {}
|
export class UpdateTypistGroupResponse {}
|
||||||
|
|
||||||
|
export class DeleteTypistGroupResponse {}
|
||||||
|
|
||||||
export class CreatePartnerAccountResponse {}
|
export class CreatePartnerAccountResponse {}
|
||||||
|
|
||||||
export class PartnerLicenseInfo {
|
export class PartnerLicenseInfo {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user