Merged PR 221: API IF実装(パートナーアカウント追加API)
## 概要 [Task2153: API IF実装](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2153) - 元PBI or タスクへのリンク(内容・目的などはそちらにあるはず) - 何をどう変更したか、追加したライブラリなど パートナーアカウント追加APIのIFを追加しました ## レビューポイント 特になし ## UIの変更 無し ## 動作確認状況 ローカルで確認済 ## 補足 - 相談、参考資料などがあれば
This commit is contained in:
parent
869880c204
commit
c19adde702
@ -300,6 +300,61 @@
|
||||
"security": [{ "bearer": [] }]
|
||||
}
|
||||
},
|
||||
"/accounts/partner": {
|
||||
"post": {
|
||||
"operationId": "createPartnerAccount",
|
||||
"summary": "",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/CreatePartnerAccountRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功時のレスポンス",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/CreatePartnerAccountResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": [] }]
|
||||
}
|
||||
},
|
||||
"/users/confirm": {
|
||||
"post": {
|
||||
"operationId": "confirmUser",
|
||||
@ -1743,6 +1798,22 @@
|
||||
},
|
||||
"required": ["typistGroups"]
|
||||
},
|
||||
"CreatePartnerAccountRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"companyName": { "type": "string" },
|
||||
"country": {
|
||||
"type": "string",
|
||||
"description": "国名(ISO 3166-1 alpha-2)",
|
||||
"minLength": 2,
|
||||
"maxLength": 2
|
||||
},
|
||||
"adminName": { "type": "string" },
|
||||
"eMail": { "type": "string" }
|
||||
},
|
||||
"required": ["companyName", "country", "adminName", "eMail"]
|
||||
},
|
||||
"CreatePartnerAccountResponse": { "type": "object", "properties": {} },
|
||||
"ConfirmRequest": {
|
||||
"type": "object",
|
||||
"properties": { "token": { "type": "string" } },
|
||||
|
||||
@ -25,6 +25,8 @@ import {
|
||||
GetMyAccountResponse,
|
||||
GetTypistGroupsResponse,
|
||||
GetTypistsResponse,
|
||||
CreatePartnerAccountRequest,
|
||||
CreatePartnerAccountResponse,
|
||||
} from './types/types';
|
||||
import { USER_ROLES, ADMIN_ROLES } from '../../constants';
|
||||
import { AuthGuard } from '../../common/guards/auth/authguards';
|
||||
@ -237,4 +239,47 @@ export class AccountsController {
|
||||
|
||||
return { typistGroups };
|
||||
}
|
||||
|
||||
@Post('partner')
|
||||
@ApiResponse({
|
||||
status: HttpStatus.OK,
|
||||
type: CreatePartnerAccountResponse,
|
||||
description: '成功時のレスポンス',
|
||||
})
|
||||
@ApiResponse({
|
||||
status: HttpStatus.UNAUTHORIZED,
|
||||
description: '認証エラー',
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiResponse({
|
||||
status: HttpStatus.BAD_REQUEST,
|
||||
description: '登録済みユーザーからの登録など',
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiResponse({
|
||||
status: HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
description: '想定外のサーバーエラー',
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiOperation({ operationId: 'createPartnerAccount' })
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(AuthGuard)
|
||||
@UseGuards(RoleGuard.requireds({ roles: [ADMIN_ROLES.ADMIN] }))
|
||||
async createPartnerAccount(
|
||||
@Req() req: Request,
|
||||
@Body() body: CreatePartnerAccountRequest,
|
||||
): Promise<CreatePartnerAccountResponse> {
|
||||
console.log(req.header('Authorization'));
|
||||
console.log(body);
|
||||
const { companyName, country, eMail, adminName } = body;
|
||||
|
||||
/*await this.accountService.createPartnerAccount(
|
||||
companyName,
|
||||
country,
|
||||
eMail,
|
||||
adminName,
|
||||
);*/
|
||||
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,3 +117,21 @@ export class GetTypistGroupsResponse {
|
||||
@ApiProperty({ type: [TypistGroup] })
|
||||
typistGroups: TypistGroup[];
|
||||
}
|
||||
|
||||
export class CreatePartnerAccountRequest {
|
||||
@ApiProperty()
|
||||
companyName: string;
|
||||
@ApiProperty({
|
||||
description: '国名(ISO 3166-1 alpha-2)',
|
||||
minLength: 2,
|
||||
maxLength: 2,
|
||||
})
|
||||
country: string;
|
||||
@ApiProperty()
|
||||
adminName: string;
|
||||
@ApiProperty()
|
||||
@IsEmail()
|
||||
eMail: string;
|
||||
}
|
||||
|
||||
export class CreatePartnerAccountResponse {}
|
||||
Loading…
x
Reference in New Issue
Block a user