mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-12-25 13:08:51 +00:00
Can get information about a single survey
This commit is contained in:
parent
0ae0166d49
commit
334802ba05
@ -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)},
|
||||
|
@ -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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user