-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move submissions.feedback route to feedback route
- Loading branch information
1 parent
282e4ec
commit f31648a
Showing
3 changed files
with
16 additions
and
33 deletions.
There are no files selected for viewing
21 changes: 16 additions & 5 deletions
21
src/app/routes/api/v3/forms/public-forms.feedback.routes.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,34 @@ | ||
import { Router } from 'express' | ||
|
||
import * as FeedbackController from '../../../../modules/feedback/feedback.controller' | ||
import * as PublicFormController from '../../../../modules/form/public-form/public-form.controller' | ||
|
||
export const PublicFormsFeedbackRouter = Router() | ||
|
||
/** | ||
* @deprecated | ||
* TODO #3964: Remove this route once we fully migrate to /:formId/submissions/:submissionId/feedback endpoint | ||
*/ | ||
PublicFormsFeedbackRouter.route('/:formId([a-fA-F0-9]{24})/feedback').post( | ||
PublicFormController.handleSubmitFeedback, | ||
) | ||
|
||
/** | ||
* Send feedback for a public form | ||
* @route POST /:formId/feedback | ||
* @route POST /:formId/submissions/:submissionId/feedback | ||
* @group forms - endpoints to serve forms | ||
* @param {string} formId.path.required - the form id | ||
* @param {string} submissionId.path.required - the form submission id | ||
* @param {Feedback.model} feedback.body.required - the user's feedback | ||
* @consumes application/json | ||
* @produces application/json | ||
* @returns 200 if feedback was successfully saved | ||
* @returns 400 if form feedback was malformed and hence cannot be saved | ||
* @returns 404 if form with formId does not exist or is private | ||
* @returns 404 if form with formId or submissionId does not exist, or form is private | ||
* @returns 410 if form has been archived | ||
* @returns 422 if form feedback for the submissionId has already been submitted | ||
* @returns 500 if database error occurs | ||
*/ | ||
PublicFormsFeedbackRouter.route('/:formId([a-fA-F0-9]{24})/feedback').post( | ||
PublicFormController.handleSubmitFeedback, | ||
) | ||
PublicFormsFeedbackRouter.route( | ||
'/:formId([a-fA-F0-9]{24})/submissions/:submissionId([a-fA-F0-9]{24})/feedback', | ||
).post(FeedbackController.handleSubmitFormFeedback) |
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
25 changes: 0 additions & 25 deletions
25
src/app/routes/api/v3/forms/public-forms.submissions.feedback.routes.ts
This file was deleted.
Oops, something went wrong.