Skip to content

Commit

Permalink
refactor: move submissions.feedback route to feedback route
Browse files Browse the repository at this point in the history
  • Loading branch information
hanstirtaputra committed Jun 15, 2022
1 parent 282e4ec commit f31648a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 33 deletions.
21 changes: 16 additions & 5 deletions src/app/routes/api/v3/forms/public-forms.feedback.routes.ts
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)
3 changes: 0 additions & 3 deletions src/app/routes/api/v3/forms/public-forms.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Router } from 'express'
import { PublicFormsAuthRouter } from './public-forms.auth.routes'
import { PublicFormsFeedbackRouter } from './public-forms.feedback.routes'
import { PublicFormsFormRouter } from './public-forms.form.routes'
import { PublicFormSubmissionsFeedbackRouter } from './public-forms.submissions.feedback.routes'
import { PublicFormsSubmissionsRouter } from './public-forms.submissions.routes'
import { PublicFormsVerificationRouter } from './public-forms.verification.routes'

Expand All @@ -14,5 +13,3 @@ PublicFormsRouter.use(PublicFormsFeedbackRouter)
PublicFormsRouter.use(PublicFormsFormRouter)
PublicFormsRouter.use(PublicFormsAuthRouter)
PublicFormsRouter.use(PublicFormsVerificationRouter)
// TODO #3964: Cleanup PublicFormsFeedbackRouter once it's fully migrated to PublicFormSubmissionsFeedbackRouter
PublicFormsRouter.use(PublicFormSubmissionsFeedbackRouter)

This file was deleted.

0 comments on commit f31648a

Please sign in to comment.