-
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
feat: add backend validation for form feedback submission #3941
Conversation
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.
a few more thoughts:
- have you tested that the old client works with the new server? would be good to do so both locally and on staging (load the submit feedback page on the old client, deploy the new version of the code, then submit feedback and make sure it works as expected)
- do you think we need to create an index on the new
submissionId
field? - what are the pros and cons of this approach vs creating a unique constraint on the
submissionId
?
src/app/modules/submission/__tests__/submission/submission.service.spec.ts
Outdated
Show resolved
Hide resolved
src/app/routes/api/v3/forms/__tests__/public-forms.submissions.feedback.routes.spec.ts
Outdated
Show resolved
Hide resolved
src/app/routes/api/v3/forms/public-forms.submissions.feedback.routes.ts
Outdated
Show resolved
Hide resolved
Yep tested both locally and on staging and it works as expected - feedbacks are still submitted and reflected in the feedback data. Upon reload it switches to the new endpoint and continues to work with the same behaviour.
Yes I think so since we will be searching by |
src/app/routes/api/v3/forms/__tests__/public-forms.feedback.routes.spec.ts
Outdated
Show resolved
Hide resolved
can we make this test clearer pls? other engineers should be able to carry out the tests without having read your code changes |
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.
almost there, just a couple of nits!
src/app/routes/api/v3/forms/__tests__/public-forms.feedback.routes.spec.ts
Outdated
Show resolved
Hide resolved
src/app/routes/api/v3/forms/public-forms.submissions.feedback.routes.ts
Outdated
Show resolved
Hide resolved
f31648a
to
40f2072
Compare
40f2072
to
c0d6450
Compare
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 other than one nit
Problem
This enforces backend validation form feedback submissions. It's in line with the UI behaviour where we can only submit feedback once per submission
Solution
/api/v3/forms/{formId}/submissions/{submissionId}/feedback
endpoint to support thisCreated new controller and route instead of replacing the pre-existing one as we still want to preserve the old
/api/v3/forms/{formId}/feedback
routeBreaking Changes
Tests
submissionId
for a form without a prior form submission with the samesubmissionId
returns404
submissionId
andformId
returns422
/api/v3/forms/{formId}/feedback
still works