Commit f3ef51ad authored by Diego Iván's avatar Diego Iván
Browse files

agregando ruta de login de admins

parent 594a1b8a
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -7,7 +7,9 @@ import {
  ApiBody,
  ApiCreatedResponse,
  ApiTags,
  ApiUnauthorizedResponse,
} from '@nestjs/swagger';
import { AdminSigninResDto } from './dto/admin-signin-res.dto';

@Controller('auth')
@ApiTags('Create admin account and sign in as admin')
@@ -32,17 +34,22 @@ export class AuthAdminController {
      const accessToken = await this.authAdminService.signUp(createAdminDto);
      return { token: accessToken };
    } catch (e) {
      console.log(e);
      throw e;
    }
  }

  @ApiBody({ type: LoginAdminDto })
  @ApiCreatedResponse({
    type: AdminSigninResDto,
  })
  @ApiUnauthorizedResponse()
  @Post('admin/signin')
  async signIn(@Body() loginAdminDto: LoginAdminDto) {
    try {
      const accessToken = await this.authAdminService.signIn(loginAdminDto);
      return { token: accessToken };
      const adminSigninResDto =
        await this.authAdminService.signIn(loginAdminDto);
      return adminSigninResDto;
    } catch (e) {
      console.log(e);
      throw e;
    }
  }
}