Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
220 changes: 220 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ tags:
description: The primary organisational unit — every Story and Case belongs to a Project
- name: Welcome Tours
description: Guided tours of Makerble's own pages for new colleagues; Organisation Admins choose each team's stops, wording and how strict they are, and see who has finished
- name: Staff Unavailability
description: When colleagues can't work for an Organisation (leave, sickness, training), as on the Staff availability page
- name: Training Materials
description: An Organisation's links to its own training documents and videos, each shown to the whole Organisation or to chosen Teams and Workspaces
- name: Announcements
Expand Down Expand Up @@ -1286,6 +1288,163 @@ paths:
$ref: '#/components/responses/NotFound'
"422":
$ref: '#/components/responses/UnprocessableEntityList'
/users/{user_id}/unavailabilities:
parameters:
- name: user_id
in: path
required: true
description: The colleague (User) whose unavailability this is
schema:
type: integer
- name: charity_id
in: query
required: true
description: The Organisation (Charity). A colleague in several Organisations has separate unavailability in each.
schema:
type: integer
get:
tags: [Staff Unavailability]
summary: List a colleague's unavailability
description: |
The dates and times a colleague can't work for an Organisation (annual leave, sick leave, training or other),
as on their Unavailability page, oldest first. Anyone can list their own. Team Leaders can list the colleagues
in their Team, Project Editors the colleagues in their Project, and Charity Editors everyone in the Organisation;
anyone else gets 403. `private_note` is returned only to the colleague themselves and to Charity Editors.
operationId: listUserUnavailabilities
security: [{tokenAuth: []}]
parameters:
- $ref: '#/components/parameters/Page'
- $ref: '#/components/parameters/PerPage'
- $ref: '#/components/parameters/LastSyncDatetime'
responses:
"200":
description: A page of unavailability ranges, oldest first
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/PaginationEnvelope'
- type: object
properties:
data:
type: array
items: { $ref: '#/components/schemas/Unavailability' }
"401":
$ref: '#/components/responses/Unauthorized'
"403":
$ref: '#/components/responses/ForbiddenError'
"404":
$ref: '#/components/responses/NotFound'
post:
tags: [Staff Unavailability]
summary: Record when a colleague is unavailable
description: |
Records one range when the colleague can't work: whole days (`all_day`, the default) from `from_date` to
`to_date`, or part of a day with `from_time` and `to_time`, in the Organisation's timezone. Makerble won't then
assign them to events automatically at those times. The same people as for listing may do this.

