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

69 lines
1.7 KiB
YAML
Raw Normal View History

get:
tags: [Master data]
summary: List departments
description: Returns every department row.
operationId: get-api-departments
responses:
"200":
description: Department list.
content:
application/json:
schema:
type: object
required: [items]
properties:
items:
type: array
items:
$ref: ../components/schemas.yaml#/Department
"401":
description: Missing session.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
post:
tags: [Master data]
summary: Create a department
description: Admin-only insert. Requires admin:settings.
operationId: post-api-departments
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [code, name]
properties:
code:
type: string
example: FIN
name:
type: string
example: Finance
responses:
"201":
description: Created department.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Department
"400":
description: Validation failed.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
"401":
description: Missing session.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
"403":
description: Caller lacks admin:settings.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error