Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Responses type #29

Merged
merged 3 commits into from
Sep 18, 2023
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
32 changes: 32 additions & 0 deletions examples/data/Responses.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import {Schema} from '../../types/Schema';

export const validResponses: Schema['responses'] = [
{
metadata: {
sectionName: 'The property',
autoAnswered: true,
},
question: 'Is the property in London Borough of Southwark?',
responses: [
{
value: 'Yes',
},
],
},
{
metadata: {
policyRefs: [
{
text: 'Town and Country Planning Act 1990, Part 7, Section 191 & Section 192',
},
],
sectionName: 'About the project',
},
question: 'What are you applying about?',
responses: [
{
value: 'Proposed changes I want to make in the future',
},
],
},
];
20 changes: 9 additions & 11 deletions examples/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {validAgent, validApplicant} from './data/Applicant';
import {validApplication} from './data/Application';
import {validProperty} from './data/Property';
import {validProposal} from './data/Proposal';
import {validResponses} from './data/Responses';

const validMetadata: Schema['metadata'] = {
service: {
Expand Down Expand Up @@ -45,14 +46,15 @@ const validFiles: Schema['files'] = [
},
];

const validResult = [
const validResult: Schema['result'] = [
{
value: "Planning permission / Permitted development",
description: "It looks like the proposed changes may fall within the rules for Permitted Development and therefore would not need planning permission."
value: 'Planning permission / Permitted development',
description:
'It looks like the proposed changes may fall within the rules for Permitted Development and therefore would not need planning permission.',
},
{
value: "Listed building consent / Not required",
description: "",
value: 'Listed building consent / Not required',
description: '',
},
];

Expand All @@ -68,9 +70,7 @@ export const validExampleApplicant: Schema = {
},
result: validResult,
metadata: validMetadata,
responses: {
name: 'Test',
},
responses: validResponses,
files: validFiles,
};

Expand All @@ -86,8 +86,6 @@ export const validExampleAgent: Schema = {
},
result: validResult,
metadata: validMetadata,
responses: {
name: 'Test',
},
responses: validResponses,
files: validFiles,
};
46 changes: 40 additions & 6 deletions examples/validExampleAgent.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,16 @@
"description": "This is a test application"
}
},
"result": {
"name": "Test"
},
"result": [
{
"value": "Planning permission / Permitted development",
"description": "It looks like the proposed changes may fall within the rules for Permitted Development and therefore would not need planning permission."
},
{
"value": "Listed building consent / Not required",
"description": ""
}
],
"metadata": {
"service": {
"publishedFlowId": "b3320abe-f5bc-4185-b61f-40e9e65f07ad",
Expand All @@ -151,9 +158,36 @@
"submittedAt": "2018-11-13T20:20:39+00:00"
}
},
"responses": {
"name": "Test"
},
"responses": [
{
"metadata": {
"sectionName": "The property",
"autoAnswered": true
},
"question": "Is the property in London Borough of Southwark?",
"responses": [
{
"value": "Yes"
}
]
},
{
"metadata": {
"policyRefs": [
{
"text": "Town and Country Planning Act 1990, Part 7, Section 191 & Section 192"
}
],
"sectionName": "About the project"
},
"question": "What are you applying about?",
"responses": [
{
"value": "Proposed changes I want to make in the future"
}
]
}
],
"files": [
{
"name": "https://api.editor.planx.uk/file/private/folderId/file1.pdf",
Expand Down
46 changes: 40 additions & 6 deletions examples/validExampleApplicant.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,16 @@
"description": "This is a test application"
}
},
"result": {
"name": "Test"
},
"result": [
{
"value": "Planning permission / Permitted development",
"description": "It looks like the proposed changes may fall within the rules for Permitted Development and therefore would not need planning permission."
},
{
"value": "Listed building consent / Not required",
"description": ""
}
],
"metadata": {
"service": {
"publishedFlowId": "b3320abe-f5bc-4185-b61f-40e9e65f07ad",
Expand All @@ -124,9 +131,36 @@
"submittedAt": "2018-11-13T20:20:39+00:00"
}
},
"responses": {
"name": "Test"
},
"responses": [
{
"metadata": {
"sectionName": "The property",
"autoAnswered": true
},
"question": "Is the property in London Borough of Southwark?",
"responses": [
{
"value": "Yes"
}
]
},
{
"metadata": {
"policyRefs": [
{
"text": "Town and Country Planning Act 1990, Part 7, Section 191 & Section 192"
}
],
"sectionName": "About the project"
},
"question": "What are you applying about?",
"responses": [
{
"value": "Proposed changes I want to make in the future"
}
]
}
],
"files": [
{
"name": "https://api.editor.planx.uk/file/private/folderId/file1.pdf",
Expand Down
Loading
Loading