From c753643beacb4d4624f7f9e0b3384352162f879d Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Nov 2026 18:46:45 +0000 Subject: [PATCH 1/4] CP-9129 Document Survey and Shared Interval checklist choices A checklist's survey_waves criteria can now be "survey:" or "shared::", which count a survey from any project, as well as ":". Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01F1a5xpXmvAYTfj7qKiU9gy --- openapi.yaml | 8 +++++--- server.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 5d63abf..b4568f7 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -9868,9 +9868,11 @@ paths: choice for it, e.g. "Any relationship" (`criteria: {any: true}`). Criteria values are strings: IDs, or pairs such as `project_states` ":", `project_event_categories` ":", `relationship_sides` - ":parent|child", and `survey_waves` ":". The "for a relative" types take `relatives: [{relationship_side, - beneficiary_category_ids | survey_waves}]`. + ":parent|child", and `survey_waves`, one of: ":" (that Survey Campaign in its Project); "survey:" (a survey made with that Survey in any Project); or "shared::" (a survey tagged to that Shared Wave (Shared Interval) of the Survey, in any Project). The "for a + relative" types take `relatives: [{relationship_side, beneficiary_category_ids | survey_waves}]`. operationId: listChecklistActionTypes security: [{tokenAuth: []}] responses: diff --git a/server.js b/server.js index aa9fe3b..e4a1577 100644 --- a/server.js +++ b/server.js @@ -2804,7 +2804,7 @@ function buildDocsPage() { ])} ${endpointCard("GET", "/checklists/action_types", "List the actions a Checklist can contain", true, [], [ { code: "200", cls: "response-2xx", desc: "{data: [{action_type, name, criteria_keys, any_name, project_scopable}]}; any_name names the \"Any\" choice, e.g. \"Any relationship\" (criteria: {any: true}); project_scopable types can take only_this_project" } - ], "Criteria values are strings: IDs, or pairs such as project_states \"<project_id>:<state_id>\", project_event_categories \"<project_id>:<event_category_id>\", relationship_sides \"<category_id>:parent|child\" and survey_waves \"<Survey Campaign id>:<Wave id, or 0>\".")} + ], "Criteria values are strings: IDs, or pairs such as project_states \"<project_id>:<state_id>\", project_event_categories \"<project_id>:<event_category_id>\", relationship_sides \"<category_id>:parent|child\" and survey_waves: \"<Survey Campaign id>:<Wave id, or 0>\" for that Survey Campaign, \"survey:<Survey id>\" for that Survey in any Project, or \"shared:<Survey id>:<Shared Wave id>\" for that Shared Interval of the Survey in any Project.")} ${endpointCard("GET", "/checklists/owner_options", "List the choices for who is responsible for an action", true, [ { name: "charity_id", type: "integer", required: true, desc: "The Organisation ID" } ], [ From 5bbfb95fec314ddec5f041330d8fb4d520cf1478 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Nov 2026 19:36:39 +0000 Subject: [PATCH 2/4] CP-9129 Document the Checklist Summary endpoint GET /checklists/{id}/summary returns, for each project the caller oversees that uses the Checklist, its managers, its other colleagues and how many of its contacts have done each step. Also drops a duplicated 422 response on the Checklist Progress path, which made the spec invalid YAML for strict parsers. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01F1a5xpXmvAYTfj7qKiU9gy --- openapi.yaml | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++-- server.js | 12 +++++++++ 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index b4568f7..093d9fa 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -10163,6 +10163,75 @@ paths: "404": description: The Checklist or Project wasn't found, or the user can't edit the Project + /checklists/{id}/summary: + get: + tags: [Checklists] + operationId: getChecklistSummary + summary: Checklist Summary across the projects you oversee + description: > + The Checklist Summary (the Summary tab of the Focus page) for one Checklist: one row for each + project (Workspace) you oversee that uses the Checklist, with its Project Managers ("Managed by"), + its other Workspace colleagues (reporters and observers), and for each step of the Checklist how + many of the project's contacts with the Checklist have done that step, as a count and a percentage. + Only Organisation Admins (every open project of their organisation), Team Leaders (open projects + where someone in a Team they lead is a colleague) and Album Editors (open projects in organisation + Albums they edit) may call it; anyone else gets 403. A Checklist that none of your projects uses + returns 404. Only contacts you may see, that aren't deleted and are still active in the project, + are counted. Rows are sorted before pagination; the sort is not remembered. + security: [{tokenAuth: []}] + parameters: + - name: id + in: path + required: true + description: Checklist id + schema: {type: integer} + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PerPage' + - name: sort + in: query + description: "project (default), managed_by, colleagues, or step_ (1 = first step)" + schema: {type: string, example: step_1} + - name: direction + in: query + schema: {type: string, enum: [asc, desc], default: asc} + responses: + "200": + description: One page of projects + content: + application/json: + example: + checklist_id: 12 + checklist_name: Intake + sort: project + direction: asc + steps: + - {id: 31, number: 1, action_type: create_task, title: Consent form} + - {id: 32, number: 2, action_type: add_role, title: Enrol} + page: 1 + page_size: 1 + page_count: 1 + total_count: 1 + data: + - project_id: 7 + project_name: Youth Club + managed_by: [Ama Ng] + workspace_colleagues: [Obi Eze] + contacts_count: 2 + steps: + - {action_id: 31, number: 1, done_count: 1, percent: 50} + - {action_id: 32, number: 2, done_count: 0, percent: 0} + "401": + $ref: '#/components/responses/Unauthorized' + "403": + description: Not an Organisation Admin, Team Leader or Album Editor + content: + application/json: + example: {error: forbidden} + "404": + $ref: '#/components/responses/NotFound' + "422": + $ref: '#/components/responses/UnprocessableEntity' + /checklists/{id}/progress: get: tags: [Checklists] @@ -10231,8 +10300,6 @@ paths: $ref: '#/components/responses/NotFound' "422": $ref: '#/components/responses/UnprocessableEntity' - "422": - $ref: '#/components/responses/UnprocessableEntity' /checklists/{id}/progress/contacts: get: diff --git a/server.js b/server.js index e4a1577..51ac460 100644 --- a/server.js +++ b/server.js @@ -2825,6 +2825,18 @@ function buildDocsPage() { { code: "200", cls: "response-2xx", desc: "The Checklist with stages (id, name, icon, position, colour), actions (each with stage_id, due_within_days, video_url, its owner fields and owner_description; action_name is \"Not set yet\" while no type is chosen), projects and contacts_count" }, { code: "404", cls: "response-4xx", desc: "Not found, or another Organisation's" } ])} + ${endpointCard("GET", "/checklists/{id}/summary", "Get a Checklist Summary across the projects you oversee", true, [ + { name: "id", in: "path", type: "integer", required: true, desc: "Checklist ID" }, + { name: "page", type: "integer", required: false, desc: "Page number" }, + { name: "per_page", type: "integer", required: false, desc: "Projects per page (default 10, max 200)" }, + { name: "sort", type: "string", required: false, desc: "project (default), managed_by, colleagues or step_<number>" }, + { name: "direction", type: "string", required: false, desc: "asc (default) or desc" } + ], [ + { code: "200", cls: "response-2xx", desc: "{checklist_id, checklist_name, sort, direction, steps: [{id, number, action_type, title}], page, page_size, page_count, total_count, data: [{project_id, project_name, managed_by, workspace_colleagues, contacts_count, steps: [{action_id, number, done_count, percent}]}]}" }, + { code: "403", cls: "response-4xx", desc: "Not an Organisation Admin, Team Leader or Album Editor" }, + { code: "404", cls: "response-4xx", desc: "None of your projects uses this Checklist" }, + { code: "422", cls: "response-4xx", desc: "An unknown sort or direction" } + ], "The Summary tab of the Focus page: a row per project (Workspace) you oversee that uses the Checklist, with its Project Managers (\"Managed by\"), its reporters and observers (\"Workspace colleagues\"), and for each step how many of the project's contacts with the Checklist have done it. Only contacts you may see, not deleted and still active in the project, are counted.")} ${endpointCard("POST", "/checklists", "Create a Checklist", true, [], [ { code: "201", cls: "response-2xx", desc: "The new Checklist" }, { code: "403", cls: "response-4xx", desc: "Not an editor or reporter of the Organisation" }, From bb26d884f6c0ac56b53c3e38dd11221612a11469 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Nov 2026 21:05:46 +0000 Subject: [PATCH 3/4] CP-9129 Document "Force colleagues to select an interval" Survey Campaigns gain force_interval, changed with the new PATCH /project_story_categories/{id}. When it is on and the campaign has Waves, generating survey links needs send_survey_wave_id. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01F1a5xpXmvAYTfj7qKiU9gy --- openapi.yaml | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++- server.js | 13 ++++++++++-- 2 files changed, 67 insertions(+), 3 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 093d9fa..3486647 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -4297,6 +4297,51 @@ paths: "401": $ref: '#/components/responses/Unauthorized' + /project_story_categories/{id}: + parameters: + - name: id + in: path + required: true + schema: {type: integer} + description: The Survey Campaign (Project Story Category) ID + patch: + tags: [Project Story Categories] + summary: Change a Survey Campaign's settings + description: | + Turns "Force colleagues to select an interval" on or off, as the Survey Campaign + Settings page does. When on and the Survey Campaign has intervals (Waves), every story, + survey invitation, shared link and automation for it must name an interval. Requires + Project Editor (Project Manager) or Organisation Editor (Organisation Admin) access. + operationId: updateProjectStoryCategory + security: [{tokenAuth: []}] + requestBody: + required: true + content: + application/json: + schema: + type: object + required: [force_interval] + properties: + force_interval: {type: boolean} + example: {force_interval: true} + responses: + "200": + description: The updated Survey Campaign + content: + application/json: + schema: {$ref: '#/components/schemas/ProjectStoryCategory'} + "401": + $ref: '#/components/responses/Unauthorized' + "403": + description: The user may not change this Survey Campaign + content: + application/json: + schema: {$ref: '#/components/schemas/Error'} + "404": + $ref: '#/components/responses/NotFound' + "422": + $ref: '#/components/responses/UnprocessableEntity' + /project_story_categories/{id}/survey_links: parameters: - name: id @@ -4344,7 +4389,9 @@ paths: description: Email addresses, matched to or creating Contacts. No email is sent. send_survey_wave_id: type: integer - description: Optional Wave, from GET /project_story_categories/{id}/survey_waves + description: >- + Wave, from GET /project_story_categories/{id}/survey_waves. Required when the + Survey Campaign's force_interval is true and it has Waves; otherwise optional. link_expiry: type: string enum: [use_once, evergreen] @@ -19375,6 +19422,14 @@ components: type: boolean display_respondent_name: type: boolean + force_interval: + type: boolean + description: >- + "Force colleagues to select an interval". When true and the Survey Campaign has + intervals (Waves), colleagues must choose one when they add a story, send the survey, + share its link or set up an automation that sends it, and POST + /project_story_categories/{id}/survey_links requires send_survey_wave_id. + On by default for new Survey Campaigns. StoryCategoryResponse: allOf: diff --git a/server.js b/server.js index 51ac460..1640d61 100644 --- a/server.js +++ b/server.js @@ -1938,6 +1938,15 @@ function buildDocsPage() { { name: "page", type: "integer", required: false, desc: "Page number" }, { name: "per_page", type: "integer", required: false, desc: "Records per page" } ], [{ code: "200", cls: "response-2xx", desc: "Surveys deployed to specific Projects" }])} + ${endpointCard("PATCH", "/project_story_categories/{id}", "Change a Survey Campaign's settings", true, [ + { name: "id", in: "path", type: "integer", required: true, desc: "Survey Campaign (Project Story Category) ID" }, + { name: "force_interval", in: "body", type: "boolean", required: true, desc: "\"Force colleagues to select an interval\": when true and the campaign has Waves, every story, survey invitation, shared link and automation for it must name an interval" } + ], [ + { code: "200", cls: "response-2xx", desc: "The updated Survey Campaign, with force_interval" }, + { code: "403", cls: "response-4xx", desc: "Not a Project Editor or Organisation Editor" }, + { code: "404", cls: "response-4xx", desc: "Survey Campaign not found, or another organisation's" }, + { code: "422", cls: "response-4xx", desc: "force_interval missing or not true/false" } + ], "New Survey Campaigns have force_interval: true; existing ones were left at false.")} ${endpointCard("GET", "/project_story_categories/{id}/survey_waves", "List the Waves of a Survey Campaign", true, [ { name: "id", in: "path", type: "integer", required: true, desc: "Survey Campaign (Project Story Category) ID" }, { name: "page", type: "integer", required: false, desc: "Page number" }, @@ -1950,14 +1959,14 @@ function buildDocsPage() { { name: "id", in: "path", type: "integer", required: true, desc: "Survey Campaign (Project Story Category) ID" }, { name: "beneficiary_ids", in: "body", type: "integer[]", required: false, desc: "Contacts in the Survey Campaign's Project" }, { name: "emails", in: "body", type: "string[]", required: false, desc: "Email addresses, matched to an existing Contact of the organisation or creating one. No email is sent." }, - { name: "send_survey_wave_id", in: "body", type: "integer", required: false, desc: "Wave, from the Waves endpoint" }, + { name: "send_survey_wave_id", in: "body", type: "integer", required: false, desc: "Wave, from the Waves endpoint. Required when the Survey Campaign's force_interval is true and it has Waves" }, { name: "link_expiry", in: "body", type: "string", required: false, desc: "use_once (default) or evergreen" }, { name: "is_anonymised", in: "body", type: "boolean", required: false, desc: "Default false" } ], [ { code: "201", cls: "response-2xx", desc: "send_survey_id and data: one link per Contact with survey_url, survey_token, link_expiry, expired" }, { code: "403", cls: "response-4xx", desc: "Not a Project Editor or Organisation Editor" }, { code: "404", cls: "response-4xx", desc: "Survey Campaign not found" }, - { code: "422", cls: "response-4xx", desc: "Contacts outside the Project (invalid_beneficiary_ids, split into beneficiary_ids_not_in_project: in the organisation but not the Project, add them with POST /project_beneficiaries first; and beneficiary_ids_not_found: not Contacts of the organisation), over 200 recipients, no recipients, or an unavailable Wave" } + { code: "422", cls: "response-4xx", desc: "Contacts outside the Project (invalid_beneficiary_ids, split into beneficiary_ids_not_in_project: in the organisation but not the Project, add them with POST /project_beneficiaries first; and beneficiary_ids_not_found: not Contacts of the organisation), over 200 recipients, no recipients, an unavailable Wave, or no Wave when the Survey Campaign forces one (errors: [\"Select an interval for this survey.\"])" } ], "Generates the same personal links as the Send Survey page, but sends nothing: share the returned survey_url yourself. At most 200 contacts and email addresses per request. A use_once link stops working after one response; an evergreen link stays active.")} ${endpointCard("GET", "/project_story_categories/{id}/survey_links", "List personal survey links", true, [ { name: "id", in: "path", type: "integer", required: true, desc: "Survey Campaign (Project Story Category) ID" }, From 72640ead5eeccec2c98c29d5e7e06bda8eef5ff4 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Nov 2026 21:24:19 +0000 Subject: [PATCH 4/4] CP-9129 Document the participant pass sign-in setting GET and PATCH /charities/{id} gain participant_pass_sign_in_enabled, "Enable contacts to sign in using a participant pass". Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01F1a5xpXmvAYTfj7qKiU9gy --- openapi.yaml | 11 +++++++++++ server.js | 7 ++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 3486647..86a8d64 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -692,6 +692,11 @@ paths: properties: default_project_story_privacy: $ref: '#/components/schemas/DefaultProjectStoryPrivacy' + participant_pass_sign_in_enabled: + type: boolean + description: >- + "Enable contacts to sign in using a participant pass". When false, a Contact's profile + hides the Participating As tab unless the Contact is already linked to a user. example: default_project_story_privacy: only_project_colleagues responses: @@ -17779,6 +17784,12 @@ components: example: "Greenfield Community Trust" default_project_story_privacy: $ref: '#/components/schemas/DefaultProjectStoryPrivacy' + participant_pass_sign_in_enabled: + type: boolean + description: >- + "Enable contacts to sign in using a participant pass" (Charity Preferences, Contacts). Off + by default. + example: false DefaultProjectStoryPrivacy: type: string diff --git a/server.js b/server.js index 1640d61..be288cd 100644 --- a/server.js +++ b/server.js @@ -1176,19 +1176,20 @@ function buildDocsPage() { ${endpointCard("GET", "/charities/{id}", "Get a single Organisation", true, [ { name: "id", in: "path", type: "integer", required: true, desc: "Organisation ID" } ], [ - { code: "200", cls: "response-2xx", desc: "Charity record with id, name, timestamps and default_project_story_privacy: the Story Privacy Level each new project in the Organisation starts with" }, + { code: "200", cls: "response-2xx", desc: "Charity record with id, name, timestamps, default_project_story_privacy: the Story Privacy Level each new project in the Organisation starts with, and participant_pass_sign_in_enabled" }, { code: "401", cls: "response-4xx", desc: "Not authenticated" }, { code: "404", cls: "response-4xx", desc: "Not found" } ])} ${endpointCard("PATCH", "/charities/{id}", "Change an Organisation's settings", true, [ { name: "id", in: "path", type: "integer", required: true, desc: "Organisation ID" }, - { name: "default_project_story_privacy", in: "body", type: "string", required: false, desc: "Default story level privacy setting on each project: the Story Privacy Level each new project starts with. One of only_project_colleagues (Project colleagues only), only_charity_colleagues (Organisation colleagues only), charity_plus_network (Network & organisation colleagues only) or everyone. Existing projects keep their own level." } + { name: "default_project_story_privacy", in: "body", type: "string", required: false, desc: "Default story level privacy setting on each project: the Story Privacy Level each new project starts with. One of only_project_colleagues (Project colleagues only), only_charity_colleagues (Organisation colleagues only), charity_plus_network (Network & organisation colleagues only) or everyone. Existing projects keep their own level." }, + { name: "participant_pass_sign_in_enabled", in: "body", type: "boolean", required: false, desc: "Enable contacts to sign in using a participant pass. When false, a Contact's profile hides the Participating As tab unless the Contact is already linked to a user." } ], [ { code: "200", cls: "response-2xx", desc: "The Organisation, with the setting changed" }, { code: "401", cls: "response-4xx", desc: "Not authenticated" }, { code: "403", cls: "response-4xx", desc: "Not an Organisation Admin of this Organisation" }, { code: "404", cls: "response-4xx", desc: "Not found, or not one of your Organisations" }, - { code: "422", cls: "response-4xx", desc: "default_project_story_privacy isn't one of the four levels" } + { code: "422", cls: "response-4xx", desc: "default_project_story_privacy isn't one of the four levels, or participant_pass_sign_in_enabled isn't true or false" } ], "Only an Organisation Admin can change these settings, the same people who can use Charity Preferences. Only the settings sent are changed.")}