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
65 changes: 48 additions & 17 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2445,12 +2445,16 @@ paths:
A colleague's capacity caps in one Organisation, and how much they have taken on, as in the
**Edit capacity** popup on the Staff availability page.

- `max_per_day` and `max_per_week` cap their appointments; `max_one_to_one_contacts` caps the
Contacts who have an upcoming one-to-one appointment with them. `null` means no limit.
- An **appointment** is an event whose Event Format has an `appointment_type`, where the
colleague is an Event Worker. `usage` counts them for today and this week (Monday to
Sunday) in the Organisation's timezone, and counts their ongoing one-to-one Contacts: the
distinct guests of their upcoming one-to-one appointments.
- **Sessions** are every event in the Organisation where the colleague is an Event Worker, group
or appointment. `max_sessions_per_day` and `max_sessions_per_week` cap them.
- An **appointment** is a session whose Event Format has the Appointment type
(`appointment_type: one_to_one`). An appointment can have more than one staff member: it counts
once for each of its Event Workers. `max_per_day` and `max_per_week` cap appointments, and
`max_one_to_one_contacts` caps the Contacts who have an upcoming appointment with them.
- `null` means no limit. A colleague is fully booked on a day when they reach either cap.
- `usage` counts sessions and appointments for today and this week (Monday to Sunday) in the
Organisation's timezone, and counts their ongoing appointment Contacts: the distinct guests
of their upcoming appointments.
- Anyone who sees the colleague on Staff availability can read this: the colleague themselves,
their Team Leaders, Project Editors of their Projects and Organisation Admins. Anyone else in
the Organisation gets `403`; an Organisation you aren't in returns `404`.
Expand All @@ -2466,11 +2470,15 @@ paths:
example:
user_id: 812
charity_id: 123
max_sessions_per_day: 6
max_sessions_per_week: 20
max_per_day: 4
max_per_week: 15
max_one_to_one_contacts: 12
can_edit: true
usage:
sessions_today: 3
sessions_this_week: 14
appointments_today: 2
appointments_this_week: 11
ongoing_one_to_one_contacts: 9
Expand Down Expand Up @@ -2505,6 +2513,14 @@ paths:
schema:
type: object
properties:
max_sessions_per_day:
type: integer
nullable: true
description: Maximum sessions (group or appointment) a day
max_sessions_per_week:
type: integer
nullable: true
description: Maximum sessions (group or appointment) a week
max_per_day:
type: integer
nullable: true
Expand All @@ -2516,8 +2532,9 @@ paths:
max_one_to_one_contacts:
type: integer
nullable: true
description: Maximum ongoing one-to-one Contacts
description: Maximum ongoing Contacts with appointments
example:
max_sessions_per_day: 6
max_per_day: 4
max_per_week: null
max_one_to_one_contacts: 12
Expand Down Expand Up @@ -10445,8 +10462,8 @@ paths:
when `allow_guests_to_cancel` is true, and must be one of `guest_status_ids`.

**Appointment settings** (all optional):
- `appointment_type`: `one_to_one`, `group`, or `null` for "Not an appointment" (the default).
One-to-one appointments have one guest.
- `appointment_type`: `one_to_one` (shown as "Appointment": one Contact, with one or more staff members), `group`, or `null` for "Not an appointment" (the default).
An appointment is with one Contact, and can have more than one staff member.
- `default_length_minutes`: how long an event of this format usually lasts, in 5-minute
steps up to 1440, or `null`.
- `preparation_minutes` and `debrief_minutes`: time a colleague needs before and after
Expand Down Expand Up @@ -10510,8 +10527,8 @@ paths:
read it; an Event Format of an organisation you are not in returns `404`.

