Conversation
|
Sorry I just refactored the backend - do you mind helping and updating this to use the current backend shape? Thank you |
There was a problem hiding this comment.
Pull request overview
Adds a PandaDoc submission mapping layer in the backend to route raw PandaDoc field keys into per-table “buckets” aligned to the backend schema, with unit tests to validate key transforms and required-field handling.
Changes:
- Introduces
PANDADOC_FIELD_MAPconstants describing PandaDoc key → backend field/table mappings (with basic transforms/defaults). - Implements
pandadocMapperto iterate the map, populate table buckets, aggregate multi-key fields into arrays, and report missing required fields in one error. - Adds unit tests covering common mapping behavior (dates, numbers, booleans, array aggregation, defaults, required validation).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
| apps/backend/src/pandadoc-mapper.ts | Core mapper implementation that buckets mapped values by target table and aggregates array-backed fields. |
| apps/backend/src/panda-field-map.ts | Central mapping configuration (PandaDoc keys, target tables, backend fields, transforms, defaults). |
| apps/backend/src/pandadoc-mapper.spec.ts | Unit tests for mapper behavior and key transforms/validation expectations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I'm seeing that these end fields are missing: referred, referredEmail, desiredExperience, elaborateOtherDiscipline, heardAboutFrom |
|
heardAboutFrom would use the same approach to the InterestArea enums |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…munity/proj-bhchp into pandadoc-form-mapping
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…munity/proj-bhchp into pandadoc-form-mapping
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…munity/proj-bhchp into pandadoc-form-mapping
ℹ️ Issue
Closes #78
📝 Description
added a mapping layer that takes the raw pandadoc form submission and routes each field to the right database table. the pandadoc form has like 40+ fields across four different tables so without this theres no clean way to get form data into our db
created panda-field-map.ts which is the big constants file that maps every pandadoc field key to its backend column name and target table. includes transforms for stuff like splitting full name into first and last, parsing dates, converting yes/no strings to booleans, and parsing hours as a number
wrote the pandadoc mapper function that iterates over the field map and buckets everything into the right table. handles optional fields by falling back to a default value or null, and collects all missing required fields into one error so you dont have to fix them one at a time
interest area checkboxes are each their own pandadoc field but they all need to end up in a single array column so the mapper auto detects when multiple pandadoc keys point to the same backend field and aggregates them into an array instead of overwriting
added 12 unit tests covering the full mapping, name splitting, number parsing, boolean transforms, array aggregation for interest checkboxes, default values for blank optional fields, and required field validation
✔️ Verification
ran the test suite and all 12 tests pass. tests cover the happy path with a full form submission, missing optional fields falling back correctly, and missing required fields throwing descriptive errors. also verified that fields like school and license that map to multiple tables end up in both places