From a1a91207e4079112345dc970bc22767b324f98c4 Mon Sep 17 00:00:00 2001 From: "saito.k" Date: Mon, 7 Aug 2023 01:25:26 +0000 Subject: [PATCH] =?UTF-8?q?Merged=20PR=20308:=20IF=E5=AE=9F=E8=A3=85?= =?UTF-8?q?=EF=BC=88Dealer=E5=8F=96=E5=BE=97API=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 概要 [Task2352: IF実装(Dealer取得API)](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2352) - ディーラー取得APIのIFを実装 ## レビューポイント - レスポンスとして返却するデータの認識はあっているか ## UIの変更 - Before/Afterのスクショなど - スクショ置き場 ## 動作確認状況 - ローカルで確認 ## 補足 - 相談、参考資料などがあれば --- dictation_server/src/api/odms/openapi.json | 48 +++++++++++++++++++ .../features/accounts/accounts.controller.ts | 25 ++++++++++ .../src/features/accounts/types/types.ts | 13 +++++ 3 files changed, 86 insertions(+) diff --git a/dictation_server/src/api/odms/openapi.json b/dictation_server/src/api/odms/openapi.json index 9af94c5..1713cbb 100644 --- a/dictation_server/src/api/odms/openapi.json +++ b/dictation_server/src/api/odms/openapi.json @@ -502,6 +502,32 @@ "security": [{ "bearer": [] }] } }, + "/accounts/dealers": { + "get": { + "operationId": "getDealers", + "summary": "", + "parameters": [], + "responses": { + "200": { + "description": "成功時のレスポンス", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/GetDealersResponse" } + } + } + }, + "500": { + "description": "想定外のサーバーエラー", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ErrorResponse" } + } + } + } + }, + "tags": ["accounts"] + } + }, "/users/confirm": { "post": { "operationId": "confirmUser", @@ -2120,6 +2146,28 @@ "required": ["orderedAccountId", "poNumber"] }, "IssueLicenseResponse": { "type": "object", "properties": {} }, + "Dealer": { + "type": "object", + "properties": { + "id": { "type": "number", "description": "アカウントID" }, + "name": { "type": "string", "description": "会社名" }, + "country": { + "type": "string", + "description": "国名(ISO 3166-1 alpha-2)" + } + }, + "required": ["id", "name", "country"] + }, + "GetDealersResponse": { + "type": "object", + "properties": { + "dealers": { + "type": "array", + "items": { "$ref": "#/components/schemas/Dealer" } + } + }, + "required": ["dealers"] + }, "ConfirmRequest": { "type": "object", "properties": { "token": { "type": "string" } }, diff --git a/dictation_server/src/features/accounts/accounts.controller.ts b/dictation_server/src/features/accounts/accounts.controller.ts index 8c0fe98..de313e0 100644 --- a/dictation_server/src/features/accounts/accounts.controller.ts +++ b/dictation_server/src/features/accounts/accounts.controller.ts @@ -32,6 +32,7 @@ import { GetOrderHistoriesResponse, IssueLicenseRequest, IssueLicenseResponse, + GetDealersResponse, } from './types/types'; import { USER_ROLES, ADMIN_ROLES, TIERS } from '../../constants'; import { AuthGuard } from '../../common/guards/auth/authguards'; @@ -412,4 +413,28 @@ export class AccountsController { return {}; } + + @Get('/dealers') + @ApiResponse({ + status: HttpStatus.OK, + type: GetDealersResponse, + description: '成功時のレスポンス', + }) + @ApiResponse({ + status: HttpStatus.INTERNAL_SERVER_ERROR, + description: '想定外のサーバーエラー', + type: ErrorResponse, + }) + @ApiOperation({ operationId: 'getDealers' }) + async getDealers(): Promise { + return { + dealers: [ + { + id: 1, + name: 'Dealer1', + country: 'US', + }, + ], + }; + } } diff --git a/dictation_server/src/features/accounts/types/types.ts b/dictation_server/src/features/accounts/types/types.ts index e9a1334..a6d911c 100644 --- a/dictation_server/src/features/accounts/types/types.ts +++ b/dictation_server/src/features/accounts/types/types.ts @@ -234,3 +234,16 @@ export class IssueLicenseRequest { } export class IssueLicenseResponse {} + +export class Dealer { + @ApiProperty({ description: 'アカウントID' }) + id: number; + @ApiProperty({ description: '会社名' }) + name: string; + @ApiProperty({ description: '国名(ISO 3166-1 alpha-2)' }) + country: string; +} +export class GetDealersResponse { + @ApiProperty({ type: [Dealer] }) + dealers: Dealer[]; +}