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
66 changes: 64 additions & 2 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8799,6 +8799,13 @@ paths:
by hand. `automatic`: every Contact now in the Project gets it (in the background), and so does
every Contact who later joins or is created in it. `none`: stop offering it; Contacts who
already have it keep it. Requires an Organisation editor, or a Project Manager of the Project.

For an `automatic` Checklist, `on_leave` says what happens when a Contact leaves the Project,
moves to a closed status in it (Alumni or Declined) or is archived: `keep` (the default) or
`remove_if_incomplete`, which takes it off them unless every action is done. A Checklist
removed that way keeps the Contact's progress, and comes back when they rejoin. Send `mode`,
`on_leave` or both; `on_leave` on its own changes only that, and needs the Checklist to be
`automatic` in the Project.
operationId: setChecklistProject
security: [{tokenAuth: []}]
parameters:
Expand All @@ -8816,11 +8823,23 @@ paths:
required: true
content:
application/json:
schema:
type: object
properties:
mode:
type: string
enum: [none, manual, automatic]
on_leave:
type: string
enum: [keep, remove_if_incomplete]
example:
mode: "automatic"
on_leave: "remove_if_incomplete"
responses:
"200":
description: "`{project_id, assignment_mode}`"
description: "`{project_id, assignment_mode, on_leave}`"
"422":
$ref: '#/components/responses/UnprocessableEntity'
"401":
$ref: '#/components/responses/Unauthorized'
"403":
Expand Down Expand Up @@ -9086,7 +9105,8 @@ paths:
lets the user add by hand is allowed; see `GET /beneficiaries/{beneficiary_id}/checklists/available`.
It is added through a Project, the one whose records count for actions set to "Only count
records in this project": the only Project that allows it, or `project_id` when more than one
does (required then).
does (required then). Adding one that was removed from the Contact earlier restores the
actions they had done.
operationId: addContactChecklist
security: [{tokenAuth: []}]
parameters:
Expand All @@ -9112,6 +9132,48 @@ paths:
"422":
$ref: '#/components/responses/UnprocessableEntity'

/beneficiaries/{beneficiary_id}/checklists/{checklist_id}:
delete:
tags: [Checklists]
summary: Remove a Checklist from a Contact
description: |
"Remove from this contact" in the ⋯ menu of a Checklist on the Contact's profile, for one added
by mistake or no longer relevant. It no longer shows on the Contact, in the Checklist's progress
or on Focus, and the removal is recorded on the Contact's History. The Contact's progress is
kept: adding the Checklist again (`POST /beneficiaries/{beneficiary_id}/checklists`) restores the
actions they had done, and a Project that adds the Checklist automatically won't add it back.
Allowed for Organisation Admins, and for colleagues who could add the Checklist to the Contact by
hand.
operationId: removeContactChecklist
security: [{tokenAuth: []}]
parameters:
- name: beneficiary_id
in: path
required: true
schema:
type: integer
- name: checklist_id
in: path
required: true
schema:
type: integer
responses:
"200":
description: "`{checklist_id, beneficiary_id, removed_at, removed_by_user_id}`"
content:
application/json:
example:
checklist_id: 42
beneficiary_id: 1001
removed_at: "2026-11-05T10:00:00Z"
removed_by_user_id: 7
"401":
$ref: '#/components/responses/Unauthorized'
"403":
description: "`{errors}`: the user is neither an Organisation Admin nor able to add this Checklist to the Contact"
"404":
$ref: '#/components/responses/NotFound'

/beneficiaries/{beneficiary_id}/checklists/{checklist_id}/actions/{action_id}/owner:
patch:
tags: [Checklists]
Expand Down
16 changes: 13 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2720,10 +2720,12 @@ function buildDocsPage() {
${endpointCard("PATCH", "/checklists/{id}/projects/{project_id}", "Set how a Project offers a Checklist", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Checklist ID" },
{ name: "project_id", in: "path", type: "integer", required: true, desc: "Project ID" },
{ name: "mode", type: "string", required: true, desc: "<code>none</code>, <code>manual</code> or <code>automatic</code>" }
{ name: "mode", type: "string", required: false, desc: "<code>none</code>, <code>manual</code> or <code>automatic</code>; required unless only <code>on_leave</code> is sent" },
{ name: "on_leave", type: "string", required: false, desc: "For an <code>automatic</code> Checklist, what happens when a Contact leaves the Project, moves to a closed status in it (Alumni or Declined) or is archived: <code>keep</code> (default) or <code>remove_if_incomplete</code>. A removed Checklist keeps the Contact's progress and comes back when they rejoin" }
], [
{ code: "200", cls: "response-2xx", desc: "<code>{project_id, assignment_mode}</code>" },
{ code: "404", cls: "response-4xx", desc: "A Project the user can't edit" }
{ code: "200", cls: "response-2xx", desc: "<code>{project_id, assignment_mode, on_leave}</code>" },
{ code: "404", cls: "response-4xx", desc: "A Project the user can't edit" },
{ code: "422", cls: "response-4xx", desc: "An unknown <code>mode</code>, or <code>on_leave</code> for a Checklist that isn't <code>automatic</code> in the Project" }
])}
${endpointCard("GET", "/checklists/{id}/progress", "Get a Checklist's progress", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Checklist ID" },
Expand Down Expand Up @@ -2829,6 +2831,14 @@ function buildDocsPage() {
{ code: "201", cls: "response-2xx", desc: "<code>{checklist_id, beneficiary_id, added_by_user_id, project_id, created_at}</code>" },
{ code: "422", cls: "response-4xx", desc: "That Checklist can't be added to this Contact, or no <code>project_id</code> when it can be added through several Projects" }
])}
${endpointCard("DELETE", "/beneficiaries/{beneficiary_id}/checklists/{checklist_id}", "Remove a Checklist from a Contact", true, [
{ name: "beneficiary_id", in: "path", type: "integer", required: true, desc: "Contact ID" },
{ name: "checklist_id", in: "path", type: "integer", required: true, desc: "Checklist ID" }
], [
{ code: "200", cls: "response-2xx", desc: "<code>{checklist_id, beneficiary_id, removed_at, removed_by_user_id}</code>. The Contact's progress is kept: adding the Checklist again restores it" },
{ code: "403", cls: "response-4xx", desc: "Only an Organisation Admin, or a colleague who can add this Checklist to the Contact, can remove it" },
{ code: "404", cls: "response-4xx", desc: "A Contact the user can't see, or a Checklist the Contact doesn't have" }
])}
</div>
</section>

Expand Down
Loading