diff --git a/src/controllers/Routes.ts b/src/controllers/Routes.ts index 388f3a3..10e4540 100644 --- a/src/controllers/Routes.ts +++ b/src/controllers/Routes.ts @@ -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)}, diff --git a/src/controllers/SurveyController.ts b/src/controllers/SurveyController.ts index f1742d2..bbb5103 100644 --- a/src/controllers/SurveyController.ts +++ b/src/controllers/SurveyController.ts @@ -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 *