import { Body, Controller, Get, Param, ParseUUIDPipe, Put, } from "@nestjs/common"; import { ApiOperation, ApiTags } from "@nestjs/swagger"; import { BackofficeService } from "./backoffice.service"; import { UpdateEmployeeUserRolesDto } from "./dto/update-employee-user-roles.dto"; @ApiTags("backoffice") @Controller("backoffice") export class BackofficeController { constructor(private readonly backofficeService: BackofficeService) {} @Get("organizations/:orgId/employee-users/:userId/roles") @ApiOperation({ summary: "Get org-scoped roles assigned to an employee user" }) getEmployeeUserRoles( @Param("orgId", ParseUUIDPipe) organizationId: string, @Param("userId", ParseUUIDPipe) userId: string, ) { return this.backofficeService.getEmployeeUserRoles(organizationId, userId); } @Put("organizations/:orgId/employee-users/:userId/roles") @ApiOperation({ summary: "Replace org-scoped roles assigned to an employee user" }) replaceEmployeeUserRoles( @Param("orgId", ParseUUIDPipe) organizationId: string, @Param("userId", ParseUUIDPipe) userId: string, @Body() dto: UpdateEmployeeUserRolesDto, ) { return this.backofficeService.replaceEmployeeUserRoles( organizationId, userId, dto.roleIds, ); } }