Merge branch 'develop' of https://dev.azure.com/ODMSCloud/ODMS%20Cloud/_git/ODMS%20Cloud into develop
This commit is contained in:
commit
a4c93b3023
@ -172,6 +172,92 @@
|
||||
"tags": ["users"]
|
||||
}
|
||||
},
|
||||
"/users": {
|
||||
"get": {
|
||||
"operationId": "getUsers",
|
||||
"summary": "",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功時のレスポンス",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/GetUsersResponse" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "認証エラー",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/ErrorResponse" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "想定外のサーバーエラー",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/ErrorResponse" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": ["users"],
|
||||
"security": [{ "bearer": [] }]
|
||||
}
|
||||
},
|
||||
"/users/signup": {
|
||||
"post": {
|
||||
"operationId": "signup",
|
||||
"summary": "",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/SignupRequest" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功時のレスポンス",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/SignupResponse" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "登録済みメールによる再登録、AuthorIDの重複など",
|
||||
"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": [] }]
|
||||
}
|
||||
},
|
||||
"/notification/register": {
|
||||
"post": {
|
||||
"operationId": "register",
|
||||
@ -312,6 +398,63 @@
|
||||
"required": ["token"]
|
||||
},
|
||||
"ConfirmResponse": { "type": "object", "properties": {} },
|
||||
"User": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"role": { "type": "string", "description": "none/author/typist" },
|
||||
"authorId": { "type": "string", "nullable": true },
|
||||
"typistGroupName": { "type": "string", "nullable": true },
|
||||
"email": { "type": "string" },
|
||||
"emailVerified": { "type": "boolean" },
|
||||
"autoRenew": { "type": "boolean" },
|
||||
"licenseAlert": { "type": "boolean" },
|
||||
"notification": { "type": "boolean" }
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"role",
|
||||
"authorId",
|
||||
"typistGroupName",
|
||||
"email",
|
||||
"emailVerified",
|
||||
"autoRenew",
|
||||
"licenseAlert",
|
||||
"notification"
|
||||
]
|
||||
},
|
||||
"GetUsersResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"users": {
|
||||
"type": "array",
|
||||
"items": { "$ref": "#/components/schemas/User" }
|
||||
}
|
||||
},
|
||||
"required": ["users"]
|
||||
},
|
||||
"SignupRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"role": { "type": "string", "description": "none/author/typist" },
|
||||
"authorId": { "type": "string" },
|
||||
"typistGroupId": { "type": "number" },
|
||||
"email": { "type": "string" },
|
||||
"autoRenew": { "type": "boolean" },
|
||||
"licenseAlert": { "type": "boolean" },
|
||||
"notification": { "type": "boolean" }
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"role",
|
||||
"email",
|
||||
"autoRenew",
|
||||
"licenseAlert",
|
||||
"notification"
|
||||
]
|
||||
},
|
||||
"SignupResponse": { "type": "object", "properties": {} },
|
||||
"RegisterRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -6,3 +6,65 @@ export class ConfirmRequest {
|
||||
}
|
||||
|
||||
export class ConfirmResponse {}
|
||||
|
||||
export class User {
|
||||
@ApiProperty()
|
||||
name: string;
|
||||
|
||||
@ApiProperty({ description: 'none/author/typist' })
|
||||
role: string;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
authorId?: string | undefined;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
typistGroupName?: string | undefined;
|
||||
|
||||
@ApiProperty()
|
||||
email: string;
|
||||
|
||||
@ApiProperty()
|
||||
emailVerified: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
autoRenew: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
licenseAlert: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
notification: boolean;
|
||||
}
|
||||
|
||||
export class GetUsersResponse {
|
||||
@ApiProperty({ type: [User] })
|
||||
users: User[];
|
||||
}
|
||||
|
||||
export class SignupRequest {
|
||||
@ApiProperty()
|
||||
name: string;
|
||||
|
||||
@ApiProperty({ description: 'none/author/typist' })
|
||||
role: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
authorId?: string | undefined;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
typistGroupId?: number | undefined;
|
||||
|
||||
@ApiProperty()
|
||||
email: string;
|
||||
|
||||
@ApiProperty()
|
||||
autoRenew: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
licenseAlert: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
notification: boolean;
|
||||
}
|
||||
|
||||
export class SignupResponse {}
|
||||
|
||||
@ -1,15 +1,26 @@
|
||||
import { Body, Controller, HttpStatus, Post } from '@nestjs/common';
|
||||
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
|
||||
import { Body, Controller, Get, HttpStatus, Post, Req } from '@nestjs/common';
|
||||
import {
|
||||
ApiBearerAuth,
|
||||
ApiOperation,
|
||||
ApiResponse,
|
||||
ApiTags,
|
||||
} from '@nestjs/swagger';
|
||||
import { ErrorResponse } from '../../common/error/types/types';
|
||||
import { ConfirmRequest, ConfirmResponse } from './types/types';
|
||||
import {
|
||||
ConfirmRequest,
|
||||
ConfirmResponse,
|
||||
GetUsersResponse,
|
||||
SignupRequest,
|
||||
SignupResponse,
|
||||
} from './types/types';
|
||||
import { UsersService } from './users.service';
|
||||
import { Request } from 'express';
|
||||
|
||||
@ApiTags('users')
|
||||
@Controller('users')
|
||||
export class UsersController {
|
||||
constructor(private readonly usersService: UsersService) {}
|
||||
|
||||
@Post('confirm')
|
||||
@ApiResponse({
|
||||
status: HttpStatus.OK,
|
||||
type: ConfirmResponse,
|
||||
@ -26,8 +37,64 @@ export class UsersController {
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiOperation({ operationId: 'confirmUser' })
|
||||
@Post('confirm')
|
||||
async confirmUser(@Body() body: ConfirmRequest): Promise<ConfirmResponse> {
|
||||
await this.usersService.confirmUser(body.token);
|
||||
return {};
|
||||
}
|
||||
|
||||
@ApiResponse({
|
||||
status: HttpStatus.OK,
|
||||
type: GetUsersResponse,
|
||||
description: '成功時のレスポンス',
|
||||
})
|
||||
@ApiResponse({
|
||||
status: HttpStatus.UNAUTHORIZED,
|
||||
description: '認証エラー',
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiResponse({
|
||||
status: HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
description: '想定外のサーバーエラー',
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiOperation({ operationId: 'getUsers' })
|
||||
@ApiBearerAuth()
|
||||
@Get()
|
||||
async getUsers(@Req() req: Request): Promise<GetUsersResponse> {
|
||||
console.log(req.header('Authorization'));
|
||||
return { users: [] };
|
||||
}
|
||||
|
||||
@ApiResponse({
|
||||
status: HttpStatus.OK,
|
||||
type: SignupResponse,
|
||||
description: '成功時のレスポンス',
|
||||
})
|
||||
@ApiResponse({
|
||||
status: HttpStatus.BAD_REQUEST,
|
||||
description: '登録済みメールによる再登録、AuthorIDの重複など',
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiResponse({
|
||||
status: HttpStatus.UNAUTHORIZED,
|
||||
description: '認証エラー',
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiResponse({
|
||||
status: HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
description: '想定外のサーバーエラー',
|
||||
type: ErrorResponse,
|
||||
})
|
||||
@ApiOperation({ operationId: 'signup' })
|
||||
@ApiBearerAuth()
|
||||
@Post('/signup')
|
||||
async signup(
|
||||
@Req() req: Request,
|
||||
@Body() body: SignupRequest,
|
||||
): Promise<SignupResponse> {
|
||||
console.log(req.header('Authorization'));
|
||||
console.log(body);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user