Files
team-planner/backend/src/team/roles.controller.ts
2026-01-15 00:18:35 +03:00

50 lines
1.0 KiB
TypeScript

import {
Controller,
Get,
Post,
Patch,
Delete,
Body,
Param,
ParseUUIDPipe,
HttpCode,
HttpStatus,
} from '@nestjs/common';
import { RolesService } from './roles.service';
import { CreateRoleDto } from './dto/create-role.dto';
import { UpdateRoleDto } from './dto/update-role.dto';
@Controller('api/roles')
export class RolesController {
constructor(private readonly rolesService: RolesService) {}
@Get()
findAll() {
return this.rolesService.findAll();
}
@Get(':id')
findOne(@Param('id', ParseUUIDPipe) id: string) {
return this.rolesService.findOne(id);
}
@Post()
create(@Body() createDto: CreateRoleDto) {
return this.rolesService.create(createDto);
}
@Patch(':id')
update(
@Param('id', ParseUUIDPipe) id: string,
@Body() updateDto: UpdateRoleDto,
) {
return this.rolesService.update(id, updateDto);
}
@Delete(':id')
@HttpCode(HttpStatus.NO_CONTENT)
remove(@Param('id', ParseUUIDPipe) id: string) {
return this.rolesService.remove(id);
}
}