diff --git a/openapi.yaml b/openapi.yaml index d7a63bd..6f42684 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -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:` or `team:`" + 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] diff --git a/server.js b/server.js index 05bff69..4495236 100644 --- a/server.js +++ b/server.js @@ -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 responsible value" } ], "The Progress section of the Checklist's profile page, Table and Board. completed: Contacts who have done the action. furthest: Contacts for whom it is the furthest action done. waiting: 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: "completed, furthest or waiting (the Table's lists for action_id), board (the Board column for action_id) or complete (Fully complete)" }, + { name: "action_id", type: "integer", required: false, desc: "The action whose list it is; required for every list but complete" }, + { 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: me, user:<id> or team:<id>" }, + { 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 {page, page_size, page_count, total_count, data}: each Contact as {beneficiary_id, name, actions_done}, plus days_waiting, overdue, skipped_a_step and responsible in the waiting and board 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 list, a missing or unknown action_id, or an unknown responsible value" } + ], "The rest of each list after the first 30 that GET /checklists/{id}/progress 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" } ], [