feat: 调整项目层级
This commit is contained in:
30
server/src/modules/system/auth/auth.controller.ts
Normal file
30
server/src/modules/system/auth/auth.controller.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Controller, Post, Body, Param } from '@nestjs/common';
|
||||
import { AuthService } from './auth.service';
|
||||
import { AuthDto } from './dto/auth.dto';
|
||||
import { SkipAuth } from '@/common/decorators/skip-auth.decorator';
|
||||
import { UserRoleDto } from './dto/user-role.dto';
|
||||
import { RolePermissionDto } from './dto/role-permission.dto';
|
||||
|
||||
@Controller()
|
||||
export class AuthController {
|
||||
constructor(private readonly authService: AuthService) {}
|
||||
|
||||
// 用户登录
|
||||
@Post('login')
|
||||
@SkipAuth()
|
||||
signIn(@Body() authDto: AuthDto) {
|
||||
return this.authService.signIn(authDto);
|
||||
}
|
||||
|
||||
// 授权用户角色
|
||||
@Post('userRole/:id')
|
||||
grantUserRole(@Param('id') id: string, @Body() dto: UserRoleDto) {
|
||||
return this.authService.grantUserRole(+id, dto);
|
||||
}
|
||||
|
||||
// 授权角色权限
|
||||
@Post('rolePermission/:id')
|
||||
grantRolePermission(@Param('id') id: string, @Body() dto: RolePermissionDto) {
|
||||
return this.authService.grantRolePermission(+id, dto);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user