45 lines
946 B
TypeScript
45 lines
946 B
TypeScript
import {
|
|
Controller,
|
|
Get,
|
|
Post,
|
|
Body,
|
|
Patch,
|
|
Param,
|
|
Delete,
|
|
Query,
|
|
} from '@nestjs/common';
|
|
import { RoleService } from './role.service';
|
|
import { CreateRoleDto } from './dto/create-role.dto';
|
|
import { UpdateRoleDto } from './dto/update-role.dto';
|
|
import { QueryListDto } from './dto/query-list.dto';
|
|
|
|
@Controller()
|
|
export class RoleController {
|
|
constructor(private readonly roleService: RoleService) {}
|
|
|
|
@Post()
|
|
create(@Body() dto: CreateRoleDto) {
|
|
return this.roleService.create(dto);
|
|
}
|
|
|
|
@Get()
|
|
findPage(@Query() dto: QueryListDto): Promise<QueryListResult> {
|
|
return this.roleService.findPage(dto);
|
|
}
|
|
|
|
@Get('/all')
|
|
findAll() {
|
|
return this.roleService.findAll();
|
|
}
|
|
|
|
@Patch(':id')
|
|
update(@Param('id') id: string, @Body() dto: UpdateRoleDto) {
|
|
return this.roleService.update(+id, dto);
|
|
}
|
|
|
|
@Delete(':id')
|
|
remove(@Param('id') id: string) {
|
|
return this.roleService.remove(+id);
|
|
}
|
|
}
|