1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-22 05:19:22 +00:00

Post are more complete

This commit is contained in:
Pierre HUBERT 2020-01-03 10:30:37 +01:00
parent f18a0952d6
commit f0c8781ba7
2 changed files with 26 additions and 3 deletions

View File

@ -58,6 +58,7 @@ export class PostsController {
visibility_level: VISIBILITY_LEVELS_API[p.visibilityLevel],
kind: p.kind,
// File specific
file_size: !p.hasFile ? null : p.file.size,
file_type: !p.hasFile ? null : p.file.type,
@ -66,9 +67,19 @@ export class PostsController {
// Movie specific
video_id: p.kind == PostKind.POST_KIND_MOVIE ? p.movieID : null,
video_info: p.kind == PostKind.POST_KIND_MOVIE ?
MoviesController.MovieToAPI(await MoviesHelper.GetInfo(p.movieID)) : null
video_id: p.hasMovie ? p.movieID : null,
video_info: p.hasMovie ?
MoviesController.MovieToAPI(await MoviesHelper.GetInfo(p.movieID)) : null,
// Countdown timer specific
time_end: p.hasTimeEnd ? p.timeEnd : null,
// Weblink specific
link_url: !p.hasLink ? null : p.link.url,
link_title: !p.hasLink ? null : p.link.title,
link_description: !p.hasLink ? null : p.link.description,
link_image: !p.hasLink ? null : p.link.image
};
return data;

View File

@ -148,4 +148,16 @@ export class Post implements PostBuilder {
get hasFile() : boolean {
return this.file != null && this.file != undefined;
}
get hasMovie() : boolean {
return this.kind == PostKind.POST_KIND_MOVIE;
}
get hasTimeEnd() : boolean {
return this.kind == PostKind.POST_KIND_COUNTDOWN;
}
get hasLink() : boolean {
return this.kind == PostKind.POST_KIND_WEBLINK;
}
}