Skip to content
Closed
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
64 changes: 64 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1903,6 +1903,70 @@ paths:
$ref: '#/components/responses/NotFound'
"422":
$ref: '#/components/responses/UnprocessableEntityList'
post:
tags: [Beneficiaries]
summary: Create a Relationship Category
description: |
Adds a kind of relationship Contacts can have with each other, as the New Relationship Type
page does: its two sides, e.g. Parent & Child or Client & Emergency Contact. A fixed Signup
Page needs at least one to connect the people it signs up.

Only organisation editors (Organisation Admins) may create them (`403` otherwise). The same
pair of titles can't exist twice in an organisation, whatever their case: `422` then gives
`existing_id`, the one already there, to reuse. List them first with
`GET /relationship_categories`. `charity_id` may be left out when the user belongs to one
organisation.
operationId: createRelationshipCategory
security: [{tokenAuth: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [parent_title, child_title]
properties:
charity_id:
type: integer
description: The organisation to add it to
parent_title:
type: string
description: The first side, e.g. Parent
child_title:
type: string
description: The second side, e.g. Child
example:
charity_id: 12
parent_title: Parent
child_title: Child
responses:
"201":
description: The Relationship Category made
content:
application/json:
schema: { $ref: '#/components/schemas/RelationshipCategory' }
"401":
$ref: '#/components/responses/Unauthorized'
"403":
$ref: '#/components/responses/ForbiddenError'
"404":
$ref: '#/components/responses/NotFound'
"422":
description: Validation failed, or the pair of titles already exists
content:
application/json:
schema:
type: object
properties:
errors:
type: array
items: { type: string }
existing_id:
type: integer
description: The Relationship Category with these titles already, when that is why
example:
errors: ["Already exists"]
existing_id: 34
/beneficiaries/bulk_actions/{id}:
get:
tags: [Beneficiaries]
Expand Down
11 changes: 11 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -1604,6 +1604,17 @@ function buildDocsPage() {
{ code: "401", cls: "response-4xx", desc: "Not authenticated" },
{ code: "404", cls: "response-4xx", desc: "An organisation you aren't in" }
], "The kinds of relationship Contacts can have with each other in the organisation. Any member of the organisation can list them.")}
${endpointCard("POST", "/relationship_categories", "Create a Relationship Category", true, [
{ name: "charity_id", in: "body", type: "integer", required: false, desc: "The organisation. Optional if you belong to only one" },
{ name: "parent_title", in: "body", type: "string", required: true, desc: "The first side, e.g. Parent" },
{ name: "child_title", in: "body", type: "string", required: true, desc: "The second side, e.g. Child" }
], [
{ code: "201", cls: "response-2xx", desc: "The category made: <code>id</code>, <code>parent_title</code>, <code>child_title</code>" },
{ code: "401", cls: "response-4xx", desc: "Not authenticated" },
{ code: "403", cls: "response-4xx", desc: "You aren't an organisation editor (Organisation Admin)" },
{ code: "404", cls: "response-4xx", desc: "An organisation you aren't in" },
{ code: "422", cls: "response-4xx", desc: "A title is missing, or the pair already exists in any case: <code>existing_id</code> is the one already there, to reuse" }
], "<strong>New Relationship Type</strong> on the organisation's Relationship Types page, e.g. Parent &amp; Child or Client &amp; Emergency Contact. A fixed Signup Page needs one to connect the people it signs up. List them first and reuse one that fits.")}
${endpointCard("GET", "/beneficiaries/bulk_actions/{id}", "Get the progress of a bulk action on Contacts", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "The <code>id</code> returned by a bulk change, e.g. <code>POST /events/{id}/guests</code> with <code>filter_data</code>" }
], [
Expand Down
Loading