1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-20 16:35:17 +00:00

Count the number of likes of a user

This commit is contained in:
2020-06-01 10:17:32 +02:00
parent a5dab7e312
commit cef5838ef4
4 changed files with 44 additions and 2 deletions

View File

@ -4,11 +4,12 @@
use serde::Serialize;
use crate::data::user::{User, UserPageStatus, UserID};
use crate::helpers::{friends_helper, custom_emojies_helper, background_image_helper};
use crate::helpers::{friends_helper, custom_emojies_helper, background_image_helper, likes_helper};
use crate::data::error::ResultBoxError;
use crate::utils::user_data_utils::user_data_url;
use crate::data::user::AccountImageVisibility::{EVERYONE, COMUNIC_USERS};
use crate::api_data::custom_emoji::CustomEmojiAPI;
use crate::helpers::likes_helper::LikeType;
#[derive(Serialize)]
#[allow(non_snake_case)]
@ -37,6 +38,7 @@ struct APIAdvancedInfo {
account_creation_time: u64,
backgroundImage: String,
number_friends: usize,
pageLikes: usize,
}
impl APIUserInfo {
@ -80,6 +82,7 @@ impl APIUserInfo {
account_creation_time: info.account_creation_time,
backgroundImage: background_image_helper::get_url(info.id),
number_friends,
pageLikes: likes_helper::count(info.id as u64, LikeType::USER)?,
});
Ok(user)