**Appointment settings** (all optional):
- `appointment_type`: `one_to_one`, `group`, or `null` for "Not an appointment" (the default).
One-to-one appointments have one guest.
- `appointment_type`: `one_to_one` (shown as "Appointment": one Contact, with one or more staff members), `group`, or `null` for "Not an appointment" (the default).
An appointment is with one Contact, and can have more than one staff member.
- `default_length_minutes`: how long an event of this format usually lasts, in 5-minute
steps up to 1440, or `null`.
- `preparation_minutes` and `debrief_minutes`: time a colleague needs before and after
Expand Down Expand Up @@ -10585,8 +10602,8 @@ paths:
turning `allow_guests_to_cancel` off.

**Appointment settings** (all optional):
- `appointment_type`: `one_to_one`, `group`, or `null` for "Not an appointment" (the default).
One-to-one appointments have one guest.
- `appointment_type`: `one_to_one` (shown as "Appointment": one Contact, with one or more staff members), `group`, or `null` for "Not an appointment" (the default).
An appointment is with one Contact, and can have more than one staff member.
- `default_length_minutes`: how long an event of this format usually lasts, in 5-minute
steps up to 1440, or `null`.
- `preparation_minutes` and `debrief_minutes`: time a colleague needs before and after
Expand Down Expand Up @@ -33035,6 +33052,14 @@ components:
type: integer
charity_id:
type: integer
max_sessions_per_day:
type: integer
nullable: true
description: Maximum sessions (every event they are an Event Worker on) a day, or null for no limit
max_sessions_per_week:
type: integer
nullable: true
description: Maximum sessions a week, or null for no limit
max_per_day:
type: integer
nullable: true
Expand All @@ -33046,21 +33071,27 @@ components:
max_one_to_one_contacts:
type: integer
nullable: true
description: Maximum Contacts with an upcoming one-to-one appointment with them, or null for no limit
description: Maximum Contacts with an upcoming appointment with them, or null for no limit
can_edit:
type: boolean
description: Whether you may change the caps
usage:
type: object
properties:
sessions_today:
type: integer
description: Events today where they are an Event Worker
sessions_this_week:
type: integer
description: Monday to Sunday, in the Organisation's timezone
appointments_today:
type: integer
appointments_this_week:
type: integer
description: Monday to Sunday, in the Organisation's timezone
ongoing_one_to_one_contacts:
type: integer
description: Distinct guests of their upcoming one-to-one appointments
description: Distinct guests of their upcoming appointments

