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
141 changes: 141 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4051,6 +4051,69 @@ paths:
$ref: '#/components/schemas/SignupPageList'
"401":
$ref: '#/components/responses/Unauthorized'
post:
tags: [Signup Pages]
summary: Make a Signup Page
description: |
Makes a Signup Page as the **New Signup Page** screen does, active unless `active: false`.
Only Organisation Editors can (403 otherwise). Returns the Signup Page in the list's shape,
with its `public_link`.

- **Fixed** (`type: fixed`): Individual A is the person signing up, with `project_id`,
`beneficiary_state_id` (project status), `contact_form_id` and `surveys`. Each entry in
`individuals` adds Individual B, C, ... in that order, related to Individual A through
one of the Organisation's Relationship Categories (`relationship` is its parent or child
title, e.g. "Child"). The Organisation needs at least one Relationship Category.
- **Flexible** (`type: flexible`): each entry in `audiences` is a Beneficiary Role
respondents can add any number of people as, in any order. Each audience must be a role
with a permitted relationship (role-holder relationship) in the Organisation. The first
audience's project, status and Contact Form are the Signup Page's own unless given.

Every Project, Contact Form, Relationship Category and audience must be the
Organisation's, and each survey one its Project collects (with `wave_id` one of that
survey's waves). Otherwise the response is 422, naming each problem in `errors`.
operationId: createReferralLinkDetail
security: [{tokenAuth: []}]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SignupPageCreateRequest'
example:
charity_id: 42
name: "Family signup"
type: fixed
project_id: 7
beneficiary_state_id: 1
contact_form_id: 155
surveys: [{ id: 391, wave_id: 12 }]
thank_you_message: "Thanks for signing up!"
individuals:
- relationship_category_id: 3
relationship: "Child"
project_id: 8
beneficiary_state_id: 1
contact_form_id: 156
responses:
"201":
description: The new Signup Page
content:
application/json:
schema:
$ref: '#/components/schemas/SignupPage'
"401":
$ref: '#/components/responses/Unauthorized'
"403":
description: You're in the Organisation but aren't an Organisation Editor
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
"404":
$ref: '#/components/responses/NotFound'
"422":
$ref: '#/components/responses/UnprocessableEntity'

/referral_link_details/{id}/definition:
get:
Expand Down Expand Up @@ -16490,6 +16553,84 @@ components:
format: email
- $ref: '#/components/schemas/SignupPageEmail'

