1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-22 13:29:22 +00:00

Can cancel the response to a survey

This commit is contained in:
Pierre HUBERT 2020-03-21 16:36:46 +01:00
parent 0e3bbd2125
commit bf84f7814f
2 changed files with 15 additions and 0 deletions

View File

@ -225,6 +225,8 @@ export const Routes : Route[] = [
// Surveys controller
{path: "/surveys/send_response", cb: (h) => SurveyController.SendResponse(h)},
{path: "/surveys/cancel_response", cb: (h) => SurveyController.CancelResponse(h)},
// Notifications controller
{path: "/notifications/count_unread", cb: (h) => NotificationsController.CountUnread(h)},

View File

@ -29,6 +29,19 @@ export class SurveyController {
h.success();
}
/**
* Cancel the repsonse to a request
*
* @param h Request handler
*/
public static async CancelResponse(h: RequestHandler) {
const surveyID = await this.PostSurveyIDFromPostID(h, "postID");
await SurveyHelper.CancelResponse(h.getUserId(), surveyID);
h.success();
}
/**
* Turn a survey into an API entry