Merged PR 195: API IF実装
## 概要 [Task2094: API IF実装](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2094) -カードライセンス取り込みAPIのIFを実装。 ## レビューポイント - なし ## UIの変更 - なし ## 動作確認状況 - ローカルでビルドエラーが出ないことを確認 ## 補足 - なし
This commit is contained in:
parent
24e52938c0
commit
2263412120
@ -1479,6 +1479,61 @@
|
||||
"security": [{ "bearer": [] }]
|
||||
}
|
||||
},
|
||||
"/licenses/cards/activate": {
|
||||
"post": {
|
||||
"operationId": "activateCardLicenses",
|
||||
"summary": "",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ActivateCardLicensesRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功時のレスポンス",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ActivateCardLicensesResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": ["licenses"],
|
||||
"security": [{ "bearer": [] }]
|
||||
}
|
||||
},
|
||||
"/notification/register": {
|
||||
"post": {
|
||||
"operationId": "register",
|
||||
@ -2152,6 +2207,12 @@
|
||||
},
|
||||
"required": ["cardLicenseKeys"]
|
||||
},
|
||||
"ActivateCardLicensesRequest": {
|
||||
"type": "object",
|
||||
"properties": { "cardLicenseKey": { "type": "string" } },
|
||||
"required": ["cardLicenseKey"]
|
||||
},
|
||||
"ActivateCardLicensesResponse": { "type": "object", "properties": {} },
|
||||
"RegisterRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -20,6 +20,8 @@ import {
|
||||
CreateOrdersRequest,
|
||||
IssueCardLicensesResponse,
|
||||
IssueCardLicensesRequest,
|
||||
ActivateCardLicensesResponse,
|
||||
ActivateCardLicensesRequest,
|
||||
} from './types/types';
|
||||
import { Request } from 'express';
|
||||
import { retrieveAuthorizationToken } from '../../common/http/helper';
|
||||
@ -123,4 +125,40 @@ export class LicensesController {
|
||||
|
||||
return cardLicenseKeys;
|
||||
}
|
||||
|
||||
@ApiResponse({
|
||||
status: HttpStatus.OK,
|
||||
type: ActivateCardLicensesResponse,
|
||||
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: 'activateCardLicenses' })
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(AuthGuard)
|
||||
@UseGuards(RoleGuard.requireds({ roles: [ADMIN_ROLES.ADMIN] }))
|
||||
@Post('/cards/activate')
|
||||
async activateCardLicenses(
|
||||
@Req() req: Request,
|
||||
@Body() body: ActivateCardLicensesRequest,
|
||||
): Promise<ActivateCardLicensesResponse> {
|
||||
console.log(req.header('Authorization'));
|
||||
console.log(body);
|
||||
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsInt, Matches, Max, Min } from 'class-validator';
|
||||
import { IsInt, Matches, Max, Min, Length } from 'class-validator';
|
||||
|
||||
export class CreateOrdersRequest {
|
||||
@ApiProperty()
|
||||
@ -27,3 +27,12 @@ export class IssueCardLicensesResponse {
|
||||
@ApiProperty()
|
||||
cardLicenseKeys: string[];
|
||||
}
|
||||
|
||||
export class ActivateCardLicensesRequest {
|
||||
@ApiProperty()
|
||||
@Matches(/^[A-Z0-9]+$/)
|
||||
@Length(20, 20)
|
||||
cardLicenseKey: string;
|
||||
}
|
||||
|
||||
export class ActivateCardLicensesResponse {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user