mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-22 05:19:21 +00:00
Improve code readability
This commit is contained in:
parent
287937ac63
commit
23fd1fa925
@ -1,10 +1 @@
|
|||||||
-- Create report table
|
-- Nothing yet
|
||||||
CREATE TABLE `comunic_reports` (
|
|
||||||
`id` INT NOT NULL AUTO_INCREMENT,
|
|
||||||
`user_id` INT NOT NULL,
|
|
||||||
`target_type` VARCHAR(25) NOT NULL,
|
|
||||||
`target_id` INT NOT NULL,
|
|
||||||
`time` INT NOT NULL,
|
|
||||||
`cause` VARCHAR(20) NOT NULL,
|
|
||||||
`comment` TEXT NULL,
|
|
||||||
PRIMARY KEY (`id`));
|
|
@ -40,7 +40,7 @@ impl NotificationAPI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn for_list(l: &Vec<Notification>) -> Vec<NotificationAPI> {
|
pub fn for_list(l: &[Notification]) -> Vec<NotificationAPI> {
|
||||||
l.iter().map(Self::new).collect()
|
l.iter().map(Self::new).collect()
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,7 +13,7 @@ pub struct PostsTargets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl PostsTargets {
|
impl PostsTargets {
|
||||||
pub fn new(f: &Vec<UserID>, g: &Vec<GroupID>) -> PostsTargets {
|
pub fn new(f: &[UserID], g: &[GroupID]) -> PostsTargets {
|
||||||
PostsTargets {
|
PostsTargets {
|
||||||
friends: f.iter().map(|f| f.id()).collect(),
|
friends: f.iter().map(|f| f.id()).collect(),
|
||||||
groups: g.iter().map(|f| f.id()).collect(),
|
groups: g.iter().map(|f| f.id()).collect(),
|
||||||
|
@ -26,7 +26,7 @@ impl UserMembershipAPI {
|
|||||||
membership_type: TypeContainerAPI::new("group".to_string()),
|
membership_type: TypeContainerAPI::new("group".to_string()),
|
||||||
id: Some(group_id.id()),
|
id: Some(group_id.id()),
|
||||||
friend: None,
|
friend: None,
|
||||||
last_activity: Some(last_activity.clone()),
|
last_activity: Some(*last_activity),
|
||||||
conv: None,
|
conv: None,
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ impl UserMembershipAPI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn for_list(l: &Vec<UserMembership>) -> Vec<UserMembershipAPI> {
|
pub fn for_list(l: &[UserMembership]) -> Vec<UserMembershipAPI> {
|
||||||
l.iter().map(Self::new).collect()
|
l.iter().map(Self::new).collect()
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user