bcgov / onroutebc

Automated Commercial Vehicle Permitting System
Apache License 2.0
6 stars 2 forks source link

feat: Add full validation rules and vehicle types for TROS/TROW #1449

Closed john-fletcher-aot closed 1 week ago

john-fletcher-aot commented 1 week ago

Description

Add a master configuration to represent the complete, current policy config for all permit types. Add all vehicle types and all validation rules for TROS and TROW to this master config.

Fixes # ORV2-2219, ORV2-2220

Type of change

How Has This Been Tested?

Checklist


Thanks for the PR!

Deployments, as required, will be available below:

Please create PRs in draft mode. Mark as ready to enable:

After merge, new images are promoted to:

zgong-gov commented 1 week ago

How should I make use of this policy engine and its validations on the frontend? Does it generate a config json or something?

sonarcloud[bot] commented 1 week ago

Quality Gate Passed Quality Gate passed for 'onroutebc vehicles'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

john-fletcher-aot commented 1 week ago

How should I make use of this policy engine and its validations on the frontend? Does it generate a config json or something?

I will be writing up usage docs in the README shortly, though we haven't yet determined how we will share the package between fe and be. My ideal scenario is that you would npm install orbc-policy-engine, then you'll have the library available to use. Construct a new PolicyEngine by passing in a policy configuration, then using that PolicyEngine instance call a validate() method passing in the permit application JSON. Return type of the validate method (async) will be a ValidationResults object with arrays of individual results which could represent field data violations, invalid duration, invalid vehicle type for the permit type, etc.

But, this will be more clear in the README once I get it in there!