feat(freight:backoffice): migrated smart-office user-management

This commit is contained in:
Michael Abebe
2026-05-26 12:50:40 +03:00
parent a8d26b73b8
commit b487d47055
9 changed files with 2350 additions and 15 deletions

View File

@@ -0,0 +1,41 @@
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,
);
}
}