be
This commit is contained in:
61
backend/dist/auth/auth.controller.js
vendored
61
backend/dist/auth/auth.controller.js
vendored
@@ -24,6 +24,9 @@ const jwt_auth_guard_1 = require("./jwt-auth.guard");
|
||||
const user_info_response_dto_1 = require("../users/dto/user-info-response.dto");
|
||||
const swagger_1 = require("@nestjs/swagger");
|
||||
const create_user_response_dto_1 = require("../users/dto/create-user-response.dto");
|
||||
const check_availability_response_dto_1 = require("./dto/check-availability-response.dto");
|
||||
const check_name_dto_1 = require("./dto/check-name.dto");
|
||||
const check_email_dto_1 = require("./dto/check-email.dto");
|
||||
let AuthController = class AuthController {
|
||||
authService;
|
||||
userService;
|
||||
@@ -44,13 +47,25 @@ let AuthController = class AuthController {
|
||||
async getMe(req) {
|
||||
return await this.userService.findUserWithProfileByIdOrFail(req.user.userId);
|
||||
}
|
||||
async checkName(dto) {
|
||||
const available = await this.authService.isNameAvailable(dto.name);
|
||||
return { available };
|
||||
}
|
||||
async checkEmail(dto) {
|
||||
const available = await this.authService.isEmailAvailabe(dto.email);
|
||||
return { available };
|
||||
}
|
||||
async deleteMe(req) {
|
||||
await this.userService.softDelete(req.user.userId);
|
||||
}
|
||||
};
|
||||
exports.AuthController = AuthController;
|
||||
__decorate([
|
||||
(0, common_1.Post)('signup'),
|
||||
(0, common_1.HttpCode)(200),
|
||||
(0, swagger_1.ApiOperation)({ summary: '회원가입' }),
|
||||
(0, swagger_1.ApiOkResponse)({ description: '성공', type: create_user_response_dto_1.CreateUserResponse }),
|
||||
openapi.ApiResponse({ status: 201, type: require("../users/dto/create-user-response.dto").CreateUserResponse }),
|
||||
openapi.ApiResponse({ status: 200, type: require("../users/dto/create-user-response.dto").CreateUserResponse }),
|
||||
__param(0, (0, common_1.Body)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [create_user_dto_1.CreateUserDto]),
|
||||
@@ -58,9 +73,10 @@ __decorate([
|
||||
], AuthController.prototype, "signup", null);
|
||||
__decorate([
|
||||
(0, common_1.Post)('login'),
|
||||
(0, common_1.HttpCode)(200),
|
||||
(0, swagger_1.ApiOperation)({ summary: '로그인' }),
|
||||
(0, swagger_1.ApiOkResponse)({ description: '성공', type: login_response_dto_1.LoginResponseDto }),
|
||||
openapi.ApiResponse({ status: 201, type: require("./dto/login-response.dto").LoginResponseDto }),
|
||||
openapi.ApiResponse({ status: 200, type: require("./dto/login-response.dto").LoginResponseDto }),
|
||||
__param(0, (0, common_1.Body)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [login_user_dto_1.LoginUserDto]),
|
||||
@@ -70,13 +86,50 @@ __decorate([
|
||||
(0, common_1.Get)('me'),
|
||||
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
||||
(0, swagger_1.ApiBearerAuth)(),
|
||||
(0, swagger_1.ApiOkResponse)({ description: '성공', type: user_info_response_dto_1.UserWithProfileResponseDto }),
|
||||
openapi.ApiResponse({ status: 200, type: require("../users/dto/user-info-response.dto").UserWithProfileResponseDto }),
|
||||
(0, swagger_1.ApiOperation)({ summary: '정보 확인' }),
|
||||
(0, swagger_1.ApiOkResponse)({ description: '성공', type: user_info_response_dto_1.UserInfoResponseDto }),
|
||||
openapi.ApiResponse({ status: 200, type: require("../users/dto/user-info-response.dto").UserInfoResponseDto }),
|
||||
__param(0, (0, common_1.Request)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [Object]),
|
||||
__metadata("design:returntype", Promise)
|
||||
], AuthController.prototype, "getMe", null);
|
||||
__decorate([
|
||||
(0, common_1.Post)('check-name'),
|
||||
(0, common_1.HttpCode)(200),
|
||||
(0, swagger_1.ApiOperation)({ summary: '사용자 이름 중복 확인' }),
|
||||
(0, swagger_1.ApiOkResponse)({ description: '성공', type: check_availability_response_dto_1.CheckAvailabilityResponseDto }),
|
||||
openapi.ApiResponse({ status: 200, type: require("./dto/check-availability-response.dto").CheckAvailabilityResponseDto }),
|
||||
__param(0, (0, common_1.Body)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [check_name_dto_1.CheckNameDto]),
|
||||
__metadata("design:returntype", Promise)
|
||||
], AuthController.prototype, "checkName", null);
|
||||
__decorate([
|
||||
(0, common_1.Post)('check-email'),
|
||||
(0, common_1.HttpCode)(200),
|
||||
(0, swagger_1.ApiOperation)({ summary: '사용자 이메일 중복 확인' }),
|
||||
(0, swagger_1.ApiOkResponse)({ description: '성공', type: check_availability_response_dto_1.CheckAvailabilityResponseDto }),
|
||||
openapi.ApiResponse({ status: 200, type: require("./dto/check-availability-response.dto").CheckAvailabilityResponseDto }),
|
||||
__param(0, (0, common_1.Body)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [check_email_dto_1.CheckEmailDto]),
|
||||
__metadata("design:returntype", Promise)
|
||||
], AuthController.prototype, "checkEmail", null);
|
||||
__decorate([
|
||||
(0, common_1.Delete)('me'),
|
||||
(0, common_1.HttpCode)(204),
|
||||
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
||||
(0, swagger_1.ApiBearerAuth)(),
|
||||
(0, swagger_1.ApiOperation)({ summary: '회원 탈퇴' }),
|
||||
(0, swagger_1.ApiNoContentResponse)({ description: '탈퇴 완료' }),
|
||||
(0, swagger_1.ApiNotFoundResponse)({ description: '존재하지 않는 사용자' }),
|
||||
openapi.ApiResponse({ status: 204 }),
|
||||
__param(0, (0, common_1.Request)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [Object]),
|
||||
__metadata("design:returntype", Promise)
|
||||
], AuthController.prototype, "deleteMe", null);
|
||||
exports.AuthController = AuthController = __decorate([
|
||||
(0, swagger_1.ApiTags)('인증'),
|
||||
(0, common_1.Controller)('auth'),
|
||||
|
Reference in New Issue
Block a user