mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-22 01:15:16 +00:00
Can create movie posts
This commit is contained in:
@ -23,6 +23,11 @@ pub fn get_info(movie_id: u64) -> ResultBoxError<Movie> {
|
||||
.query_row(db_to_movie)
|
||||
}
|
||||
|
||||
/// Check out whether a user own a movie or not
|
||||
pub fn does_user_has(user_id: &UserID, movie_id: u64) -> ResultBoxError<bool> {
|
||||
Ok(get_info(movie_id).map(|m| &m.user_id == user_id).unwrap_or(false))
|
||||
}
|
||||
|
||||
/// Turn a database entry into a movie object
|
||||
fn db_to_movie(row: &database::RowResult) -> ResultBoxError<Movie> {
|
||||
Ok(Movie {
|
||||
|
@ -90,6 +90,11 @@ pub fn create(p: &Post) -> ResultBoxError<u64> {
|
||||
.add_str("type", "youtube");
|
||||
}
|
||||
|
||||
// Movie post
|
||||
POST_KIND_MOVIE(id) => {
|
||||
insert_query = insert_query.add_u64("idvideo", *id);
|
||||
}
|
||||
|
||||
_ => unimplemented!()
|
||||
/*
|
||||
POST_KIND_WEBLINK(_) => {},
|
||||
|
Reference in New Issue
Block a user