FreeSlot:
type: object
Expand Down Expand Up @@ -33304,7 +33335,7 @@ components:
type: string
nullable: true
enum: [one_to_one, group, null]
description: One-to-one or Group appointment, or null for "Not an appointment". One-to-one appointments have one guest.
description: Appointment (`one_to_one`) or Group, or null for "Not an appointment". An appointment is with one Contact, and can have more than one staff member.
default_length_minutes:
type: integer
nullable: true
Expand Down Expand Up @@ -33423,7 +33454,7 @@ components:
type: string
nullable: true
enum: [one_to_one, group, null]
description: One-to-one or Group appointment, or null for "Not an appointment". One-to-one appointments have one guest.
description: Appointment (`one_to_one`) or Group, or null for "Not an appointment". An appointment is with one Contact, and can have more than one staff member.
default_length_minutes:
type: integer
nullable: true
Expand Down
18 changes: 11 additions & 7 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4849,25 +4849,29 @@ function buildDocsPage() {
<div class="section-eyebrow">Events</div>
<h2 class="section-title">Staff Capacity</h2>
<div class="section-desc">
<p>How much a colleague can take on in an Organisation: maximum appointments a day and a week, and maximum ongoing one-to-one Contacts (Contacts with an upcoming one-to-one appointment with them). A blank (<code>null</code>) cap means no limit. It appears in the Capacity column of the Staff availability page.</p>
<p>An appointment is an event whose Event Format has an <code>appointment_type</code>, where the colleague is an Event Worker. <code>usage</code> counts today's and this week's appointments, Monday to Sunday in the Organisation's timezone, and the colleague's ongoing one-to-one Contacts.</p>
<p>How much a colleague can take on in an Organisation. There are two kinds of cap, and a blank (<code>null</code>) cap means no limit. They appear in the Capacity column of the Staff availability page, e.g. "6 sessions a day · 4 appointments a day · 12 Contacts".</p>
<p><strong>Sessions</strong> are every event in the Organisation where the colleague is an Event Worker, group sessions and appointments alike: maximum sessions a day and a week.</p>
<p><strong>Appointments</strong> are events whose Event Format has the Appointment type (<code>appointment_type: one_to_one</code>). An appointment is with one Contact and can have more than one staff member; it counts once for each of its Event Workers. Group sessions are not appointments. Caps: maximum appointments a day and a week, and maximum ongoing Contacts with appointments (Contacts with an upcoming appointment with them).</p>
<p>A colleague is fully booked on a day when they reach either cap. <code>usage</code> counts today's and this week's sessions and appointments, Monday to Sunday in the Organisation's timezone, and the colleague's ongoing appointment Contacts.</p>
<p>Anyone who sees the colleague on Staff availability can read their capacity: the colleague themselves, their Team Leaders, Project Editors of their Projects and Organisation Admins. Only Organisation Admins, and Team Leaders of a Team the colleague is in, can change it, and nobody can change their own.</p>
</div>
<div class="endpoint-list">
${endpointCard("GET", "/users/{user_id}/capacity", "Get a colleague's capacity", true, [
{ name: "user_id", in: "path", type: "integer", required: true, desc: "The colleague (User)" },
{ name: "charity_id", type: "integer", required: true, desc: "The Organisation" }
], [
{ code: "200", cls: "response-2xx", desc: "max_per_day, max_per_week, max_one_to_one_contacts, can_edit and usage" },
{ code: "200", cls: "response-2xx", desc: "max_sessions_per_day, max_sessions_per_week, max_per_day, max_per_week, max_one_to_one_contacts, can_edit and usage" },
{ code: "403", cls: "response-4xx", desc: "You can't see this colleague on Staff availability" },
{ code: "404", cls: "response-4xx", desc: "Not found, or an Organisation you are not in" }
])}
${endpointCard("PATCH", "/users/{user_id}/capacity", "Set a colleague's capacity", true, [
{ name: "user_id", in: "path", type: "integer", required: true, desc: "The colleague (User)" },
{ name: "charity_id", type: "integer", required: true, desc: "The Organisation" },
{ name: "max_sessions_per_day", in: "body", type: "integer", required: false, desc: "Maximum sessions (any event they are an Event Worker on) a day, or null for no limit" },
{ name: "max_sessions_per_week", in: "body", type: "integer", required: false, desc: "Maximum sessions a week, or null for no limit" },
{ name: "max_per_day", in: "body", type: "integer", required: false, desc: "Maximum appointments a day, or null for no limit" },
{ name: "max_per_week", in: "body", type: "integer", required: false, desc: "Maximum appointments a week, or null for no limit" },
{ name: "max_one_to_one_contacts", in: "body", type: "integer", required: false, desc: "Maximum ongoing one-to-one Contacts, or null for no limit" }
{ name: "max_one_to_one_contacts", in: "body", type: "integer", required: false, desc: "Maximum ongoing Contacts with appointments, or null for no limit" }
], [
{ code: "200", cls: "response-2xx", desc: "Saved — returns the caps and usage" },
{ code: "403", cls: "response-4xx", desc: "Not an Organisation Admin or a Team Leader of the colleague, or your own capacity" },
Expand Down Expand Up @@ -4968,7 +4972,7 @@ function buildDocsPage() {
<h2 class="section-title">Event Formats</h2>
<div class="section-desc">
<p>Event Formats (Event Categories in the API) are the templates an organisation's events are created from, such as Workshops, Classes or Meetings. Only an Organisation Admin can list, read, create, edit or delete an organisation's Event Formats. An Event Format can be deleted only once it has no events and is not added to any project; the list says which ones can be deleted and why not. Default formats can be deleted under the same rules.</p>
<p><strong>Appointments:</strong> an Event Format can be a One-to-one or Group appointment (<code>appointment_type</code> <code>one_to_one</code> or <code>group</code>; <code>null</code> means "Not an appointment"). <code>default_length_minutes</code> (5-minute steps) sets the end time on the Create Event page, and <code>preparation_minutes</code> and <code>debrief_minutes</code> are the time a colleague needs either side of each appointment.</p>
<p><strong>Appointments:</strong> an Event Format's Appointment type can be Appointment (<code>appointment_type</code> <code>one_to_one</code>: with one Contact, and it can have more than one staff member) or Group (<code>group</code>); <code>null</code> means "Not an appointment". <code>default_length_minutes</code> (5-minute steps) sets the end time on the Create Event page, and <code>preparation_minutes</code> and <code>debrief_minutes</code> are the time a colleague needs either side of each appointment.</p>
<p><strong>Organisation default:</strong> an organisation can make one Event Format its default (<code>is_organisation_default</code>), as <b>Make default</b> on the Manage Event Formats page does. It is added to a project whenever events are turned on there, unless the project's Event Formats are chosen at the same time.</p>
</div>
<div class="endpoint-list">
Expand Down Expand Up @@ -4996,7 +5000,7 @@ function buildDocsPage() {
{ name: "enable_event_roles", in: "body", type: "boolean", required: false, desc: "Turn on Event Roles" },
{ name: "event_role_ids_for_event_managers_and_workers", in: "body", type: "integer[]", required: false, desc: "The organisation's Event Roles that Event Managers and Workers can have" },
{ name: "event_role_ids_for_guests", in: "body", type: "integer[]", required: false, desc: "The organisation's Event Roles that guests can have" },
{ name: "appointment_type", in: "body", type: "string", required: false, desc: "<code>one_to_one</code>, <code>group</code>, or null for Not an appointment" },
{ name: "appointment_type", in: "body", type: "string", required: false, desc: "<code>one_to_one</code> (shown as Appointment), <code>group</code>, or null for Not an appointment" },
{ name: "default_length_minutes", in: "body", type: "integer", required: false, desc: "Usual length, in 5-minute steps up to 1440, or null" },
{ name: "preparation_minutes", in: "body", type: "integer", required: false, desc: "Preparation time before each appointment, 0–1440 (default 0)" },
{ name: "debrief_minutes", in: "body", type: "integer", required: false, desc: "Debrief time after each appointment, 0–1440 (default 0)" },
Expand Down Expand Up @@ -5030,7 +5034,7 @@ function buildDocsPage() {
{ name: "enable_event_roles", in: "body", type: "boolean", required: false, desc: "Turn on Event Roles" },
{ name: "event_role_ids_for_event_managers_and_workers", in: "body", type: "integer[]", required: false, desc: "The organisation's Event Roles that Event Managers and Workers can have" },
{ name: "event_role_ids_for_guests", in: "body", type: "integer[]", required: false, desc: "The organisation's Event Roles that guests can have" },
{ name: "appointment_type", in: "body", type: "string", required: false, desc: "<code>one_to_one</code>, <code>group</code>, or null for Not an appointment" },
{ name: "appointment_type", in: "body", type: "string", required: false, desc: "<code>one_to_one</code> (shown as Appointment), <code>group</code>, or null for Not an appointment" },
{ name: "default_length_minutes", in: "body", type: "integer", required: false, desc: "Usual length, in 5-minute steps up to 1440, or null" },
{ name: "preparation_minutes", in: "body", type: "integer", required: false, desc: "Preparation time before each appointment, 0–1440 (default 0)" },
{ name: "debrief_minutes", in: "body", type: "integer", required: false, desc: "Debrief time after each appointment, 0–1440 (default 0)" },
Expand Down
Loading