mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-01-29 21:43:00 +00:00
Add YouTube posts support
This commit is contained in:
parent
8d5013b00a
commit
532bd9e48d
@ -109,7 +109,10 @@ impl PostAPI {
|
||||
PostKind::POST_KIND_SURVEY =>
|
||||
post.data_survey = Some(SurveyAPI::new(&survey_helper::get_info(p.id)?, user.clone())?),
|
||||
|
||||
PostKind::POST_KIND_YOUTUBE => {}
|
||||
PostKind::POST_KIND_YOUTUBE(id) => {
|
||||
post.file_path = Some(id.clone());
|
||||
post.file_type = Some("youtube".to_string());
|
||||
}
|
||||
}
|
||||
|
||||
Ok(post)
|
||||
|
@ -61,7 +61,7 @@ pub enum PostKind {
|
||||
POST_KIND_COUNTDOWN(u64),
|
||||
// End time
|
||||
POST_KIND_SURVEY,
|
||||
POST_KIND_YOUTUBE,
|
||||
POST_KIND_YOUTUBE(String),
|
||||
}
|
||||
|
||||
impl PostKind {
|
||||
@ -74,7 +74,7 @@ impl PostKind {
|
||||
PostKind::POST_KIND_MOVIE(_) => "movie",
|
||||
PostKind::POST_KIND_COUNTDOWN(_) => "countdown",
|
||||
PostKind::POST_KIND_SURVEY => "survey",
|
||||
PostKind::POST_KIND_YOUTUBE => "youtube",
|
||||
PostKind::POST_KIND_YOUTUBE(_) => "youtube",
|
||||
}.to_string()
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
use crate::constants::database_tables_names::POSTS_TABLE;
|
||||
use crate::data::error::{ExecError, ResultBoxError};
|
||||
use crate::data::post::{Post, PostFile, PostKind, PostPageKind, PostVisibilityLevel, PostWebLink};
|
||||
use crate::data::post::PostKind::{POST_KIND_COUNTDOWN, POST_KIND_IMAGE, POST_KIND_MOVIE, POST_KIND_PDF, POST_KIND_SURVEY, POST_KIND_WEBLINK};
|
||||
use crate::data::post::PostKind::{POST_KIND_COUNTDOWN, POST_KIND_IMAGE, POST_KIND_MOVIE, POST_KIND_PDF, POST_KIND_SURVEY, POST_KIND_WEBLINK, POST_KIND_YOUTUBE};
|
||||
use crate::data::user::UserID;
|
||||
use crate::helpers::{database, friends_helper};
|
||||
use crate::utils::date_utils::time;
|
||||
@ -176,6 +176,8 @@ fn db_to_post(res: &database::RowResult) -> ResultBoxError<Post> {
|
||||
|
||||
"sondage" => post.kind = POST_KIND_SURVEY,
|
||||
|
||||
"youtube" => post.kind = POST_KIND_YOUTUBE(res.get_str("path")?),
|
||||
|
||||
_ => {}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user