diff --git a/openapi.yaml b/openapi.yaml
index 6fe77b1..36271c1 100644
--- a/openapi.yaml
+++ b/openapi.yaml
@@ -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
@@ -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]
@@ -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:
diff --git a/server.js b/server.js
index a95ca48..a604ccd 100644
--- a/server.js
+++ b/server.js
@@ -2175,6 +2175,16 @@ function buildDocsPage() {
{ code: "409", cls: "response-4xx", desc: "Nothing created: duplicates lists items you can reuse instead of the new ones, each with its question" },
{ 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: "full (default) to create and edit Contacts, create to create them only, or edit to edit them only" }
+ ], [
+ { code: "200", cls: "response-2xx", desc: "data has contact_form_id, use, added_project_ids and existing_project_ids (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 project_ids, an unknown use, 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. Youth employment" },