seahaven-ap/packages/api/openapi/paths/departments-id.yaml

82 lines
2 KiB
YAML

parameters:
- name: id
in: path
required: true
description: Department primary key.
schema:
type: string
format: uuid
example: 77777777-7777-4777-8777-777777777777
get:
tags: [Master data]
summary: Get a department
description: Returns one department by id.
operationId: get-api-departments-id
responses:
"200":
description: Department.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Department
"400":
description: Invalid id.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
"401":
description: Missing session.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
"404":
description: Department not found.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
patch:
tags: [Master data]
summary: Update a department
description: Admin-only patch. Requires admin:settings.
operationId: patch-api-departments-id
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
code:
type: string
example: OPS
name:
type: string
example: Operations
responses:
"200":
description: Updated department.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Department
"400":
description: Validation failed.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
"403":
description: Caller lacks admin:settings.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
"404":
description: Department not found.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error