Skip to content

feat: general project intake form#433

Merged
qhanson55 merged 15 commits intofeature/release-general-projectfrom
feature/general-project-intake
Mar 9, 2026
Merged

feat: general project intake form#433
qhanson55 merged 15 commits intofeature/release-general-projectfrom
feature/general-project-intake

Conversation

@kyle1morel
Copy link
Collaborator

@kyle1morel kyle1morel commented Mar 4, 2026

Description

  • Add general project intake form.
  • The intake form system has been completely rewritten to be entirely modular. Form cards are all broken out into their own individual components and auto hook into the form system.
  • A new form store has been added. This store tracks the form type and state. These 2 states dictate if a form is editable or not. The card components also communicate with the store to track which form tabs currently have errors.
  • Housing and Electrification intake forms have been updated to use this new system
  • Minor update to general intake migration file
  • Contact intake field names have been aligned with the actual type. No more weird transformations required!

https://apps.nrs.gov.bc.ca/int/jira/browse/PADS-709

Types of changes

Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING doc
  • I have checked that unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

@kyle1morel kyle1morel changed the title (feat): general project intake form feat: general project intake form Mar 4, 2026
import roadmap from './roadmap.ts';

const router = express.Router();
router.use(currentContext(Initiative.GENERAL));

Check failure

Code scanning / CodeQL

Missing rate limiting

This route handler performs [authorization](1), but is not rate-limited.

Copilot Autofix

AI 6 days ago

In general, the fix is to introduce a rate-limiting middleware (e.g., using express-rate-limit) and apply it to the routes protected by currentContext, so that expensive authorization and subsequent handlers cannot be invoked at an unbounded rate.

The best minimal-impact fix here is:

  • Import express-rate-limit.
  • Define a limiter instance (e.g., a reasonable window and max request count).
  • Apply the limiter immediately before or along with currentContext(Initiative.GENERAL) on this router using router.use. This preserves all existing routes and behavior; it just gates them behind rate limiting. We do not change any route handlers or paths.

Concretely, in app/src/routes/v1/general.ts:

  • Add an import of express-rate-limit.
  • After const router = express.Router();, define a const generalRateLimiter = rateLimit({ ... }).
  • Insert router.use(generalRateLimiter); before router.use(currentContext(Initiative.GENERAL));.
Suggested changeset 2
app/src/routes/v1/general.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/app/src/routes/v1/general.ts b/app/src/routes/v1/general.ts
--- a/app/src/routes/v1/general.ts
+++ b/app/src/routes/v1/general.ts
@@ -11,8 +11,16 @@
 import noteHistory from './noteHistory.ts';
 import permit from './permit.ts';
 import roadmap from './roadmap.ts';
+import rateLimit from 'express-rate-limit';
 
 const router = express.Router();
+
+const generalRateLimiter = rateLimit({
+  windowMs: 15 * 60 * 1000, // 15 minutes
+  max: 100 // limit each IP to 100 requests per windowMs for general routes
+});
+
+router.use(generalRateLimiter);
 router.use(currentContext(Initiative.GENERAL));
 
 // Base v1 Responder
EOF
@@ -11,8 +11,16 @@
import noteHistory from './noteHistory.ts';
import permit from './permit.ts';
import roadmap from './roadmap.ts';
import rateLimit from 'express-rate-limit';

const router = express.Router();

const generalRateLimiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100 // limit each IP to 100 requests per windowMs for general routes
});

router.use(generalRateLimiter);
router.use(currentContext(Initiative.GENERAL));

// Base v1 Responder
app/package.json
Outside changed files

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/app/package.json b/app/package.json
--- a/app/package.json
+++ b/app/package.json
@@ -81,7 +81,8 @@
     "proj4": "^2.20.2",
     "tsx": "^4.21.0",
     "uuid": "^11.1.0",
-    "winston-transport": "^4.9.0"
+    "winston-transport": "^4.9.0",
+    "express-rate-limit": "^8.2.1"
   },
   "devDependencies": {
     "@eslint/js": "9.39.1",
EOF
@@ -81,7 +81,8 @@
"proj4": "^2.20.2",
"tsx": "^4.21.0",
"uuid": "^11.1.0",
"winston-transport": "^4.9.0"
"winston-transport": "^4.9.0",
"express-rate-limit": "^8.2.1"
},
"devDependencies": {
"@eslint/js": "9.39.1",
This fix introduces these dependencies
Package Version Security advisories
express-rate-limit (npm) 8.2.1 None
Copilot is powered by AI and may make mistakes. Always verify output.
@github-actions
Copy link

github-actions bot commented Mar 4, 2026

Coverage Report (Application)

Totals Coverage
Statements: 80.9% ( 3904 / 4826 )
Methods: 76.73% ( 498 / 649 )
Lines: 86.74% ( 2747 / 3167 )
Branches: 65.25% ( 659 / 1010 )

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

Coverage Report (Frontend)

Totals Coverage
Statements: 49.01% ( 5048 / 10299 )
Methods: 36.03% ( 597 / 1657 )
Lines: 58.89% ( 3210 / 5451 )
Branches: 38.89% ( 1241 / 3191 )

@kyle1morel kyle1morel force-pushed the feature/general-project-intake branch from 53d61ce to 87eb4bd Compare March 4, 2026 22:35
@slhurley
Copy link
Contributor

slhurley commented Mar 4, 2026

  • clicking on Create Enquiry from prop view gives Unable to determine initiative state. (maybe this is expected at this point) - do we need another ticket for enquiry intake forms?
  • Registered business is automatically giving 2 error messages when you say Registered = Yes: Business name is a required field AND Business ID is a required field (which isn't a thing on the input form)
  • Project Number info message isn't clear....s/b Please provide the project number you use in your own system.....
  • Assistance button is lowercase "assistance"
  • On the Location button and the Permits button they don't look right if you try to submit and they have invalid fields (the red part is weird)

@kyle1morel kyle1morel changed the base branch from master to feature/release-general-project March 5, 2026 00:29
@kyle1morel kyle1morel force-pushed the feature/general-project-intake branch 2 times, most recently from 44f8c21 to abffbb4 Compare March 5, 2026 23:01
@kyle1morel kyle1morel marked this pull request as ready for review March 5, 2026 23:03
@kyle1morel kyle1morel requested a review from a team as a code owner March 5, 2026 23:03
@kyle1morel kyle1morel force-pushed the feature/general-project-intake branch from abffbb4 to 15ebf4e Compare March 6, 2026 18:00
Copy link
Contributor

@qhanson55 qhanson55 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider going through some of the sonarqube alerts

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

Quality Gate Failed Quality Gate failed for 'nr-permitconnect-navigator-service frontend'

Failed conditions
45.9% Coverage on New Code (required ≥ 80%)
9.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Reduce onBeforeMount complexity. Resolve improper label usages.
@kyle1morel kyle1morel force-pushed the feature/general-project-intake branch from 1fda0f3 to 60e317e Compare March 9, 2026 18:41
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

Quality Gate Passed Quality Gate passed for 'nr-permitconnect-navigator-service app'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
82.9% Coverage on New Code
1.5% Duplication on New Code

See analysis details on SonarQube Cloud

@qhanson55 qhanson55 merged commit 3687320 into feature/release-general-project Mar 9, 2026
14 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants