Skip to content
Open
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
1,027 changes: 861 additions & 166 deletions openapi/openapi-v2.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": false,
"required": ["data"],
"properties": {
"data": {
"type": "object",
"additionalProperties": false,
"required": ["id", "type", "attributes"],
"properties": {
"id": {
"$ref": "../../../../models/definitions/uuid-v4.json"
},
"type": {
"const": "submissions"
},
"attributes": {
"type": "object",
"additionalProperties": false,
"required": ["questionnaireId", "submitted", "status", "caseReferenceNumber"],
"properties": {
"questionnaireId": {
"$ref": "../../../../models/definitions/uuid-v4.json"
},
"submitted": {
"type": "boolean"
},
"status": {
"enum": ["NOT_STARTED", "IN_PROGRESS", "COMPLETED", "FAILED"]
},
"caseReferenceNumber": {
"type": ["string", "null"],
"pattern": "^[0-9]{2}\\\\[0-9]{6}$"
}
}
}
}
},
"meta": {
"type": "object"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": false,
"required": ["data"],
"properties": {
"data": {
"type": "object",
"additionalProperties": false,
"required": ["type", "attributes"],
"properties": {
"type": {
"const": "submissions"
},
"attributes": {
"type": "object",
"additionalProperties": false,
"properties": {
"questionnaireId": {
"$ref": "../../../../models/definitions/uuid-v4.json"
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": false,
"required": ["data"],
"properties": {
"data": {
"type": "object",
"additionalProperties": false,
"required": ["id", "type", "attributes"],
"properties": {
"id": {
"$ref": "../../../../models/definitions/uuid-v4.json"
},
"type": {
"const": "submissions"
},
"attributes": {
"type": "object",
"additionalProperties": false,
"required": ["questionnaireId", "submitted", "status", "caseReferenceNumber"],
"properties": {
"questionnaireId": {
"$ref": "../../../../models/definitions/uuid-v4.json"
},
"submitted": {
"type": "boolean"
},
"status": {
"enum": ["NOT_STARTED", "IN_PROGRESS", "COMPLETED", "FAILED"]
},
"caseReferenceNumber": {
"type": ["string", "null"],
"pattern": "^[0-9]{2}\\\\[0-9]{6}$"
}
}
}
}
},
"meta": {
"type": "object"
}
}
}
152 changes: 152 additions & 0 deletions openapi/src/openapi-src-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
},
{
"name": "Sessions"
},
{
"name": "Submissions"
}
],
"paths": {
Expand Down Expand Up @@ -509,6 +512,136 @@
}
}
}
},
"/questionnaires/{questionnaireId}/submissions": {
"get": {
"tags": ["Submissions"],
"summary": "Get submission resource for a questionnaire",
"description": "Gets submission state for a questionnaire",
"operationId": "getSubmissions",
"parameters": [
{
"$ref": "#/components/parameters/questionnaireId"
},
{
"$ref": "#/components/parameters/onBehalfOf"
},
{
"$ref": "#/components/parameters/apiVersion"
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/vnd.api+json": {
"schema": {
"$ref": "./json-schemas/api/v2_questionnaires_{questionnaireId}_submissions/get/res/200.json"
},
"example": {
"data": {
"id": "285cb104-0c15-4a9c-9840-cb1007f098fb",
"type": "submissions",
"attributes": {
"questionnaireId": "285cb104-0c15-4a9c-9840-cb1007f098fb",
"submitted": false,
"status": "IN_PROGRESS",
"caseReferenceNumber": "11\\111111"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
}
},
"post": {
"tags": ["Submissions"],
"summary": "Submit a questionnaire",
"description": "Start the submission of a questionnaire",
"operationId": "SubmitQuestionnaire",
"parameters": [
{
"$ref": "#/components/parameters/questionnaireId"
},
{
"$ref": "#/components/parameters/onBehalfOf"
},
{
"$ref": "#/components/parameters/apiVersion"
}
],
"requestBody": {
"description": "Questionnaire ID",
"required": true,
"content": {
"application/vnd.api+json": {
"schema": {
"$ref": "./json-schemas/api/v2_questionnaires_{questionnaireId}_submissions/post/req/201.json"
},
"example": {
"data": {
"type": "submissions",
"attributes": {
"questionnaireId": "285cb104-0c15-4a9c-9840-cb1007f098fb"
}
}
}
}
}
},
"responses": {
"201": {
"description": "Created",
"content": {
"application/vnd.api+json": {
"schema": {
"$ref": "./json-schemas/api/_questionnaires_{questionnaireId}_submissions/post/res/201.json"
},
"example": {
"data": {
"id": "285cb104-0c15-4a9c-9840-cb1007f098fb",
"type": "submissions",
"attributes": {
"questionnaireId": "285cb104-0c15-4a9c-9840-cb1007f098fb",
"submitted": true,
"status": "IN_PROGRESS",
"caseReferenceNumber": "11\\111111"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"409": {
"$ref": "#/components/responses/Conflict"
}
}
}
}
},
"components": {
Expand Down Expand Up @@ -662,6 +795,25 @@
}
}
}
},
"Conflict": {
"description": "Conflict",
"content": {
"application/vnd.api+json": {
"schema": {
"$ref": "./json-schemas/api/responses/409.json"
},
"example": {
"errors": [
{
"status": 409,
"title": "409 conflict",
"detail": "Submission resource with ID \"68653be7-877f-4106-b91e-4ba8dac883f3\" already exists"
}
]
}
}
}
}
}
}
Expand Down
18 changes: 15 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"pino-http": "^5.5.0",
"q-expressions": "github:CriminalInjuriesCompensationAuthority/q-expressions",
"q-router": "github:CriminalInjuriesCompensationAuthority/q-router#v3.0.2",
"q-templates-application": "github:CriminalInjuriesCompensationAuthority/q-templates-application#v10.1.1",
"q-templates-application-release": "github:CriminalInjuriesCompensationAuthority/q-templates-application#v10.1.1",
"q-templates-application-feature": "github:CriminalInjuriesCompensationAuthority/q-templates-application#bp-save-and-return",
"swagger-ui-express": "^4.6.3",
"uuid": "^3.3.2",
"verror": "^1.10.0"
Expand Down
2 changes: 1 addition & 1 deletion questionnaire/dataset/dataset-service.declaration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const templates = require('../templates');
const questionnaireFixtures = require('./test-fixtures');
const createDatasetService = require('./dataset-service');

const templateInstance = templates['sexual-assault']('648f4664-7233-4b66-89f3-ef6e1d2f5fa8');
const templateInstance = templates['release-questionnaire']('648f4664-7233-4b66-89f3-ef6e1d2f5fa8');
const sectionDefinitions = {
applicantDeclaration: templateInstance.sections['p-applicant-declaration'],
mainApplicantDeclarationUnder12:
Expand Down
Loading