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
94 changes: 92 additions & 2 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6348,7 +6348,7 @@ paths:
type: string
field_data_type:
type: string
enum: [text, number, date, time, file, section_title, email_address, telephone]
enum: [text, number, date, time, file, section_title, email_address, telephone, signature]
section_text:
type: string
description: For a section_title Field only
Expand Down Expand Up @@ -6818,6 +6818,96 @@ paths:
"422":
$ref: '#/components/responses/UnprocessableEntity'

/contact_forms/{id}/projects:
post:
tags: [Library, Beneficiary Categories]
summary: Add a Contact Form to projects
operationId: addContactFormToProjects
description: |
Adds a Contact Form (Beneficiary Category) to projects, as **Add form to project** on a
Contact Form's page does, so staff in those projects use it when they add or edit Contacts.

`use` says how each project uses it: `full` (the default) to create new Contacts and edit
existing ones, `create` to create new Contacts only, or `edit` to edit existing Contacts
only. Organisation Admins and Project Managers may then edit what it holds. Only the
project's Contact Form settings change.

- Each project must belong to the form's organisation, and you must be able to change its
Project Preferences: an Organisation Admin, or the project's manager. Otherwise `404`,
naming the project.
- A form that doesn't exist is `404`; an organisation that doesn't use Contact Forms is `422`.

Every project is checked first, so if one is refused none is changed. A project that
already uses the form that way is left as it is and listed in `existing_project_ids`.
security: [{tokenAuth: []}]
parameters:
- name: id
in: path
required: true
schema:
type: integer
description: The Contact Form's (Beneficiary Category's) id
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [project_ids]
properties:
project_ids:
type: array
minItems: 1
items:
type: integer
description: The projects to add it to
use:
type: string
enum: [full, create, edit]
default: full
description: How the projects use it
example:
project_ids: [4021, 4022]
use: create
responses:
"200":
description: The form is in every project given
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
contact_form_id:
type: integer
use:
type: string
enum: [full, create, edit]
added_project_ids:
type: array
items:
type: integer
description: Projects the form was added to now
existing_project_ids:
type: array
items:
type: integer
description: Projects that already used it that way
example:
data:
contact_form_id: 2391
use: create
added_project_ids: [4021]
existing_project_ids: [4022]
"401":
$ref: '#/components/responses/Unauthorized'
"404":
$ref: '#/components/responses/NotFound'
"422":
$ref: '#/components/responses/UnprocessableEntity'

/impact_frameworks:
post:
tags: [Library]
Expand Down Expand Up @@ -13024,7 +13114,7 @@ components:
type: string
field_data_type:
type: string
enum: [text, number, date, time, file, section_title, email_address, telephone]
enum: [text, number, date, time, file, section_title, email_address, telephone, signature]
section_text:
type: string
private:
Expand Down
10 changes: 10 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2175,6 +2175,16 @@ function buildDocsPage() {
{ code: "409", cls: "response-4xx", desc: "Nothing created: <code>duplicates</code> lists items you can reuse instead of the new ones, each with its <code>question</code>" },
{ code: "422", cls: "response-4xx", desc: "Invalid input; nothing is created and the error names the field" }
], "A Contact Form (Beneficiary Category). Reuse Fields and Lists by id, and define only what's missing.")}
${endpointCard("POST", "/contact_forms/{id}/projects", "Add a Contact Form to projects", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "The Contact Form's (Beneficiary Category's) id" },
{ name: "project_ids", in: "body", type: "array", required: true, desc: "The projects to add it to: in the form's organisation, and ones whose Project Preferences you can change" },
{ name: "use", in: "body", type: "string", required: false, desc: "<code>full</code> (default) to create and edit Contacts, <code>create</code> to create them only, or <code>edit</code> to edit them only" }
], [
{ code: "200", cls: "response-2xx", desc: "<code>data</code> has <code>contact_form_id</code>, <code>use</code>, <code>added_project_ids</code> and <code>existing_project_ids</code> (projects that already used it that way)" },
{ code: "401", cls: "response-4xx", desc: "Missing or invalid token" },
{ code: "404", cls: "response-4xx", desc: "The form, or a project, isn't one you can use; the error names it. Nothing is changed" },
{ code: "422", cls: "response-4xx", desc: "No <code>project_ids</code>, an unknown <code>use</code>, or an organisation that doesn't use Contact Forms. Nothing is changed" }
], "The same as Add form to project on a Contact Form's page. Only the project's Contact Form settings change.")}
${endpointCard("POST", "/impact_frameworks", "Create an Impact Framework with its entries", true, [
{ name: "organisation_id", in: "body", type: "integer", required: true, desc: "The organisation (Charity) that will own it; you must be one of its editors" },
{ name: "name", in: "body", type: "string", required: true, desc: "e.g. <code>Youth employment</code>" },
Expand Down
Loading