Merged PR 340: API-IF実装
## 概要 [Task2445: API-IF実装](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2445) ライセンス割り当て解除API-IFを作成しました。 ## レビューポイント なし ## UIの変更 なし ## 動作確認状況 Swagger UIにより確認済み
This commit is contained in:
parent
bdd10aabf6
commit
417ba17d13
@ -938,6 +938,62 @@
|
||||
"security": [{ "bearer": [] }]
|
||||
}
|
||||
},
|
||||
"/users/license/deallocate": {
|
||||
"post": {
|
||||
"operationId": "deallocateLicense",
|
||||
"summary": "",
|
||||
"description": "ライセンス割り当てを解除します",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DeallocateLicenseRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功時のレスポンス",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DeallocateLicenseResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": ["users"],
|
||||
"security": [{ "bearer": [] }]
|
||||
}
|
||||
},
|
||||
"/files/audio/upload-finished": {
|
||||
"post": {
|
||||
"operationId": "uploadFinished",
|
||||
@ -2488,6 +2544,14 @@
|
||||
"required": ["userId", "newLicenseId"]
|
||||
},
|
||||
"AllocateLicenseResponse": { "type": "object", "properties": {} },
|
||||
"DeallocateLicenseRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"userId": { "type": "number", "description": "ユーザーID" }
|
||||
},
|
||||
"required": ["userId"]
|
||||
},
|
||||
"DeallocateLicenseResponse": { "type": "object", "properties": {} },
|
||||
"AudioOptionItem": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -248,3 +248,10 @@ export class AllocateLicenseRequest {
|
||||
}
|
||||
|
||||
export class AllocateLicenseResponse {}
|
||||
|
||||
export class DeallocateLicenseRequest {
|
||||
@ApiProperty({ description: 'ユーザーID' })
|
||||
userId: number;
|
||||
}
|
||||
|
||||
export class DeallocateLicenseResponse {}
|
||||
|
||||
@ -35,6 +35,8 @@ import {
|
||||
PostUpdateUserResponse,
|
||||
AllocateLicenseResponse,
|
||||
AllocateLicenseRequest,
|
||||
DeallocateLicenseResponse,
|
||||
DeallocateLicenseRequest,
|
||||
} from './types/types';
|
||||
import { UsersService } from './users.service';
|
||||
import jwt from 'jsonwebtoken';
|
||||
@ -424,4 +426,48 @@ export class UsersController {
|
||||
);
|
||||
return {};
|
||||
}
|
||||
|
||||
@ApiResponse({
|
||||
status: HttpStatus.OK,
|
||||
type: DeallocateLicenseResponse,
|
||||
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: 'deallocateLicense',
|
||||
description: 'ライセンス割り当てを解除します',
|
||||
})
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(AuthGuard)
|
||||
@UseGuards(
|
||||
RoleGuard.requireds({ roles: [ADMIN_ROLES.ADMIN], tiers: [TIERS.TIER5] }),
|
||||
)
|
||||
@Post('/license/deallocate')
|
||||
async deallocateLicense(
|
||||
@Body() body: DeallocateLicenseRequest,
|
||||
@Req() req: Request,
|
||||
): Promise<DeallocateLicenseResponse> {
|
||||
//API実装時に詳細をかいていく
|
||||
//const accessToken = retrieveAuthorizationToken(req);
|
||||
//const { userId } = jwt.decode(accessToken, { json: true }) as AccessToken;
|
||||
|
||||
//const context = makeContext(userId);
|
||||
|
||||
//await this.usersService.deallocateLicense(context, body.userId);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user