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:
@ -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
35
src/entities/Survey.ts
Normal 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];
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user