You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2 KiB

import { Body, Controller, Delete, Get, Param, Patch, Post, Query } from '@nestjs/common';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { AuthUser, CurrentUser } from '../../common/current-user.decorator';
import { RequirePermissions } from '../../common/permissions.decorator';
import { RolesService } from './roles.service';
@ApiBearerAuth()
@ApiTags('角色权限')
@RequirePermissions('system:manage')
@Controller('roles')
export class RolesController {
constructor(private readonly rolesService: RolesService) {}
@Get()
findAll(@CurrentUser() user: AuthUser, @Query() query: any) {
return this.rolesService.findAll(user, query);
}
@Get('permissions')
permissions(@CurrentUser() user: AuthUser) {
return this.rolesService.permissions(user);
}
@Post()
create(@CurrentUser() user: AuthUser, @Body() dto: any) {
return this.rolesService.create(user, dto);
}
@Patch(':id')
update(@CurrentUser() user: AuthUser, @Param('id') id: string, @Body() dto: any) {
return this.rolesService.update(user, id, dto);
}
@Delete(':id')
remove(@CurrentUser() user: AuthUser, @Param('id') id: string) {
return this.rolesService.remove(user, id);
}
}