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
71 changes: 71 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8525,6 +8525,77 @@ paths:
"422":
$ref: '#/components/responses/UnprocessableEntity'

/checklists/{id}/progress/contacts:
get:
tags: [Checklists]
summary: List every Contact behind one of a Checklist's progress counts
description: |
Every Contact behind one count of the Checklist's Progress section, a page at a time, as the
**Show N more** buttons on the Checklist's page do. `GET /checklists/{id}/progress` lists only the
first `list_limit` (30) of each list; use this to get the rest. Choose the list with `list`:

- `completed`, `furthest` or `waiting`: the Table's lists for the action `action_id`: who has
done it, for whom it is the furthest action done, and who is waiting on it
- `board`: the Board's column for the action `action_id` (those waiting on it, longest waiting first)
- `complete`: the Board's Fully complete column (no `action_id`)

Each Contact is `{beneficiary_id, name, actions_done}`. In the `waiting` and `board` lists each
also has `days_waiting`, `overdue`, `skipped_a_step` and `responsible`. The same `project_id` and
`responsible` filters as `GET /checklists/{id}/progress` apply. Only Contacts the user can see are
counted. `per_page` is at most 200.
operationId: listChecklistProgressContacts
security: [{tokenAuth: []}]
parameters:
- name: id
in: path
required: true
schema:
type: integer
- name: list
in: query
required: true
schema:
type: string
enum: [completed, furthest, waiting, board, complete]
- name: action_id
in: query
required: false
description: The action whose list it is. Required for every list but `complete`
schema:
type: integer
- name: project_id
in: query
required: false
description: Count only the Contacts in this Project, which must be one the Checklist is added to
schema:
type: integer
- name: responsible
in: query
required: false
description: "Count only the Contacts whose waiting action this person or Team is responsible for: `me`, `user:<id>` or `team:<id>`"
schema:
type: string
- $ref: '#/components/parameters/Page'
- $ref: '#/components/parameters/PerPage'
responses:
"200":
description: One page of the list, in the usual envelope
content:
application/json:
example:
page: 2
page_size: 1
page_count: 2
total_count: 31
data:
- {beneficiary_id: 903, name: "Mpho Sithole", actions_done: 0, days_waiting: 9, overdue: true, skipped_a_step: false, responsible: "Anyone in Youth Workers"}
"401":
$ref: '#/components/responses/Unauthorized'
"404":
$ref: '#/components/responses/NotFound'
"422":
$ref: '#/components/responses/UnprocessableEntity'

/checklists/{id}/journey:
get:
tags: [Checklists]
Expand Down
13 changes: 13 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2651,6 +2651,19 @@ function buildDocsPage() {
{ code: "404", cls: "response-4xx", desc: "Not found, another Organisation's, or a Project the Checklist isn't added to" },
{ code: "422", cls: "response-4xx", desc: "An unknown <code>responsible</code> value" }
], "The Progress section of the Checklist's profile page, Table and Board. <code>completed</code>: Contacts who have done the action. <code>furthest</code>: Contacts for whom it is the furthest action done. <code>waiting</code>: Contacts for whom it is the first action not done, so someone who did steps 1 and 3 is waiting on step 2. Only Contacts the user can see are counted.")}
${endpointCard("GET", "/checklists/{id}/progress/contacts", "List every Contact behind a progress count", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Checklist ID" },
{ name: "list", type: "string", required: true, desc: "<code>completed</code>, <code>furthest</code> or <code>waiting</code> (the Table's lists for <code>action_id</code>), <code>board</code> (the Board column for <code>action_id</code>) or <code>complete</code> (Fully complete)" },
{ name: "action_id", type: "integer", required: false, desc: "The action whose list it is; required for every list but <code>complete</code>" },
{ name: "project_id", type: "integer", required: false, desc: "Only Contacts in this Project, one the Checklist is added to" },
{ name: "responsible", type: "string", required: false, desc: "Only Contacts whose waiting action this person or Team is responsible for: <code>me</code>, <code>user:&lt;id&gt;</code> or <code>team:&lt;id&gt;</code>" },
{ name: "page", type: "integer", required: false, desc: "Page number (default 1)" },
{ name: "per_page", type: "integer", required: false, desc: "Contacts per page (default 10, max 200)" }
], [
{ code: "200", cls: "response-2xx", desc: "Paginated <code>{page, page_size, page_count, total_count, data}</code>: each Contact as <code>{beneficiary_id, name, actions_done}</code>, plus <code>days_waiting</code>, <code>overdue</code>, <code>skipped_a_step</code> and <code>responsible</code> in the <code>waiting</code> and <code>board</code> lists" },
{ code: "404", cls: "response-4xx", desc: "Not found, another Organisation's, or a Project the Checklist isn't added to" },
{ code: "422", cls: "response-4xx", desc: "An unknown <code>list</code>, a missing or unknown <code>action_id</code>, or an unknown <code>responsible</code> value" }
], "The rest of each list after the first 30 that <code>GET /checklists/{id}/progress</code> gives, as the Show N more buttons on the Checklist's page do. Only Contacts the user can see are counted.")}
${endpointCard("GET", "/beneficiaries/{beneficiary_id}/checklists", "Get a Contact's Checklists", true, [
{ name: "beneficiary_id", in: "path", type: "integer", required: true, desc: "Contact ID" }
], [
Expand Down
Loading