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

fix: rename Result to PreAssessment #66

Merged
merged 1 commit into from
Nov 8, 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
2 changes: 1 addition & 1 deletion examples/data/ldcE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ export const validLDCE: Schema = {
date: {},
},
},
result: [
preAssessment: [
{
value: 'Planning permission / Immune',
description:
Expand Down
2 changes: 1 addition & 1 deletion examples/data/ldcP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export const validLDCP: Schema = {
},
},
},
result: [
preAssessment: [
{
value: 'Planning permission / Permitted development',
description:
Expand Down
2 changes: 1 addition & 1 deletion examples/data/planningPermission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ export const validPlanningPermission: Schema = {
},
},
},
result: [],
preAssessment: [],
responses: [
{
question: 'Is the property in Lambeth?',
Expand Down
2 changes: 1 addition & 1 deletion examples/data/priorApproval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export const validPriorApproval: Schema = {
},
},
},
result: [
preAssessment: [
{
value: 'Planning permission / Prior approval',
description:
Expand Down
27 changes: 13 additions & 14 deletions schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5362,6 +5362,14 @@
],
"type": "object"
},
"PreAssessment": {
"$id": "#PreAssessment",
"description": "The result of the application based on information provided by the applicant, prior to assessment by a planning officer. Results are determined by flags corresponding to responses; each application can have up to one result per flagset",
"items": {
"$ref": "#/definitions/ResultFlag"
},
"type": "array"
},
"ProjectType": {
"$id": "#ProjectType",
"anyOf": [
Expand Down Expand Up @@ -17571,14 +17579,6 @@
},
"type": "array"
},
"Result": {
"$id": "#Result",
"description": "The result of the application. Results are determined by flags corresponding to responses; each application can have up to one result per flagset",
"items": {
"$ref": "#/definitions/ResultFlag"
},
"type": "array"
},
"ResultFlag": {
"$id": "#ResultFlag",
"anyOf": [
Expand Down Expand Up @@ -18827,19 +18827,18 @@
"metadata": {
"$ref": "#/definitions/Metadata"
},
"preAssessment": {
"$ref": "#/definitions/PreAssessment"
},
"responses": {
"$ref": "#/definitions/Responses"
},
"result": {
"$ref": "#/definitions/Result"
}
},
"required": [
"data",
"result",
"metadata",
"responses",
"files"
"files",
"metadata"
],
"title": "Digital Planning Application",
"type": "object"
Expand Down
8 changes: 4 additions & 4 deletions types/Schema.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {Result} from './schema/Result';
import {File} from './schema/File';
import {Metadata} from './schema/Metadata';
import {PreAssessment} from './schema/PreAssessment';
import {Responses} from './schema/Responses';
import {Applicant} from './schema/data/Applicant';
import {Application} from './schema/data/Application';
import {Property} from './schema/data/Property';
import {Proposal} from './schema/data/Proposal';
import {User} from './schema/data/User';
import {File} from './schema/File';

/**
* @title Digital Planning Application
Expand All @@ -20,8 +20,8 @@ export interface Schema {
property: Property;
proposal: Proposal;
};
result: Result;
metadata: Metadata;
preAssessment?: PreAssessment;
responses: Responses;
files: File[];
metadata: Metadata;
}
24 changes: 24 additions & 0 deletions types/schema/PreAssessment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {Flags} from '../enums/Flags';

/**
* @id #PreAssessment
* @description The result of the application based on information provided by the applicant, prior to assessment by a planning officer. Results are determined by flags corresponding to responses; each application can have up to one result per flagset
*/
export type PreAssessment = ResultFlag[]; // @todo validate/restrict array to one result per flagset

type FlagKeys = keyof typeof Flags;

type GenericFlag<TKey extends FlagKeys> = {
value: TKey;
description: (typeof Flags)[TKey];
};

type FlagMap = {
[K in FlagKeys]: GenericFlag<K>;
};

/**
* @id #ResultFlag
* @description The result of a single flagset
*/
export type ResultFlag = FlagMap[keyof FlagMap];
24 changes: 0 additions & 24 deletions types/schema/Result.ts

This file was deleted.

Loading