1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-06-20 08:35:17 +00:00

Can get & return basic information about surveys

This commit is contained in:
2020-01-03 14:37:54 +01:00
parent 5d81421e8d
commit 24d3102d49
6 changed files with 205 additions and 3 deletions

View File

@ -160,4 +160,8 @@ export class Post implements PostBuilder {
get hasLink() : boolean {
return this.kind == PostKind.POST_KIND_WEBLINK;
}
get hasSurvey() : boolean {
return this.kind == PostKind.POST_KIND_SURVEY;
}
}

35
src/entities/Survey.ts Normal file
View File

@ -0,0 +1,35 @@
/**
* Survey information
*
* @author Pierre HUBERT
*/
export interface SurveyChoice {
id: number,
name: string,
count: number
}
export interface SurveyBuilder {
id: number;
userID: number;
timeCreate: number;
postID: number;
question: string;
choices: SurveyChoice[]
}
export class Survey implements SurveyBuilder {
id: number; userID: number;
timeCreate: number;
postID: number;
question: string;
choices: SurveyChoice[];
public constructor(info: SurveyBuilder) {
for (const key in info) {
if (info.hasOwnProperty(key))
this[key] = info[key];
}
}
}