Skip to content

Commit

Permalink
Merge pull request #12 from fga-eps-mds/feat#71/gerenciar-roles
Browse files Browse the repository at this point in the history
feat(#71): Alteracao nos endpoints de gerenciamento de roles
  • Loading branch information
paulohgontijoo authored Jul 31, 2024
2 parents daec785 + 8b99e35 commit d30f7da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.useGlobalPipes(new ValidationPipe());
app.enableCors({
origin: configService.get('FRONTEND_URL'),
origin: ['http://localhost:3001'],
credentials: true,
methods: ['GET', 'POST', 'PUT', 'DELETE'],
methods: ['GET', 'POST', 'PATCH', 'PUT', 'DELETE'],
allowedHeaders: ['Content-Type', 'Authorization'],
});
await app.listen(configService.get('PORT'));
Expand Down
12 changes: 6 additions & 6 deletions src/users/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ export class UsersController {
};
}

@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(UserRole.ADMIN)
//@UseGuards(JwtAuthGuard, RolesGuard)
//@Roles(UserRole.ADMIN)
@Get()
async getUsers() {
return await this.usersService.getUsers();
}

@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(UserRole.ADMIN)
//@UseGuards(JwtAuthGuard, RolesGuard)
//@Roles(UserRole.ADMIN)
@Get('/:id')
async getUserById(@Param('id') id: string) {
try {
Expand All @@ -81,8 +81,8 @@ export class UsersController {
}
}

@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(UserRole.ADMIN)
//@UseGuards(JwtAuthGuard, RolesGuard)
//@Roles(UserRole.ADMIN)
@Patch('/:id/role')
async updateUserRole(
@Param('id') id: string,
Expand Down

0 comments on commit d30f7da

Please sign in to comment.