1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-07-11 04:22:48 +00:00

Return the choice of a user to a survey

This commit is contained in:
2020-01-03 14:43:46 +01:00
parent 24d3102d49
commit 03459cd3a0
2 changed files with 22 additions and 0 deletions

@ -1,5 +1,6 @@
import { Survey, SurveyChoice } from "../entities/Survey";
import { RequestHandler } from "../entities/RequestHandler";
import { SurveyHelper } from "../helpers/SurveyHelper";
/**
* Survey controller
@ -29,6 +30,9 @@ export class SurveyController {
survey.choices.forEach((c) => data.choices[c.id.toString()] = this.SurveyChoiceToAPI(c))
if(h.signedIn)
data.user_choice = await SurveyHelper.GetUserChoice(survey.id, h.getUserId());
return data;
}