Skip to content

Commit

Permalink
feat: Refactor for updated STOS JSON data model (#1630)
Browse files Browse the repository at this point in the history
  • Loading branch information
john-fletcher-aot authored Oct 8, 2024
1 parent 97e4370 commit 2ef35fe
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion policy-engine/src/_examples/validate-invalid-tros.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async function start() {

// Set duration to 31 days (an invalid duration)
validTros30Day.permitData.permitDuration = 31;

const validationResult2 = await policy.validate(validTros30Day);
console.log(JSON.stringify(validationResult2, null, ' '));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,17 @@ type PermitData = {
feeSummary?: string | null;
startDate: string;
expiryDate?: string | null;
permittedCommodity?: string | null;
permittedCommodity?: PermittedCommodity | null;
vehicleConfiguration?: VehicleConfiguration | null;
permittedRoute?: PermittedRoute | null;
applicationNotes?: string | null;
};

type PermittedCommodity = {
commodityType: string;
loadDescription: string;
};

type VehicleInConfiguration = {
vehicleSubType: string;
};
Expand All @@ -82,6 +87,8 @@ type ManualRoute = {
highwaySequence: Array<string>;
origin: string;
destination: string;
exitPoint?: string;
totalDistance?: number;
};

type PermitApplication = {
Expand Down
5 changes: 4 additions & 1 deletion policy-engine/src/_test/permit-app/test-stos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ export const testStos: PermitApplication = {
countryCode: 'CA',
postalCode: 'V8B1A2',
},
permittedCommodity: 'EMPTYXX',
permittedCommodity: {
commodityType: 'EMPTYXX',
loadDescription: 'empty',
},
vehicleConfiguration: {
overallLength: 25,
overallWidth: 3,
Expand Down
2 changes: 1 addition & 1 deletion policy-engine/src/enum/permit-app-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ export enum PermitAppInfo {
PermitDuration = '$.permitDuration',
PowerUnitType = '$.vehicleDetails.vehicleSubType',
TrailerList = '$.vehicleConfiguration.trailers',
Commodity = '$.permittedCommodity',
Commodity = '$.permittedCommodity.commodityType',
}

0 comments on commit 2ef35fe

Please sign in to comment.