Add support for archived departments with schema updates, API integration, and filtering logic

- Added `archived` column and index to `departments` table, ensuring schema initialization via `departments_schema_bootstrap`.
- Updated OpenAPI spec to include `archived` attribute and `filters=archived` query parameter with superuser access control.
- Enhanced `Departments` API to support archived department filtering and retrieval.
- Modified `ApiFixtures`, `departments_o`, and related tests to validate behavior for archived departments.
- Added unit and API tests to ensure correct handling of archived departments and filter enforceability.
This commit is contained in:
Jeppe Bundgaard
2026-05-07 13:50:32 +02:00
parent a4c2b4e95a
commit 0cbc3e9aa5
8 changed files with 295 additions and 7 deletions
+12 -1
View File
@@ -3395,7 +3395,7 @@ paths:
tags:
- Departments
summary: List departments
description: Retrieve a list of all visible departments
description: Retrieve visible, active departments by default. Superuser department access may filter archived departments with `filters=archived:1`.
operationId: listDepartments
parameters:
- name: id
@@ -3406,6 +3406,11 @@ paths:
- $ref: '#/components/parameters/PageParam'
- $ref: '#/components/parameters/PerPageParam'
- $ref: '#/components/parameters/SearchParam'
- name: filters
in: query
schema:
type: string
description: Comma-separated field filters. `archived:1` is only honored for users with superuser department access.
responses:
'200':
description: Departments retrieved successfully
@@ -15607,6 +15612,8 @@ components:
type: integer
visible:
type: boolean
archived:
type: boolean
dimension:
type: integer
branding:
@@ -15677,6 +15684,8 @@ components:
type: integer
visible:
type: boolean
archived:
type: boolean
longitude:
type: number
format: float
@@ -15697,6 +15706,8 @@ components:
type: string
visible:
type: boolean
archived:
type: boolean
longitude:
type: number
format: float