From 1490793d1ed29e560d583c35df3073930eeebfb9 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 00:12:40 +0000 Subject: [PATCH] Document the Impact Celebrations endpoints CP-9059: celebration settings and celebrations for Workspaces and Portfolios, and ending one early (MakerbleDev/makerble#18281). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01F1a5xnjzZer8DKhJ5umgUf --- openapi.yaml | 397 +++++++++++++++++++++++++++++++++++++++++++++++++++ server.js | 76 ++++++++++ 2 files changed, 473 insertions(+) diff --git a/openapi.yaml b/openapi.yaml index fede18d..c29154a 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -256,6 +256,15 @@ tags: description: | The page the signed-in user lands on after signing in, and whenever they click Home or the Makerble logo: one of the Today pages, chosen under Personal Settings › Preferences › Start page. + - name: Impact Celebrations + description: | + Impact Celebrations announce good news for a Workspace (Project) or Portfolio (Album, Bundle in + the code) automatically. Its editors switch them on and tick the metrics worth celebrating. Every + hour Makerble checks: when a ticked metric reaches its target, or when 80% of Contacts judged on + a ticked Choice tracker (a Scale Indicator with a success direction) have improved, its + colleagues see a popup announcement for 7 days. Each target, and each Choice tracker, celebrates + once; anything already reached when first checked is recorded without a popup. Only whoever may + edit the Workspace's or Portfolio's targets can read or change its Impact Celebrations. - name: Snapshot description: | The Snapshot under Today: one Album's (Portfolio's) or Project's headline numbers on one page. @@ -23001,6 +23010,231 @@ paths: "422": $ref: '#/components/responses/UnprocessableEntityList' + /projects/{project_id}/celebration_settings: + parameters: + - name: project_id + in: path + required: true + schema: + type: integer + description: The Workspace's (Project's) ID + get: + tags: [Impact Celebrations] + summary: Get a Workspace's Impact Celebrations settings + description: | + Whether Impact Celebrations are switched on for the Workspace (Project), and every metric that + can celebrate there, as on the Impact Celebrations tab of its Preferences: each Activity, + Engagement, Achievement or Numerical tracker (Change or Indicator) with a target over 0, and + each Choice tracker (Scale Indicator), which celebrates when 80% of Contacts improve. A Choice + tracker without a success direction is listed with `can_tick: false` and the `reason`. + Only the Workspace's editors and its Organisation Admins (whoever may edit its targets) can read it. + operationId: getProjectCelebrationSettings + security: [{tokenAuth: []}] + responses: + "200": + description: The Workspace's Impact Celebrations settings + content: + application/json: + schema: + $ref: '#/components/schemas/CelebrationSettings' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "404": + $ref: '#/components/responses/NotFound' + patch: + tags: [Impact Celebrations] + summary: Switch a Workspace's Impact Celebrations on or off, and choose the metrics + description: | + Sets whether Impact Celebrations are on (`enabled`) and which metrics celebrate + (`metric_keys`, the `key`s GET lists, all of which must have `can_tick: true`). Whatever you + don't send stays as it is; `metric_keys: []` unticks every metric. Switching off stops new + celebrations; any popup already showing carries on until it ends. + operationId: setProjectCelebrationSettings + security: [{tokenAuth: []}] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CelebrationSettingsInput' + example: + enabled: true + metric_keys: ["Change-12", "Indicator-7"] + responses: + "200": + description: The saved settings + content: + application/json: + schema: + $ref: '#/components/schemas/CelebrationSettings' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "404": + $ref: '#/components/responses/NotFound' + "422": + $ref: '#/components/responses/UnprocessableEntityList' + /projects/{project_id}/celebrations: + parameters: + - name: project_id + in: path + required: true + schema: + type: integer + description: The Workspace's (Project's) ID + get: + tags: [Impact Celebrations] + summary: List a Workspace's Impact Celebrations so far + description: | + The targets and improvements the Workspace (Project) has reached, newest first, with what + happened: the popup announcement Makerble made, or `recorded_silently` when it was already + reached when first checked. Only whoever may edit the Workspace's targets can list them. + operationId: listProjectCelebrations + security: [{tokenAuth: []}] + parameters: + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PerPage' + - $ref: '#/components/parameters/LastSyncDatetime' + responses: + "200": + description: A page of celebrations + content: + application/json: + schema: + $ref: '#/components/schemas/CelebrationPage' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "404": + $ref: '#/components/responses/NotFound' + /albums/{album_id}/celebration_settings: + parameters: + - name: album_id + in: path + required: true + schema: + type: integer + description: The Portfolio's (Album's, Bundle's) ID + get: + tags: [Impact Celebrations] + summary: Get a Portfolio's Impact Celebrations settings + description: | + As for a Workspace, for a Portfolio (Album): its own targets (one-off, or dated targets set on + the Portfolio, automatic or manual) and the Choice trackers used on its open Workspaces. Its + popups are seen by colleagues on its open Workspaces and its editors. Only the Portfolio's owner + and its Organisation Admins can read it. + operationId: getAlbumCelebrationSettings + security: [{tokenAuth: []}] + responses: + "200": + description: The Portfolio's Impact Celebrations settings + content: + application/json: + schema: + $ref: '#/components/schemas/CelebrationSettings' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "404": + $ref: '#/components/responses/NotFound' + patch: + tags: [Impact Celebrations] + summary: Switch a Portfolio's Impact Celebrations on or off, and choose the metrics + description: As for a Workspace, for a Portfolio (Album). + operationId: setAlbumCelebrationSettings + security: [{tokenAuth: []}] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CelebrationSettingsInput' + example: + enabled: true + metric_keys: ["Change-12"] + responses: + "200": + description: The saved settings + content: + application/json: + schema: + $ref: '#/components/schemas/CelebrationSettings' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "404": + $ref: '#/components/responses/NotFound' + "422": + $ref: '#/components/responses/UnprocessableEntityList' + /albums/{album_id}/celebrations: + parameters: + - name: album_id + in: path + required: true + schema: + type: integer + description: The Portfolio's (Album's, Bundle's) ID + get: + tags: [Impact Celebrations] + summary: List a Portfolio's Impact Celebrations so far + description: As for a Workspace, for a Portfolio (Album). + operationId: listAlbumCelebrations + security: [{tokenAuth: []}] + parameters: + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PerPage' + - $ref: '#/components/parameters/LastSyncDatetime' + responses: + "200": + description: A page of celebrations + content: + application/json: + schema: + $ref: '#/components/schemas/CelebrationPage' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "404": + $ref: '#/components/responses/NotFound' + /celebrations/{id}/end: + parameters: + - name: id + in: path + required: true + schema: + type: integer + description: The celebration's ID, from the list of celebrations + post: + tags: [Impact Celebrations] + summary: End an Impact Celebration's popup now + description: | + Stops a celebration's popup announcement showing, as End now does on the Impact Celebrations + tab: its last day becomes yesterday. Only one whose announcement is still showing can be ended + (422 otherwise). Only whoever may edit the Workspace's or Portfolio's targets can end it. + operationId: endCelebration + security: [{tokenAuth: []}] + responses: + "200": + description: The celebration, with its announcement now ended + content: + application/json: + schema: + $ref: '#/components/schemas/Celebration' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "404": + $ref: '#/components/responses/NotFound' + "422": + $ref: '#/components/responses/UnprocessableEntity' /focus: get: tags: [Focus] @@ -36674,6 +36908,169 @@ components: kind: type: string enum: [Progress Tracker, Indicator, Filtered version, Workflow Tracker, Cohort Tracker, Formula Tracker] + CelebrationSettings: + type: object + required: [resource_type, resource_id, enabled, metrics] + properties: + resource_type: + type: string + enum: [project, album] + description: Workspace (project) or Portfolio (album) + resource_id: + type: integer + enabled: + type: boolean + description: Whether Impact Celebrations are switched on. Off until someone switches them on. + changed_by_id: + type: integer + nullable: true + description: The User who last saved the settings + updated_at: + type: string + format: date-time + nullable: true + metrics: + type: array + description: Every metric that can celebrate here, in name order + items: + $ref: '#/components/schemas/CelebrationMetricChoice' + example: + resource_type: project + resource_id: 619 + enabled: true + changed_by_id: 42 + updated_at: "2026-11-30T09:15:00Z" + metrics: + - key: Change-12 + metric_type: Change + metric_id: 12 + name: Attendance + kind: target + celebrates_when: 200 by 31 Dec 2026 + ticked: true + can_tick: true + reason: null + CelebrationMetricChoice: + type: object + properties: + key: + type: string + description: What to send in `metric_keys` to tick it + example: Change-12 + metric_type: + type: string + enum: [Change, Indicator] + metric_id: + type: integer + name: + type: string + example: Attendance + kind: + type: string + enum: [target, improvement] + description: target celebrates reaching a target; improvement (Choice trackers) celebrates 80% of Contacts improving + celebrates_when: + type: string + example: 200 by 31 Dec 2026 + ticked: + type: boolean + can_tick: + type: boolean + reason: + type: string + nullable: true + description: Why it can't be ticked, when can_tick is false + CelebrationSettingsInput: + type: object + properties: + enabled: + type: boolean + metric_keys: + type: array + items: + type: string + description: The `key`s of the metrics to tick; any not sent are unticked + Celebration: + type: object + properties: + id: + type: integer + kind: + type: string + enum: [target, improvement] + metric_type: + type: string + enum: [Change, Indicator] + metric_id: + type: integer + metric_name: + type: string + nullable: true + target_number: + type: integer + description: The target reached, or for an improvement the percentage of Contacts (80) + target_date: + type: string + format: date + nullable: true + description: The dated target's date; null for an overall target or an improvement + reached_on: + type: string + format: date + recorded_silently: + type: boolean + description: Already reached when first checked, so no popup was shown + days_early: + type: integer + nullable: true + description: How many days before its date a dated target was reached + announcement: + type: object + nullable: true + description: The popup Makerble showed; null when recorded silently + properties: + id: + type: integer + title: + type: string + body: + type: string + starts_on: + type: string + format: date + ends_on: + type: string + format: date + status: + type: string + enum: [scheduled, live, ended] + example: + id: 31 + kind: target + metric_type: Change + metric_id: 12 + metric_name: Attendance + target_number: 200 + target_date: "2026-12-31" + reached_on: "2026-12-19" + recorded_silently: false + days_early: 12 + announcement: + id: 88 + title: "Target reached: Attendance" + body: "Riverside Centre: Year 4 reached its target of 200 for Attendance, 12 days early." + starts_on: "2026-12-19" + ends_on: "2026-12-26" + status: live + CelebrationPage: + allOf: + - $ref: '#/components/schemas/PaginationEnvelope' + - type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/Celebration' SnapshotSettings: type: object required: [customised, panels, tiles, workload, choices] diff --git a/server.js b/server.js index 0b548a5..75dff12 100644 --- a/server.js +++ b/server.js @@ -1018,6 +1018,7 @@ function buildDocsPage() { GETAge Bands GETFocus GETSnapshot + GETImpact Celebrations GETStart page GETMy Apps menu GETRatio Sets @@ -6650,6 +6651,81 @@ function buildDocsPage() { + +
+
Workspaces & Portfolios
+

Impact Celebrations

+
+

Impact Celebrations announce good news for a Workspace (Project) or Portfolio (Album) automatically. Its editors switch them on and tick the metrics worth celebrating, on the Impact Celebrations tab of its Preferences. Every hour Makerble checks: when a ticked metric reaches its target (a dated target, or the one-off target when there are no dated ones), or when at least 80% of the Contacts judged on a ticked Choice tracker have improved between their first and latest answers, its colleagues see a popup announcement for 7 days.

+

Each target, and each Choice tracker, celebrates once. Anything already reached when first checked (just ticked, or a target just set or lowered) is recorded without a popup, with recorded_silently: true. GET lists every metric that can celebrate, each with a key such as Change-12 that PATCH takes in metric_keys.

+

Only whoever may edit the Workspace's or Portfolio's targets can read or change its Impact Celebrations; anyone else gets 403. A Workspace or Portfolio that doesn't exist answers 404.

+
+
+ ${endpointCard("GET", "/projects/{project_id}/celebration_settings", "Get a Workspace's Impact Celebrations settings", true, [ + { name: "project_id", in: "path", type: "integer", required: true, desc: "The Workspace's (Project's) ID" } + ], [ + { code: "200", cls: "response-2xx", desc: "enabled, and metrics: every metric that can celebrate, with key, kind, celebrates_when, ticked and can_tick" }, + { code: "403", cls: "response-4xx", desc: "Can't edit this Workspace's targets" }, + { code: "404", cls: "response-4xx", desc: "No such Workspace" } + ])} + ${endpointCard("PATCH", "/projects/{project_id}/celebration_settings", "Switch a Workspace's Impact Celebrations on or off, and choose the metrics", true, [ + { name: "project_id", in: "path", type: "integer", required: true, desc: "The Workspace's (Project's) ID" }, + { name: "enabled", in: "body", type: "boolean", required: false, desc: "Whether Impact Celebrations are on" }, + { name: "metric_keys", in: "body", type: "string[]", required: false, desc: "Keys of the metrics to tick; [] unticks every one" } + ], [ + { code: "200", cls: "response-2xx", desc: "The settings after the change" }, + { code: "403", cls: "response-4xx", desc: "Can't edit this Workspace's targets" }, + { code: "404", cls: "response-4xx", desc: "No such Workspace" }, + { code: "422", cls: "response-4xx", desc: "A metric that can't celebrate there" } + ])} + ${endpointCard("GET", "/projects/{project_id}/celebrations", "List a Workspace's Impact Celebrations so far", true, [ + { name: "project_id", in: "path", type: "integer", required: true, desc: "The Workspace's (Project's) ID" }, + { name: "page", type: "integer", required: false, desc: "Page number (default 1)" }, + { name: "per_page", type: "integer", required: false, desc: "Results per page (default 10, max 200)" }, + { name: "last_synced_datetime", type: "string", required: false, desc: "Only those changed after this datetime" } + ], [ + { code: "200", cls: "response-2xx", desc: "Newest first: kind, metric, target, reached_on, days_early, recorded_silently and the announcement shown" }, + { code: "403", cls: "response-4xx", desc: "Can't edit this Workspace's targets" }, + { code: "404", cls: "response-4xx", desc: "No such Workspace" } + ])} + ${endpointCard("GET", "/albums/{album_id}/celebration_settings", "Get a Portfolio's Impact Celebrations settings", true, [ + { name: "album_id", in: "path", type: "integer", required: true, desc: "The Portfolio's (Album's) ID" } + ], [ + { code: "200", cls: "response-2xx", desc: "As for a Workspace; its popups go to colleagues on its open Workspaces and its editors" }, + { code: "403", cls: "response-4xx", desc: "Can't edit this Portfolio's targets" }, + { code: "404", cls: "response-4xx", desc: "No such Portfolio" } + ])} + ${endpointCard("PATCH", "/albums/{album_id}/celebration_settings", "Switch a Portfolio's Impact Celebrations on or off, and choose the metrics", true, [ + { name: "album_id", in: "path", type: "integer", required: true, desc: "The Portfolio's (Album's) ID" }, + { name: "enabled", in: "body", type: "boolean", required: false, desc: "Whether Impact Celebrations are on" }, + { name: "metric_keys", in: "body", type: "string[]", required: false, desc: "Keys of the metrics to tick; [] unticks every one" } + ], [ + { code: "200", cls: "response-2xx", desc: "The settings after the change" }, + { code: "403", cls: "response-4xx", desc: "Can't edit this Portfolio's targets" }, + { code: "404", cls: "response-4xx", desc: "No such Portfolio" }, + { code: "422", cls: "response-4xx", desc: "A metric that can't celebrate there" } + ])} + ${endpointCard("GET", "/albums/{album_id}/celebrations", "List a Portfolio's Impact Celebrations so far", true, [ + { name: "album_id", in: "path", type: "integer", required: true, desc: "The Portfolio's (Album's) ID" }, + { name: "page", type: "integer", required: false, desc: "Page number (default 1)" }, + { name: "per_page", type: "integer", required: false, desc: "Results per page (default 10, max 200)" }, + { name: "last_synced_datetime", type: "string", required: false, desc: "Only those changed after this datetime" } + ], [ + { code: "200", cls: "response-2xx", desc: "As for a Workspace" }, + { code: "403", cls: "response-4xx", desc: "Can't edit this Portfolio's targets" }, + { code: "404", cls: "response-4xx", desc: "No such Portfolio" } + ])} + ${endpointCard("POST", "/celebrations/{id}/end", "End an Impact Celebration's popup now", true, [ + { name: "id", in: "path", type: "integer", required: true, desc: "The celebration's ID" } + ], [ + { code: "200", cls: "response-2xx", desc: "The celebration, its announcement now ended" }, + { code: "403", cls: "response-4xx", desc: "Can't edit the Workspace's or Portfolio's targets" }, + { code: "404", cls: "response-4xx", desc: "No such celebration" }, + { code: "422", cls: "response-4xx", desc: "Its popup isn't showing" } + ])} +
+
+
Reference data