From 3ca70faa9d5fa4353d290cdf3228bfee60f93596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n?= <80365304+Diego-lvan@users.noreply.github.com> Date: Sun, 31 Mar 2024 12:48:36 -0600 Subject: [PATCH 01/14] eliminando rutas sin utilizar de admin --- backend/src/admin/admin.controller.ts | 31 +-------------------------- 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/backend/src/admin/admin.controller.ts b/backend/src/admin/admin.controller.ts index 2b3cce94..fd2874a8 100644 --- a/backend/src/admin/admin.controller.ts +++ b/backend/src/admin/admin.controller.ts @@ -1,15 +1,6 @@ -import { - Controller, - Get, - Post, - Body, - Patch, - Param, - Delete, -} from '@nestjs/common'; +import { Controller, Post, Body } from '@nestjs/common'; import { AdminService } from './admin.service'; import { CreateAdminDto } from './dto/create-admin.dto'; -import { UpdateAdminDto } from './dto/update-admin.dto'; @Controller('admin') export class AdminController { @@ -19,24 +10,4 @@ export class AdminController { create(@Body() createAdminDto: CreateAdminDto) { return this.adminService.create(createAdminDto); } - - @Get() - findAll() { - return this.adminService.findAll(); - } - - @Get(':id') - findOne(@Param('id') id: string) { - // return this.adminService.findOne(+id); - } - - @Patch(':id') - update(@Param('id') id: string, @Body() updateAdminDto: UpdateAdminDto) { - return this.adminService.update(+id, updateAdminDto); - } - - @Delete(':id') - remove(@Param('id') id: string) { - return this.adminService.remove(+id); - } } -- GitLab From 5ef5cc496738acb7f16f2eb93bf70db11956ad11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n?= <80365304+Diego-lvan@users.noreply.github.com> Date: Sun, 31 Mar 2024 12:48:49 -0600 Subject: [PATCH 02/14] eliminando servicios sin utilizar de admin --- backend/src/admin/admin.service.ts | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/backend/src/admin/admin.service.ts b/backend/src/admin/admin.service.ts index 7c3edb11..ca642dc9 100644 --- a/backend/src/admin/admin.service.ts +++ b/backend/src/admin/admin.service.ts @@ -1,6 +1,5 @@ import { Injectable } from '@nestjs/common'; import { CreateAdminDto } from './dto/create-admin.dto'; -import { UpdateAdminDto } from './dto/update-admin.dto'; import { Admin } from './entities/admin.entity'; import { Repository } from 'typeorm'; import { InjectRepository } from '@nestjs/typeorm'; @@ -14,19 +13,7 @@ export class AdminService { await this.adminRepository.insert(createAdminDto); } - findAll() { - return `This action returns all admin`; - } - async findOne(email: string): Promise { return await this.adminRepository.findOneByOrFail({ email }); } - - update(id: number, updateAdminDto: UpdateAdminDto) { - return `This action updates a #${id} admin`; - } - - remove(id: number) { - return `This action removes a #${id} admin`; - } } -- GitLab From 3ef05596a0cb1cf6247da8f852d7de540e6e6829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n?= <80365304+Diego-lvan@users.noreply.github.com> Date: Sun, 31 Mar 2024 13:09:25 -0600 Subject: [PATCH 03/14] inicializando user resource --- backend/src/app.module.ts | 4 ++-- backend/src/user/dto/create-user.dto.ts | 1 + backend/src/user/dto/update-user.dto.ts | 4 ++++ backend/src/user/entities/user.entity.ts | 24 ++++++++++++++++++++++++ backend/src/user/user.controller.ts | 18 ++++++++++++++++++ backend/src/user/user.module.ts | 12 ++++++++++++ backend/src/user/user.service.ts | 13 +++++++++++++ 7 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 backend/src/user/dto/create-user.dto.ts create mode 100644 backend/src/user/dto/update-user.dto.ts create mode 100644 backend/src/user/entities/user.entity.ts create mode 100644 backend/src/user/user.controller.ts create mode 100644 backend/src/user/user.module.ts create mode 100644 backend/src/user/user.service.ts diff --git a/backend/src/app.module.ts b/backend/src/app.module.ts index 2b0ef581..eb682229 100644 --- a/backend/src/app.module.ts +++ b/backend/src/app.module.ts @@ -1,13 +1,12 @@ import { Module } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { DataSource } from 'typeorm'; - import { AppController } from './app.controller'; import { AppService } from './app.service'; import { AdminModule } from './admin/admin.module'; import { Admin } from './admin/entities/admin.entity'; import { DbConstants } from './constants/db.constants'; import { AuthAdminModule } from './auth/admin/authAdmin.module'; +import { UserModule } from './user/user.module'; @Module({ imports: [ TypeOrmModule.forRoot({ @@ -22,6 +21,7 @@ import { AuthAdminModule } from './auth/admin/authAdmin.module'; }), AuthAdminModule, AdminModule, + UserModule, ], controllers: [AppController], providers: [AppService], diff --git a/backend/src/user/dto/create-user.dto.ts b/backend/src/user/dto/create-user.dto.ts new file mode 100644 index 00000000..0311be13 --- /dev/null +++ b/backend/src/user/dto/create-user.dto.ts @@ -0,0 +1 @@ +export class CreateUserDto {} diff --git a/backend/src/user/dto/update-user.dto.ts b/backend/src/user/dto/update-user.dto.ts new file mode 100644 index 00000000..78ab602d --- /dev/null +++ b/backend/src/user/dto/update-user.dto.ts @@ -0,0 +1,4 @@ +import { PartialType } from '@nestjs/swagger'; +import { CreateUserDto } from './create-user.dto'; + +export class UpdateUserDto extends PartialType(CreateUserDto) {} diff --git a/backend/src/user/entities/user.entity.ts b/backend/src/user/entities/user.entity.ts new file mode 100644 index 00000000..96037386 --- /dev/null +++ b/backend/src/user/entities/user.entity.ts @@ -0,0 +1,24 @@ +import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm'; + +@Entity() +export class User { + @PrimaryGeneratedColumn() + id: number; + + @Column({ + unique: true, + }) + email: string; + + @Column() + name: string; + + @Column() + lastName: string; + + @Column() + birthDate: Date; + + @Column() + password: string; +} diff --git a/backend/src/user/user.controller.ts b/backend/src/user/user.controller.ts new file mode 100644 index 00000000..b890a0e6 --- /dev/null +++ b/backend/src/user/user.controller.ts @@ -0,0 +1,18 @@ +import { Controller, Get, Post, Body, Param } from '@nestjs/common'; +import { UserService } from './user.service'; +import { CreateUserDto } from './dto/create-user.dto'; + +@Controller('user') +export class UserController { + constructor(private readonly userService: UserService) {} + + @Post() + create(@Body() createUserDto: CreateUserDto) { + return this.userService.create(createUserDto); + } + + @Get(':id') + findOne(@Param('id') id: string) { + return this.userService.findOne(+id); + } +} diff --git a/backend/src/user/user.module.ts b/backend/src/user/user.module.ts new file mode 100644 index 00000000..8a4003a1 --- /dev/null +++ b/backend/src/user/user.module.ts @@ -0,0 +1,12 @@ +import { Module } from '@nestjs/common'; +import { UserService } from './user.service'; +import { UserController } from './user.controller'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { User } from './entities/user.entity'; + +@Module({ + controllers: [UserController], + providers: [UserService], + imports: [TypeOrmModule.forFeature([User])], +}) +export class UserModule {} diff --git a/backend/src/user/user.service.ts b/backend/src/user/user.service.ts new file mode 100644 index 00000000..0e608a5f --- /dev/null +++ b/backend/src/user/user.service.ts @@ -0,0 +1,13 @@ +import { Injectable } from '@nestjs/common'; +import { CreateUserDto } from './dto/create-user.dto'; + +@Injectable() +export class UserService { + create(createUserDto: CreateUserDto) { + return 'This action adds a new user'; + } + + findOne(id: number) { + return `This action returns a #${id} user`; + } +} -- GitLab From 4f659a1048da690bfa0a548c251d39f32fb48ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n?= <80365304+Diego-lvan@users.noreply.github.com> Date: Tue, 9 Apr 2024 09:43:05 -0600 Subject: [PATCH 04/14] agregando la entidad User a typeorm --- backend/src/app.module.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/app.module.ts b/backend/src/app.module.ts index eb682229..2c67a35b 100644 --- a/backend/src/app.module.ts +++ b/backend/src/app.module.ts @@ -7,6 +7,7 @@ import { Admin } from './admin/entities/admin.entity'; import { DbConstants } from './constants/db.constants'; import { AuthAdminModule } from './auth/admin/authAdmin.module'; import { UserModule } from './user/user.module'; +import { User } from './user/entities/user.entity'; @Module({ imports: [ TypeOrmModule.forRoot({ @@ -16,7 +17,7 @@ import { UserModule } from './user/user.module'; username: DbConstants.DB_USER, password: DbConstants.DB_PASSWORD, database: DbConstants.DB_NAME, - entities: [Admin], + entities: [Admin, User], synchronize: DbConstants.DB_SYNC, }), AuthAdminModule, -- GitLab From 64477a3b86c6157885ed468ab383a0acfe726415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n?= <80365304+Diego-lvan@users.noreply.github.com> Date: Thu, 11 Apr 2024 09:53:36 -0600 Subject: [PATCH 05/14] agregando auth user module --- backend/src/app.module.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/src/app.module.ts b/backend/src/app.module.ts index 2c67a35b..4ec2c55f 100644 --- a/backend/src/app.module.ts +++ b/backend/src/app.module.ts @@ -8,6 +8,7 @@ import { DbConstants } from './constants/db.constants'; import { AuthAdminModule } from './auth/admin/authAdmin.module'; import { UserModule } from './user/user.module'; import { User } from './user/entities/user.entity'; +import { AuthUserModule } from './auth/user/authUser.module'; @Module({ imports: [ TypeOrmModule.forRoot({ @@ -23,6 +24,7 @@ import { User } from './user/entities/user.entity'; AuthAdminModule, AdminModule, UserModule, + AuthUserModule, ], controllers: [AppController], providers: [AppService], -- GitLab From 17b20c0401df5735398e497d19eeb4f3b767f201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n?= <80365304+Diego-lvan@users.noreply.github.com> Date: Thu, 11 Apr 2024 09:54:41 -0600 Subject: [PATCH 06/14] agregando servicio de usuarios --- backend/src/user/user.service.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/backend/src/user/user.service.ts b/backend/src/user/user.service.ts index 0e608a5f..0f17c002 100644 --- a/backend/src/user/user.service.ts +++ b/backend/src/user/user.service.ts @@ -1,13 +1,23 @@ import { Injectable } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import { User } from './entities/user.entity'; +import { Repository } from 'typeorm'; import { CreateUserDto } from './dto/create-user.dto'; @Injectable() +/** + * Service responsible for handling user-related operations. + */ export class UserService { - create(createUserDto: CreateUserDto) { - return 'This action adds a new user'; + constructor( + @InjectRepository(User) private userRepository: Repository, + ) {} + + async findOne(email: string) { + return await this.userRepository.findOneByOrFail({ email }); } - findOne(id: number) { - return `This action returns a #${id} user`; + async create(createUserDto: CreateUserDto) { + await this.userRepository.insert(createUserDto); } } -- GitLab From e3528af5b411aecf6c3774b663eb5f2cc164efd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n?= <80365304+Diego-lvan@users.noreply.github.com> Date: Thu, 11 Apr 2024 10:03:50 -0600 Subject: [PATCH 07/14] agregando dto de login user --- backend/src/user/dto/create-user.dto.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/backend/src/user/dto/create-user.dto.ts b/backend/src/user/dto/create-user.dto.ts index 0311be13..89a565be 100644 --- a/backend/src/user/dto/create-user.dto.ts +++ b/backend/src/user/dto/create-user.dto.ts @@ -1 +1,14 @@ -export class CreateUserDto {} +import { ApiProperty } from '@nestjs/swagger'; + +export class CreateUserDto { + @ApiProperty() + email: string; + @ApiProperty() + name: string; + @ApiProperty() + lastName: string; + @ApiProperty() + password: string; + @ApiProperty() + birthdate: Date; +} -- GitLab From bdb6b44beea1ee2bfa0a4e0f014100be6976e0b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n?= <80365304+Diego-lvan@users.noreply.github.com> Date: Thu, 11 Apr 2024 10:04:13 -0600 Subject: [PATCH 08/14] agregando login user dto --- backend/src/auth/user/dto/login-user.dto.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 backend/src/auth/user/dto/login-user.dto.ts diff --git a/backend/src/auth/user/dto/login-user.dto.ts b/backend/src/auth/user/dto/login-user.dto.ts new file mode 100644 index 00000000..e9fec99c --- /dev/null +++ b/backend/src/auth/user/dto/login-user.dto.ts @@ -0,0 +1,8 @@ +import { ApiProperty } from '@nestjs/swagger'; + +export class LoginUserDto { + @ApiProperty() + email: string; + @ApiProperty() + password: string; +} -- GitLab From c905ef6c724067e7fceef7685cd6de45a501aa8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n?= <80365304+Diego-lvan@users.noreply.github.com> Date: Thu, 11 Apr 2024 10:05:14 -0600 Subject: [PATCH 09/14] agregando signin user dto --- backend/src/auth/user/dto/user-signin-res.dto.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 backend/src/auth/user/dto/user-signin-res.dto.ts diff --git a/backend/src/auth/user/dto/user-signin-res.dto.ts b/backend/src/auth/user/dto/user-signin-res.dto.ts new file mode 100644 index 00000000..4491c55b --- /dev/null +++ b/backend/src/auth/user/dto/user-signin-res.dto.ts @@ -0,0 +1,12 @@ +import { ApiProperty } from '@nestjs/swagger'; + +export class UserSigninResDto { + @ApiProperty() + email: string; + @ApiProperty() + name: string; + @ApiProperty() + lastName: string; + @ApiProperty() + token: string; +} -- GitLab From 86ad98282b9f9ea0646bf29704da4d14059ec9f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n?= <80365304+Diego-lvan@users.noreply.github.com> Date: Thu, 11 Apr 2024 10:05:53 -0600 Subject: [PATCH 10/14] agregando user controller --- backend/src/user/user.controller.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/backend/src/user/user.controller.ts b/backend/src/user/user.controller.ts index b890a0e6..ac921025 100644 --- a/backend/src/user/user.controller.ts +++ b/backend/src/user/user.controller.ts @@ -1,4 +1,4 @@ -import { Controller, Get, Post, Body, Param } from '@nestjs/common'; +import { Controller, Post, Body } from '@nestjs/common'; import { UserService } from './user.service'; import { CreateUserDto } from './dto/create-user.dto'; @@ -8,11 +8,10 @@ export class UserController { @Post() create(@Body() createUserDto: CreateUserDto) { - return this.userService.create(createUserDto); - } - - @Get(':id') - findOne(@Param('id') id: string) { - return this.userService.findOne(+id); + try { + return this.userService.create(createUserDto); + } catch (error) { + return error; + } } } -- GitLab From cd77dcf432e908426fe2ec8970a93a9a66270d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n?= <80365304+Diego-lvan@users.noreply.github.com> Date: Thu, 11 Apr 2024 10:06:37 -0600 Subject: [PATCH 11/14] agregando user auth service con login y signin --- backend/src/auth/user/authUserservice.ts | 56 ++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 backend/src/auth/user/authUserservice.ts diff --git a/backend/src/auth/user/authUserservice.ts b/backend/src/auth/user/authUserservice.ts new file mode 100644 index 00000000..b9cf9d7b --- /dev/null +++ b/backend/src/auth/user/authUserservice.ts @@ -0,0 +1,56 @@ +import { HttpException, HttpStatus, Injectable } from '@nestjs/common'; +import { JwtService } from '@nestjs/jwt'; +import { EncryptionService } from '../encryption/encryption.service'; +import { JwtConstants } from 'src/constants/jwt.constants'; +import { UserSigninResDto } from './dto/user-signin-res.dto'; +import { User } from 'src/user/entities/user.entity'; +import { UserService } from 'src/user/user.service'; +import { CreateUserDto } from 'src/user/dto/create-user.dto'; +import { LoginUserDto } from './dto/login-user.dto'; + +@Injectable() +export class AuthUserService { + constructor( + private userService: UserService, + private jwtService: JwtService, + private encryptionService: EncryptionService, + ) {} + + async signUp(createAdminDto: CreateUserDto): Promise { + const loginAdminDto: LoginUserDto = { + email: createAdminDto.email, + password: createAdminDto.password, + }; + const hashedPwd = await this.encryptionService.hashPassword( + createAdminDto.password, + ); + createAdminDto.password = hashedPwd; + await this.userService.create(createAdminDto); + + const adminSigninResDto: UserSigninResDto = + await this.signIn(loginAdminDto); + return adminSigninResDto.token; + } + + async signIn(logInAdmin: LoginUserDto): Promise { + const user: User = await this.userService.findOne(logInAdmin.email); + const validPwd: boolean = await this.encryptionService.comparePassword( + logInAdmin.password, + user.password, + ); + if (!validPwd) { + throw new HttpException('Invalid credentials', HttpStatus.UNAUTHORIZED); + } + const accessToken = await this.jwtService.sign( + { email: user.email, name: user.name, lastName: user.lastName }, + { secret: JwtConstants.SECRET }, + ); + const userSigninResDto: UserSigninResDto = { + email: user.email, + name: user.name, + lastName: user.lastName, + token: accessToken, + }; + return userSigninResDto; + } +} -- GitLab From 86e6f87495ec9c676923e71729d60782426815a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n?= <80365304+Diego-lvan@users.noreply.github.com> Date: Thu, 11 Apr 2024 10:08:19 -0600 Subject: [PATCH 12/14] agregando auth user controller con sign in y sign up --- backend/src/auth/user/authUsercontroller.ts | 50 +++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 backend/src/auth/user/authUsercontroller.ts diff --git a/backend/src/auth/user/authUsercontroller.ts b/backend/src/auth/user/authUsercontroller.ts new file mode 100644 index 00000000..dd4bd9aa --- /dev/null +++ b/backend/src/auth/user/authUsercontroller.ts @@ -0,0 +1,50 @@ +import { Body, Controller, Post } from '@nestjs/common'; +import { + ApiBearerAuth, + ApiBody, + ApiCreatedResponse, + ApiTags, + ApiUnauthorizedResponse, +} from '@nestjs/swagger'; +import { AuthUserService } from './authUserservice'; +import { CreateUserDto } from 'src/user/dto/create-user.dto'; +import { LoginUserDto } from './dto/login-user.dto'; + +@Controller('') +@ApiTags('Create user account and sign in as user') +export class AuthUserController { + constructor(private readonly authUserService: AuthUserService) {} + + @ApiBody({ type: CreateUserDto }) + @ApiBearerAuth() + @ApiCreatedResponse({ + content: { + 'application/json': { + example: { + token: 'token', + }, + }, + }, + }) + @Post('user/signup') + async signUp(@Body() createAdminDto: CreateUserDto) { + try { + const accessToken = await this.authUserService.signUp(createAdminDto); + return { token: accessToken }; + } catch (e) { + throw e; + } + } + @ApiBody({ type: LoginUserDto }) + @ApiUnauthorizedResponse() + @Post('user/signin') + async signIn(@Body() loginAdminDto: LoginUserDto) { + try { + const adminSigninResDto = + await this.authUserService.signIn(loginAdminDto); + return adminSigninResDto; + } catch (e) { + throw e; + } + } +} -- GitLab From 6da900ed415b38cef0da911d03139090accf72fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n?= <80365304+Diego-lvan@users.noreply.github.com> Date: Thu, 11 Apr 2024 10:09:09 -0600 Subject: [PATCH 13/14] agregando auth user module --- backend/src/auth/user/authUser.module.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 backend/src/auth/user/authUser.module.ts diff --git a/backend/src/auth/user/authUser.module.ts b/backend/src/auth/user/authUser.module.ts new file mode 100644 index 00000000..22ac1b09 --- /dev/null +++ b/backend/src/auth/user/authUser.module.ts @@ -0,0 +1,14 @@ +import { Module } from '@nestjs/common'; +import { EncryptionService } from '../encryption/encryption.service'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { JwtService } from '@nestjs/jwt'; +import { AuthUserController } from './authUsercontroller'; +import { UserService } from 'src/user/user.service'; +import { User } from 'src/user/entities/user.entity'; +import { AuthUserService } from './authUserservice'; +@Module({ + controllers: [AuthUserController], + providers: [UserService, JwtService, EncryptionService, AuthUserService], + imports: [TypeOrmModule.forFeature([User])], +}) +export class AuthUserModule {} -- GitLab From ba91f343b47c22fc84855904b9313928814a3a21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n?= <80365304+Diego-lvan@users.noreply.github.com> Date: Thu, 11 Apr 2024 10:10:05 -0600 Subject: [PATCH 14/14] eliminando la ruta base de auth admin controller --- backend/src/auth/admin/authAdmincontroller.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/backend/src/auth/admin/authAdmincontroller.ts b/backend/src/auth/admin/authAdmincontroller.ts index 526f6c8f..72f0c0a3 100644 --- a/backend/src/auth/admin/authAdmincontroller.ts +++ b/backend/src/auth/admin/authAdmincontroller.ts @@ -3,7 +3,6 @@ import { AuthAdminService } from './authAdminservice'; import { CreateAdminDto } from 'src/admin/dto/create-admin.dto'; import { LoginAdminDto } from 'src/auth/admin/dto/login-admin.dto'; import { - ApiBearerAuth, ApiBody, ApiCreatedResponse, ApiTags, @@ -11,13 +10,12 @@ import { } from '@nestjs/swagger'; import { AdminSigninResDto } from './dto/admin-signin-res.dto'; -@Controller('auth') +@Controller() @ApiTags('Create admin account and sign in as admin') export class AuthAdminController { constructor(private readonly authAdminService: AuthAdminService) {} @ApiBody({ type: CreateAdminDto }) - @ApiBearerAuth() @ApiCreatedResponse({ content: { 'application/json': { @@ -34,7 +32,7 @@ export class AuthAdminController { const accessToken = await this.authAdminService.signUp(createAdminDto); return { token: accessToken }; } catch (e) { - throw e; + return e; } } @ApiBody({ type: LoginAdminDto }) -- GitLab