Skip to content

Commit

Permalink
feat: Responses type (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak authored Sep 18, 2023
1 parent 9f82de2 commit 724d0d4
Show file tree
Hide file tree
Showing 8 changed files with 814 additions and 62 deletions.
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

0 comments on commit 724d0d4

Please sign in to comment.