SignupPageCreateRequest:
type: object
required: [charity_id, name, type]
properties:
charity_id:
type: integer
description: The Organisation
name:
type: string
type:
type: string
enum: [fixed, flexible]
active:
type: boolean
default: true
project_id:
type: integer
description: Individual A's Project (fixed), or the Signup Page's (flexible; defaults to the first audience's)
beneficiary_state_id:
type: integer
description: The project status (Beneficiary State) people are added with
contact_form_id:
type: integer
description: Individual A's Contact Form (Beneficiary Category)
surveys:
$ref: '#/components/schemas/SignupPageSurveyChoice'
description:
type: string
thank_you_message:
type: string
individuals:
type: array
description: Fixed only. Individual B, C, ... in order
items:
type: object
properties:
relationship_category_id:
type: integer
relationship:
type: string
description: The Relationship Category's parent or child title for this individual, e.g. "Child"
project_id:
type: integer
beneficiary_state_id:
type: integer
contact_form_id:
type: integer
surveys:
$ref: '#/components/schemas/SignupPageSurveyChoice'
audiences:
type: array
description: Flexible only. One per audience (Beneficiary Role)
items:
type: object
properties:
beneficiary_role_id:
type: integer
project_id:
type: integer
beneficiary_state_id:
type: integer
contact_form_id:
type: integer
surveys:
$ref: '#/components/schemas/SignupPageSurveyChoice'

SignupPageSurveyChoice:
type: array
description: Surveys (Story Categories) the Project collects, each optionally with one of its waves
items:
type: object
required: [id]
properties:
id:
type: integer
wave_id:
type: integer

SignupPageEmailSettingsRequest:
type: object
properties:
Expand Down
20 changes: 19 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ function buildDocsPage() {
<a href="#organisations" class="nav-link"><span class="nav-method method-GET">GET</span>Organisations</a>
<a href="#projects" class="nav-link"><span class="nav-method method-GET">GET</span>Projects</a>
<a href="#albums" class="nav-link"><span class="nav-method method-GET">GET</span>Albums (Portfolios)</a>
<a href="#signup-pages" class="nav-link"><span class="nav-method method-GET">GET</span>Signup Pages</a>
<a href="#signup-pages" class="nav-link"><span class="nav-method method-POST">POST</span>Signup Pages</a>
<a href="#users" class="nav-link"><span class="nav-method method-POST">POST</span>Users</a>
<a href="#contacts" class="nav-link"><span class="nav-method method-POST">POST</span>Contacts</a>
<a href="#contact-forms" class="nav-link"><span class="nav-method method-GET">GET</span>Contact Bio Forms</a>
Expand Down Expand Up @@ -1400,6 +1400,24 @@ function buildDocsPage() {
{ code: "200", cls: "response-2xx", desc: "Paginated list of Signup Pages, ordered by name" },
{ code: "401", cls: "response-4xx", desc: "Not authenticated" }
], "What the <b>Manage Sign-up Pages</b> table shows for each Signup Page: <code>type</code> (<code>fixed</code> or <code>flexible</code>), <code>status</code> and <code>active</code>, <code>public_link</code> (the customised link when there is one), <code>emails_enabled</code>, who created and last updated it and when, and <code>individuals</code>: each individual or audience with its Contact Form, Project, project status, Surveys and any Wave, and <code>send_emails</code>. Deactivated Signup Pages are included.")}
${endpointCard("POST", "/referral_link_details", "Make a Signup Page", true, [
{ name: "charity_id", in: "body", type: "integer", required: true, desc: "The Organisation. You must be an Organisation Editor of it" },
{ name: "name", in: "body", type: "string", required: true, desc: "The Signup Page's name" },
{ name: "type", in: "body", type: "string", required: true, desc: "<code>fixed</code> or <code>flexible</code>" },
{ name: "active", in: "body", type: "boolean", required: false, desc: "Default <code>true</code>" },
{ name: "project_id", in: "body", type: "integer", required: false, desc: "Individual A's Project (fixed). For flexible, defaults to the first audience's" },
{ name: "beneficiary_state_id", in: "body", type: "integer", required: false, desc: "The project status people are added with" },
{ name: "contact_form_id", in: "body", type: "integer", required: false, desc: "Individual A's Contact Form" },
{ name: "surveys", in: "body", type: "object[]", required: false, desc: "<code>{id, wave_id}</code>: Surveys the Project collects, each with an optional Wave" },
{ name: "individuals", in: "body", type: "object[]", required: false, desc: "Fixed: Individual B, C, ... each with <code>relationship_category_id</code>, <code>relationship</code> (its parent or child title, e.g. <code>Child</code>), <code>project_id</code>, <code>beneficiary_state_id</code>, <code>contact_form_id</code> and <code>surveys</code>" },
{ name: "audiences", in: "body", type: "object[]", required: false, desc: "Flexible: one per audience with <code>beneficiary_role_id</code>, <code>project_id</code>, <code>beneficiary_state_id</code>, <code>contact_form_id</code> and <code>surveys</code>" }
], [
{ code: "201", cls: "response-2xx", desc: "The new Signup Page, as the list shows it, with its <code>public_link</code>" },
{ code: "401", cls: "response-4xx", desc: "Not authenticated" },
{ code: "403", cls: "response-4xx", desc: "You aren't an Organisation Editor" },
{ code: "404", cls: "response-4xx", desc: "An Organisation you aren't in" },
{ code: "422", cls: "response-4xx", desc: "<code>{errors: [...]}</code> naming each problem, e.g. no Relationship Category for a fixed Signup Page, an audience without a permitted relationship, or another Organisation's Project or Contact Form" }
], "Makes a Signup Page as the <b>New Signup Page</b> screen does. A <b>fixed</b> Signup Page needs the Organisation to have a Relationship Category; each audience on a <b>flexible</b> one needs a permitted relationship.")}
${endpointCard("GET", "/referral_link_details/{id}/definition", "Get a Signup Page's Form Definition", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Signup Page ID" }
], [
Expand Down
Loading