1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-21 00:45:18 +00:00

Can get the list of available target to create new posts

This commit is contained in:
2020-07-09 13:26:39 +02:00
parent 82adbbcd6d
commit 05b743fa36
6 changed files with 64 additions and 2 deletions

View File

@ -35,4 +35,5 @@ pub mod movie_api;
pub mod survey_choice_api;
pub mod survey_api;
pub mod comment_api;
pub mod res_create_post;
pub mod res_create_post;
pub mod posts_targets_api;

View File

@ -0,0 +1,22 @@
//! # Posts targets
//!
//! @author Pierre Hubert
use serde::Serialize;
use crate::data::group_id::GroupID;
use crate::data::user::UserID;
#[derive(Serialize)]
pub struct PostsTargets {
friends: Vec<u64>,
groups: Vec<u64>,
}
impl PostsTargets {
pub fn new(f: &Vec<UserID>, g: &Vec<GroupID>) -> PostsTargets {
PostsTargets {
friends: f.iter().map(|f| f.id()).collect(),
groups: g.iter().map(|f| f.id()).collect(),
}
}
}