Add departmentSelfserveConditionsRoute and departmentSelfserveConditionRulesRoute with CRUD operations and department-level access control; update OpenAPI spec accordingly

This commit is contained in:
Jeppe Bundgaard
2026-01-09 12:36:32 +01:00
parent b4eda9ed9c
commit 3aefa4a00a
3 changed files with 835 additions and 0 deletions
+381
View File
@@ -1434,6 +1434,328 @@ paths:
'404':
$ref: '#/components/responses/NotFound'
/department/selfserve/conditions:
get:
tags:
- Self-Serve
summary: List self-serve conditions
description: Retrieve a list of self-serve conditions for a department, lane, or product.
operationId: listSelfserveConditions
parameters:
- name: id
in: query
description: Filter by condition ID
schema:
type: integer
- name: department
in: query
description: Filter by department ID
schema:
type: integer
- name: lane
in: query
description: Filter by lane ID
schema:
type: integer
- name: product
in: query
description: Filter by product ID
schema:
type: integer
- $ref: '#/components/parameters/PageParam'
- $ref: '#/components/parameters/PerPageParam'
- $ref: '#/components/parameters/SearchParam'
- $ref: '#/components/parameters/FiltersParam'
responses:
'200':
description: Successfully retrieved conditions
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/DepartmentSelfserveCondition'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
post:
tags:
- Self-Serve
summary: Add self-serve condition
description: Add a new self-serve condition.
operationId: addSelfserveCondition
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- department
- lane
- product
- name
- description
properties:
department:
type: integer
lane:
type: integer
product:
type: integer
name:
type: string
description:
type: string
responses:
'200':
description: Successfully added condition
content:
application/json:
schema:
$ref: '#/components/schemas/DepartmentSelfserveCondition'
'400':
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/InternalServerError'
put:
tags:
- Self-Serve
summary: Update self-serve condition
description: Update an existing self-serve condition.
operationId: updateSelfserveCondition
parameters:
- name: id
in: query
required: true
description: Condition ID
schema:
type: integer
requestBody:
content:
application/json:
schema:
type: object
properties:
department:
type: integer
lane:
type: integer
product:
type: integer
name:
type: string
description:
type: string
responses:
'200':
description: Successfully updated condition
content:
application/json:
schema:
$ref: '#/components/schemas/DepartmentSelfserveCondition'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalServerError'
delete:
tags:
- Self-Serve
summary: Delete self-serve condition
description: Delete a self-serve condition.
operationId: deleteSelfserveCondition
parameters:
- name: id
in: query
required: true
description: Condition ID
schema:
type: integer
responses:
'200':
description: Successfully deleted condition
content:
application/json:
schema:
type: string
example: Condition deleted
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
/department/selfserve/condition/rules:
get:
tags:
- Self-Serve
summary: List self-serve condition rules
description: Retrieve a list of self-serve condition rules.
operationId: listSelfserveConditionRules
parameters:
- name: id
in: query
description: Filter by rule ID
schema:
type: integer
- name: condition_id
in: query
description: Filter by condition ID
schema:
type: integer
- name: type
in: query
description: Filter by rule type
schema:
type: string
- name: object_type
in: query
description: Filter by object type
schema:
type: string
- name: object_id
in: query
description: Filter by object ID
schema:
type: integer
- $ref: '#/components/parameters/PageParam'
- $ref: '#/components/parameters/PerPageParam'
- $ref: '#/components/parameters/SearchParam'
- $ref: '#/components/parameters/FiltersParam'
responses:
'200':
description: Successfully retrieved condition rules
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/DepartmentSelfserveConditionRule'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
post:
tags:
- Self-Serve
summary: Add self-serve condition rule
description: Add a new self-serve condition rule.
operationId: addSelfserveConditionRule
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- condition_id
- type
- object_type
- object_id
- name
- description
properties:
condition_id:
type: integer
type:
type: string
object_type:
type: string
object_id:
type: integer
name:
type: string
description:
type: string
responses:
'200':
description: Successfully added condition rule
content:
application/json:
schema:
$ref: '#/components/schemas/DepartmentSelfserveConditionRule'
'400':
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/InternalServerError'
put:
tags:
- Self-Serve
summary: Update self-serve condition rule
description: Update an existing self-serve condition rule.
operationId: updateSelfserveConditionRule
parameters:
- name: id
in: query
required: true
description: Rule ID
schema:
type: integer
requestBody:
content:
application/json:
schema:
type: object
properties:
condition_id:
type: integer
type:
type: string
object_type:
type: string
object_id:
type: integer
name:
type: string
description:
type: string
responses:
'200':
description: Successfully updated condition rule
content:
application/json:
schema:
$ref: '#/components/schemas/DepartmentSelfserveConditionRule'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalServerError'
delete:
tags:
- Self-Serve
summary: Delete self-serve condition rule
description: Delete a self-serve condition rule.
operationId: deleteSelfserveConditionRule
parameters:
- name: id
in: query
required: true
description: Rule ID
schema:
type: integer
responses:
'200':
description: Successfully deleted condition rule
content:
application/json:
schema:
type: string
example: Rule deleted
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
/department/selfserve/tasks:
get:
tags:
@@ -4719,6 +5041,65 @@ components:
type: string
format: date-time
DepartmentSelfserveCondition:
type: object
properties:
id:
type: integer
description: Condition ID
department:
type: integer
description: Department ID
lane:
type: integer
description: Lane ID
product:
type: integer
description: Product ID
name:
type: string
description: Condition name
description:
type: string
description: Condition description
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
DepartmentSelfserveConditionRule:
type: object
properties:
id:
type: integer
description: Rule ID
condition_id:
type: integer
description: Condition object ID
type:
type: string
description: Condition type (e.g., IS_TRUE, IS_FALSE)
object_type:
type: string
description: The object type to which the condition applies (e.g., question, task, etc.)
object_id:
type: integer
description: The object id to which the condition applies
name:
type: string
description: Condition name
description:
type: string
description: Condition description
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
OrderCreate:
type: object
required: