Skip to content

Entities and departments API ​

Implementation: front/src/services/api/entityService.ts. Entity and department interfaces in that module document fields expected by the frontend, not the complete backend schema.

Entities ​

GET /entities ​

  • Called from: Department Management and Create/Edit User workflows.
  • Response expected: ApiResponse<Entity[]>.
  • Example: GET {VITE_API_BASE_URL}/entities

GET /entities/:id ​

  • Called from: getEntityById; Edit Lease resolves the selected entity.
  • Path: id string.
  • Response expected: ApiResponse<Entity>.
  • Example: GET {VITE_API_BASE_URL}/entities/{id}

POST /entities ​

  • Called from: Department Management entity create.
  • Body: EntityCreateData (name, optional description).
  • Response expected: ApiResponse<Entity>.
  • Example: POST {VITE_API_BASE_URL}/entities with EntityCreateData.

PUT /entities/:id ​

  • Called from: Department Management entity edit.
  • Path: id string.
  • Body: EntityUpdateData (optional name, description).
  • Response expected: ApiResponse<Entity>.
  • Example: PUT {VITE_API_BASE_URL}/entities/{id} with partial entity data.

DELETE /entities/:id ​

  • Called from: Department Management delete entity.
  • Path: id string.
  • Response expected: ApiResponse<{ success: boolean }> .
  • Example: DELETE {VITE_API_BASE_URL}/entities/{id}

Departments ​

GET /departments ​

  • Called from: Department Management; service supports optional entity filter.
  • Query: optional entityId.
  • Response expected: ApiResponse<Department[]>.
  • Example: GET {VITE_API_BASE_URL}/departments?entityId={entityId}

GET /departments/entity/:entityId ​

  • Called from: Create/Edit User entity selection.
  • Path: entityId string.
  • Response expected: ApiResponse<Department[]>.
  • Example: GET {VITE_API_BASE_URL}/departments/entity/{entityId}

GET /departments/:id ​

  • Called from: Edit Lease related-data resolution.
  • Path: id string.
  • Response expected: ApiResponse<Department>.
  • Example: GET {VITE_API_BASE_URL}/departments/{id}

POST /departments ​

  • Called from: Department Management department create.
  • Body: DepartmentCreateData (name, entityId, optional description).
  • Response expected: ApiResponse<Department>.
  • Example: POST {VITE_API_BASE_URL}/departments with DepartmentCreateData.

PUT /departments/:id ​

  • Called from: Department Management department edit.
  • Path: id string.
  • Body: DepartmentUpdateData (optional name, description).
  • Response expected: ApiResponse<Department>.
  • Example: PUT {VITE_API_BASE_URL}/departments/{id} with partial department data.

DELETE /departments/:id ​

  • Called from: Department Management delete department.
  • Path: id string.
  • Response expected: ApiResponse<{ success: boolean }> .
  • Example: DELETE {VITE_API_BASE_URL}/departments/{id}

For every endpoint, service methods log and rethrow failures. The shared client handles 401 centrally; exact other status codes and server authorization are not available from frontend source.