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

Can get information about a single survey

This commit is contained in:
Pierre HUBERT 2020-05-18 19:04:50 +02:00
parent 0ae0166d49
commit 334802ba05
2 changed files with 14 additions and 0 deletions

View File

@ -276,6 +276,8 @@ export const Routes : Route[] = [
// Surveys controller
{path: "/surveys/get_info", cb: (h) => SurveyController.GetInfoSingle(h)},
{path: "/surveys/send_response", cb: (h) => SurveyController.SendResponse(h)},
{path: "/surveys/cancel_response", cb: (h) => SurveyController.CancelResponse(h)},

View File

@ -12,6 +12,18 @@ import { PostAccessLevel } from "../entities/Post";
export class SurveyController {
/**
* Get information about a single survey
*
* @param h Request handler
*/
public static async GetInfoSingle(h: RequestHandler) {
const surveyID = await this.PostSurveyIDFromPostID(h, "postID");
const survey = await SurveyHelper.GetInfoBySurveyID(surveyID);
h.send(await this.SurveyToAPI(h, survey));
}
/**
* Send the response to a survey to the server
*