If the colleague is already an Event Worker on upcoming events during the range, they are listed in
`conflicting_events`. To take the colleague off some of them in the same call, send their ids in
`unassign_event_ids`; only events the caller may edit (`editable`) are changed. Each affected event's Event
Managers are emailed either way, saying whether the colleague was unassigned.
operationId: createUserUnavailability
security: [{tokenAuth: []}]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UnavailabilityInput'
example:
from_date: '2026-12-03'
to_date: '2026-12-03'
all_day: false
from_time: '13:00'
to_time: '17:30'
reason_type: training
private_note: Safeguarding refresher
unassign_event_ids: [5012]
responses:
"201":
description: The range recorded, with the events it clashes with
content:
application/json:
schema:
$ref: '#/components/schemas/UnavailabilityWithConflicts'
"401":
$ref: '#/components/responses/Unauthorized'
"403":
$ref: '#/components/responses/ForbiddenError'
"404":
$ref: '#/components/responses/NotFound'
"422":
$ref: '#/components/responses/UnprocessableEntityList'
/users/{user_id}/unavailabilities/{id}:
parameters:
- name: user_id
in: path
required: true
schema:
type: integer
- name: id
in: path
required: true
description: The unavailability range
schema:
type: integer
- name: charity_id
in: query
required: true
description: The Organisation (Charity)
schema:
type: integer
patch:
tags: [Staff Unavailability]
summary: Change when a colleague is unavailable
description: |
Changes only the fields sent. If the dates or times change, events the colleague is already working during the
new range are returned in `conflicting_events`, and `unassign_event_ids` works as when recording a range. A Team
Leader or Project Editor can't see or change the private note.
operationId: updateUserUnavailability
security: [{tokenAuth: []}]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UnavailabilityInput'
example:
to_date: '2026-12-05'
responses:
"200":
description: The range, with the events it clashes with
content:
application/json:
schema:
$ref: '#/components/schemas/UnavailabilityWithConflicts'
"401":
$ref: '#/components/responses/Unauthorized'
"403":
$ref: '#/components/responses/ForbiddenError'
"404":
$ref: '#/components/responses/NotFound'
"422":
$ref: '#/components/responses/UnprocessableEntityList'
delete:
tags: [Staff Unavailability]
summary: Remove a range of unavailability
description: Removes the range. Events the colleague was taken off are not changed back.
operationId: deleteUserUnavailability
security: [{tokenAuth: []}]
responses:
"204":
description: Removed
"401":
$ref: '#/components/responses/Unauthorized'
"403":
$ref: '#/components/responses/ForbiddenError'
"404":
$ref: '#/components/responses/NotFound'
/organisations/{organisation_id}/training_materials:
parameters:
- name: organisation_id
Expand Down Expand Up @@ -16231,6 +16390,67 @@ components:
owner_id:
type: integer
description: The person to ask about it. An Organisation Admin of the Organisation, or the caller.
Unavailability:
type: object
description: A range when a colleague can't work for an Organisation (Staff availability page)
properties:
id: { type: integer }
user_id: { type: integer }
charity_id: { type: integer }
starts_at: { type: string, format: date-time }
ends_at:
type: string
format: date-time
description: For an all-day range, the end of `to_date` in the Organisation's timezone
all_day: { type: boolean }
from_date: { type: string, format: date, description: In the Organisation's timezone }
to_date: { type: string, format: date }
from_time: { type: string, nullable: true, description: 'HH:MM, or null for an all-day range' }
to_time: { type: string, nullable: true }
timezone: { type: string, example: Europe/London }
reason_type: { type: string, enum: [annual_leave, sick_leave, training, other] }
reason_label: { type: string, example: Annual leave }
summary: { type: string, example: '3/12/2026 13:00–17:30 · Training' }
private_note:
type: string
nullable: true
description: Only returned to the colleague themselves and to Charity Editors
created_at: { type: string, format: date-time }
updated_at: { type: string, format: date-time }
UnavailabilityInput:
type: object
properties:
from_date: { type: string, format: date }
to_date: { type: string, format: date }
all_day: { type: boolean, default: true }
from_time: { type: string, description: 'HH:MM, for a part day' }
to_time: { type: string, description: 'HH:MM, for a part day' }
reason_type: { type: string, enum: [annual_leave, sick_leave, training, other] }
private_note: { type: string, maxLength: 150 }
unassign_event_ids:
type: array
items: { type: integer }
description: Events from `conflicting_events` to take the colleague off in the same call
UnavailabilityWithConflicts:
allOf:
- $ref: '#/components/schemas/Unavailability'
- type: object
properties:
conflicting_events:
type: array
description: Upcoming events the colleague is an Event Worker on during this range
items:
type: object
properties:
id: { type: integer }
name: { type: string }
start_datetime: { type: string, format: date-time }
end_datetime: { type: string, format: date-time }
event_category_name: { type: string, nullable: true, description: The Event Format }
project_id: { type: integer }
project_name: { type: string, nullable: true }
editable: { type: boolean, description: Whether the caller may edit the event, and so unassign the colleague }
unassigned: { type: boolean, description: Whether this call took the colleague off the event }
TrainingMaterial:
type: object
description: A link to one of an Organisation's own training documents or videos, and who it is for
Expand Down
51 changes: 51 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,7 @@ function buildDocsPage() {
<div class="nav-section-label">Events</div>
<a href="#events" class="nav-link"><span class="nav-method method-GET">GET</span>Events</a>
<a href="#event-formats" class="nav-link"><span class="nav-method method-GET">GET</span>Event Formats</a>
<a href="#staff-unavailability" class="nav-link"><span class="nav-method method-POST">POST</span>Staff Unavailability</a>
</div>
<div class="nav-section">
<div class="nav-section-label">Site content</div>
Expand Down Expand Up @@ -3784,6 +3785,56 @@ function buildDocsPage() {
</section>

<!-- Event Formats -->
<section class="section" id="staff-unavailability">
<div class="section-eyebrow">Events</div>
<h2 class="section-title">Staff Unavailability</h2>
<div class="section-desc">
<p>Record when a colleague can't work for an Organisation: annual leave, sick leave, training or anything else, for whole days or part of a day. It appears on the Staff availability page. Makerble won't assign someone to an event automatically while they're unavailable, and warns when someone tries to assign them by hand. Dates and times are in the Organisation's timezone, and a colleague in several Organisations has separate unavailability in each, so every call takes <code>charity_id</code>.</p>
<p>Anyone can see and change their own. Team Leaders can see and change it for their Team, Project Editors for the colleagues in their Project, and Organisation Admins (Charity Editors) for everyone in the Organisation. Anyone else gets <code>403</code>. <code>private_note</code> is returned only to the colleague themselves and to Organisation Admins, because sick leave reasons are health information.</p>
<p>When a new or changed range overlaps upcoming events the colleague is already an Event Worker on, the response lists them in <code>conflicting_events</code>, each saying whether you may edit it. Send the ids you want them taken off in <code>unassign_event_ids</code> in the same call. Each affected event's Event Managers are emailed either way.</p>
</div>
<div class="endpoint-list">
${endpointCard("GET", "/users/{user_id}/unavailabilities", "List a colleague's unavailability", true, [
{ name: "user_id", in: "path", type: "integer", required: true, desc: "The colleague (User)" },
{ name: "charity_id", type: "integer", required: true, desc: "Organisation ID" },
{ name: "page", type: "integer", required: false, desc: "Page number" },
{ name: "per_page", type: "integer", required: false, desc: "Records per page (default 10, max 200)" },
{ name: "last_synced_datetime", type: "string", required: false, desc: "ISO 8601 incremental sync" }
], [
{ code: "200", cls: "response-2xx", desc: "Paginated ranges, oldest first" },
{ code: "403", cls: "response-4xx", desc: "You can't see this colleague's unavailability" },
{ code: "404", cls: "response-4xx", desc: "Organisation not found" }
])}
${endpointCard("POST", "/users/{user_id}/unavailabilities", "Record when a colleague is unavailable", true, [
{ name: "user_id", in: "path", type: "integer", required: true, desc: "The colleague (User)" },
{ name: "charity_id", type: "integer", required: true, desc: "Organisation ID" }
], [
{ code: "201", cls: "response-2xx", desc: "The range, with conflicting_events" },
{ code: "403", cls: "response-4xx", desc: "You can't change this colleague's unavailability" },
{ code: "422", cls: "response-4xx", desc: "Validation failed, e.g. To is not after From, or no type" }
], "Body: <code>from_date</code>, <code>to_date</code>, <code>all_day</code> (default true), <code>from_time</code> and <code>to_time</code> (HH:MM, for part of a day), <code>reason_type</code> (<code>annual_leave</code>, <code>sick_leave</code>, <code>training</code> or <code>other</code>), <code>private_note</code> (up to 150 characters), <code>unassign_event_ids</code>.")}
${endpointCard("PATCH", "/users/{user_id}/unavailabilities/{id}", "Change when a colleague is unavailable", true, [
{ name: "user_id", in: "path", type: "integer", required: true, desc: "The colleague (User)" },
{ name: "id", in: "path", type: "integer", required: true, desc: "The range" },
{ name: "charity_id", type: "integer", required: true, desc: "Organisation ID" }
], [
{ code: "200", cls: "response-2xx", desc: "The range, with conflicting_events if its dates or times changed" },
{ code: "403", cls: "response-4xx", desc: "You can't change this colleague's unavailability" },
{ code: "404", cls: "response-4xx", desc: "Not found" },
{ code: "422", cls: "response-4xx", desc: "Validation failed" }
], "Only the fields sent change. A Team Leader or Project Editor can't change the private note.")}
${endpointCard("DELETE", "/users/{user_id}/unavailabilities/{id}", "Remove a range of unavailability", true, [
{ name: "user_id", in: "path", type: "integer", required: true, desc: "The colleague (User)" },
{ name: "id", in: "path", type: "integer", required: true, desc: "The range" },
{ name: "charity_id", type: "integer", required: true, desc: "Organisation ID" }
], [
{ code: "204", cls: "response-2xx", desc: "Removed. Events the colleague was taken off are not changed back" },
{ code: "403", cls: "response-4xx", desc: "You can't change this colleague's unavailability" },
{ code: "404", cls: "response-4xx", desc: "Not found" }
])}
</div>
</section>

<section class="section" id="event-formats">
<div class="section-eyebrow">Events</div>
<h2 class="section-title">Event Formats</h2>
Expand Down
Loading