Merged PR 366: API IF実装
## 概要 [Task2496: API IF実装](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2496) - 元PBI or タスクへのリンク(内容・目的などはそちらにあるはず) - 何をどう変更したか、追加したライブラリなど - ライセンス発行キャンセルAPIのIFと、使用するリクエスト/レスポンスのtypeを作成しました - このPull Requestでの対象/対象外 - 対象外:openapi.jsonの「/licenses/orders/cancel」について、descriptionが追加されていますが本タスクでの追加ではありません。 - 影響範囲(他の機能にも影響があるか) - 特になし ## レビューポイント - 特筆するポイントは無し ## UIの変更 - 無し ## 動作確認状況 - swagger uiよりリクエスト投入できることを確認 ## 補足 - 無し
This commit is contained in:
parent
ef8e6c44ec
commit
1c4026eff9
@ -696,6 +696,58 @@
|
|||||||
"tags": ["accounts"]
|
"tags": ["accounts"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/accounts/issue/cancel": {
|
||||||
|
"post": {
|
||||||
|
"operationId": "cancelIssue",
|
||||||
|
"summary": "",
|
||||||
|
"description": "ライセンス発行をキャンセルします",
|
||||||
|
"parameters": [],
|
||||||
|
"requestBody": {
|
||||||
|
"required": true,
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": { "$ref": "#/components/schemas/CancelIssueRequest" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "成功時のレスポンス",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": { "$ref": "#/components/schemas/CancelIssueResponse" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "対象注文のステータスが発行済以外/発行日から15日以降/ライセンスをユーザに割り当てている",
|
||||||
|
"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": [] }]
|
||||||
|
}
|
||||||
|
},
|
||||||
"/users/confirm": {
|
"/users/confirm": {
|
||||||
"post": {
|
"post": {
|
||||||
"operationId": "confirmUser",
|
"operationId": "confirmUser",
|
||||||
@ -2138,6 +2190,7 @@
|
|||||||
"post": {
|
"post": {
|
||||||
"operationId": "cancelOrder",
|
"operationId": "cancelOrder",
|
||||||
"summary": "",
|
"summary": "",
|
||||||
|
"description": "ライセンス注文をキャンセルします",
|
||||||
"parameters": [],
|
"parameters": [],
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
"required": true,
|
"required": true,
|
||||||
@ -2572,6 +2625,18 @@
|
|||||||
},
|
},
|
||||||
"required": ["dealers"]
|
"required": ["dealers"]
|
||||||
},
|
},
|
||||||
|
"CancelIssueRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"orderedAccountId": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "注文元アカウントID"
|
||||||
|
},
|
||||||
|
"poNumber": { "type": "string", "description": "POナンバー" }
|
||||||
|
},
|
||||||
|
"required": ["orderedAccountId", "poNumber"]
|
||||||
|
},
|
||||||
|
"CancelIssueResponse": { "type": "object", "properties": {} },
|
||||||
"ConfirmRequest": {
|
"ConfirmRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": { "token": { "type": "string" } },
|
"properties": { "token": { "type": "string" } },
|
||||||
|
|||||||
@ -40,6 +40,8 @@ import {
|
|||||||
GetTypistGroupRequest,
|
GetTypistGroupRequest,
|
||||||
UpdateTypistGroupRequest,
|
UpdateTypistGroupRequest,
|
||||||
UpdateTypistGroupRequestParam,
|
UpdateTypistGroupRequestParam,
|
||||||
|
CancelIssueRequest,
|
||||||
|
CancelIssueResponse,
|
||||||
} 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';
|
||||||
@ -568,4 +570,56 @@ export class AccountsController {
|
|||||||
async getDealers(): Promise<GetDealersResponse> {
|
async getDealers(): Promise<GetDealersResponse> {
|
||||||
return await this.accountService.getDealers();
|
return await this.accountService.getDealers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Post('/issue/cancel')
|
||||||
|
@ApiResponse({
|
||||||
|
status: HttpStatus.OK,
|
||||||
|
type: CancelIssueResponse,
|
||||||
|
description: '成功時のレスポンス',
|
||||||
|
})
|
||||||
|
@ApiResponse({
|
||||||
|
status: HttpStatus.BAD_REQUEST,
|
||||||
|
description:
|
||||||
|
'対象注文のステータスが発行済以外/発行日から15日以降/ライセンスをユーザに割り当てている',
|
||||||
|
type: ErrorResponse,
|
||||||
|
})
|
||||||
|
@ApiResponse({
|
||||||
|
status: HttpStatus.UNAUTHORIZED,
|
||||||
|
description: '認証エラー',
|
||||||
|
type: ErrorResponse,
|
||||||
|
})
|
||||||
|
@ApiResponse({
|
||||||
|
status: HttpStatus.INTERNAL_SERVER_ERROR,
|
||||||
|
description: '想定外のサーバーエラー',
|
||||||
|
type: ErrorResponse,
|
||||||
|
})
|
||||||
|
@ApiOperation({
|
||||||
|
operationId: 'cancelIssue',
|
||||||
|
description: 'ライセンス発行をキャンセルします',
|
||||||
|
})
|
||||||
|
@ApiBearerAuth()
|
||||||
|
@UseGuards(AuthGuard)
|
||||||
|
@UseGuards(
|
||||||
|
RoleGuard.requireds({
|
||||||
|
roles: [ADMIN_ROLES.ADMIN],
|
||||||
|
tiers: [TIERS.TIER1, TIERS.TIER2],
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
async cancelIssue(
|
||||||
|
@Req() req: Request,
|
||||||
|
@Body() body: CancelIssueRequest,
|
||||||
|
): Promise<CancelIssueResponse> {
|
||||||
|
const token = retrieveAuthorizationToken(req);
|
||||||
|
const payload = jwt.decode(token, { json: true }) as AccessToken;
|
||||||
|
|
||||||
|
const context = makeContext(payload.userId);
|
||||||
|
|
||||||
|
// TODO: 発行キャンセル処理(仮)。API実装のタスク(2498)で本実装
|
||||||
|
// await this.accountService.cancelIssue(
|
||||||
|
// context,
|
||||||
|
// body.poNumber,
|
||||||
|
// body.orderedAccountId,
|
||||||
|
// );
|
||||||
|
return {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -320,3 +320,14 @@ export class GetDealersResponse {
|
|||||||
@ApiProperty({ type: [Dealer] })
|
@ApiProperty({ type: [Dealer] })
|
||||||
dealers: Dealer[];
|
dealers: Dealer[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class CancelIssueRequest {
|
||||||
|
@ApiProperty({ description: '注文元アカウントID' })
|
||||||
|
orderedAccountId: number;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'POナンバー' })
|
||||||
|
@Matches(/^[A-Z0-9]+$/)
|
||||||
|
poNumber: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CancelIssueResponse {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user