Repository navigation
Submit data contributions to the new /oed/contributions endpoint - #89
matthewberry wants to merge 2 commits into
Conversation
The About page form uploaded to POST /oed-contributions/upload, which the backend has rejected with 400 "Unknown bucket" since that route was restricted to job types, so every contribution failed. Send it to the dedicated endpoint added in moleculemaker/mmli-backend#158 instead. The form now sends the original file with the email and both agreements as fields, instead of prefixing the email to the file name and dropping the checkboxes. The endpoint is added to the committed OpenAPI spec by hand: staging does not serve it yet, and a full re-sync would pull in unrelated drift. Fixes #88
|
Review note: the form's email validation is looser than the backend's.
Related, posted on moleculemaker/mmli-backend#158: lowering |
- Cap the file picker at 50 MB (the backend's limit) and take the file from event.currentFiles. PrimeNG's onSelect still lists a file that failed its size/type check in event.files, so maxFileSize alone did not keep an oversized file out of the form. - Require a dot in the email domain. Validators.email accepts me@lab, which the backend's EmailStr rejects with a 422. - Regenerate the client for the backend's renamed tag (OED -> OpenEnzymeDB): OEDService / oED.service.ts become OpenEnzymeDBService / openEnzymeDB.service.ts.
|
Confirmed. Angular 18.2.13's The same commit fixes the 1 GB picker. It sets Tests: |
Summary
Fixes #88. Every submission from the About page's data contribution form has been failing. The form uploaded to
POST /oed-contributions/upload, and the backend now rejects any bucket on that route that isn't a job type (400 Unknown bucket).This PR points the form at the dedicated endpoint added in moleculemaker/mmli-backend#158,
POST /oed/contributions.Depends on moleculemaker/mmli-backend#158. Don't deploy this until the backend change is live. Until then, the form gets a 404 instead of a 400, so it's still broken.
Changes
about-page.component.tscallsOpenEnzymeDBService.submitContributionOedContributionsPost(file, email, licenseAccepted, rightsConfirmed).<email>_<filename>.p-checkboxes, so a checked one holds an array (confirmed in the installed PrimeNG 17.18.11,updateModel). That's why the booleans are!!value?.length./oed/contributionstoopenapi/mmli-backend.openapi.jsonby hand, copied from the backend branch's generated OpenAPI. Staging doesn't serve it yet, andnpm run openapi:syncwould pull in a lot of unrelated changes (the committed spec has 18 paths). Regenerating with the pinned generator (6.6.0) added only the new service and its two index entries (nowopenEnzymeDB.service.ts, after the backend renamed the tag fromOEDtoOpenEnzymeDB).Testing
about-page.component.spec.ts: the form submits the originalFile, the email andtrue, true, and the status becomessubmitted. A backend error sets the status toerror. The spec also now provides the router and service, so "should create" runs.main: three unrelated specs don't compile (molecule-name-validator.directive.spec.ts,smiles-validator.directive.spec.ts,entity-ecnumber.component.spec.ts), and that stops everyng testrun. I didn't fix them here. I ran this spec with a temporary tsconfig that included only it: 7/7 passed. Of the 4 tests added with the review fixes, the rejected-file andme@labtests fail on the old logic.ng buildsucceeds.OpenEnzymeDBService, and nothing has been sent to a running backend.Review fixes (635cd35)
event.currentFiles. PrimeNG still lists a file that failed its size check inevent.files, so the cap alone didn't keep an oversized file out of the form.Validators.emailacceptsme@lab, which the backend rejects with a 422. Reserved domains like.local/.teststill get past the form and receive the generic error.