-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(admin-form-api): duplicate adminform form endpoints for /api/v3i #1635
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…/v3i - duplicate and update adminform form related endpoints - duplicate integration tests for new endpoint - update v3 router to use new endpoints - update frontend api calls to use new endpoints
orbitalsqwib
force-pushed
the
ref/admin-form-api
branch
from
April 13, 2021 09:32
c1831e4
to
d098f8f
Compare
karrui
approved these changes
Apr 14, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm after removing unneeded Joi extension
orbitalsqwib
force-pushed
the
ref/admin-form-api
branch
from
April 14, 2021 10:20
c734201
to
0ba839c
Compare
3 tasks
mantariksh
approved these changes
Apr 15, 2021
- shift validators into admin-form controller - update handler methods to include validators as request handler array - update controller integration tests - update old routes to use new handler - update new routes to use new handler
mantariksh
approved these changes
Apr 19, 2021
Merged
karrui
added a commit
that referenced
this pull request
Apr 21, 2021
#1640) * feat: add FormField type that is a union for every possible field * feat: return http 422 status code on EditFieldError instead of 400 * feat(AdminFormService): add updateFormField to update single field * feat(AdminFormCtl): add handleUpdateFormField fn * feat(AdminFormRoutes): add PUT endpoint for updating single form field * feat(AdminFormClientCtl): add specific update field handling in update * feat: update types of mongo subdocs to allow for DocumentArray allows for special array methods such as `id()`, `pull()`, etc * test(AdminForm): update test for invalid field update to return 422 * feat(formUtils): add getFormFieldById helper method uses DocumentArray#id method if available, else uses Array#find * test(formUtils): add unit tests for getFormFieldById * ref: rename admin-forms.build.routes to admin-forms.form.routes for consistency with #1635 * feat: add Form instance method updateFormFieldById seems like a better place to for the manipulation of the form instead of in the service directly * ref(AdminFormSvc): use Form model method in update field service fn * feat(AdminFormRoutes): strengthen Joi validation for update field ensures body._id given is the same as the params.fieldId so ids of fields cannot be changed so easily * feat: add FormFieldDto type for use in update form field handler * fix(formUtils): fix evaluation of whether array is mongoose doc array * test(FormModel): add unit tests for updateFormFieldById instance fn * test(AdminFormSvc): add unit tests for updateFormField fn * test(AdminFormCtl): add unit tests for handleUpdateFormField * ref: group joi validation middleware with controller fn in export * feat: only merge updated field if index of updated field exists * feat(client): call update field endpoint on updating myinfo fields too * test(AdminFormCtl): correct name of _handleUpdateFormField in desc * ref(mongooseUtils): move isMongooseDocumentArray to own util file * ref(formUtils): remove profane usage of else after return * ref: convert constants/update-form-types.js to TypeScript * feat: show error Toast when returned field don't map to current fields
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Updates current adminform form-related endpoints to their /api rooted endpoints to follow a RESTful hierarchy.
Closes #1501
Solution
Features:
Tests