Group member add and remove routes.

This commit is contained in:
Paul Makles
2021-01-19 09:02:18 +00:00
parent 901b29f49e
commit c21d7c4620
8 changed files with 185 additions and 59 deletions

View File

@@ -36,6 +36,12 @@ pub async fn req(user: User, info: Json<Data>) -> Result<JsonValue> {
})?
}
for target in &set {
if get_relationship(&user, target) != RelationshipStatus::Friend {
Err(Error::NotFriends)?
}
}
if get_collection("channels")
.find_one(
doc! {
@@ -53,12 +59,6 @@ pub async fn req(user: User, info: Json<Data>) -> Result<JsonValue> {
Err(Error::DuplicateNonce)?
}
for target in &set {
if get_relationship(&user, target) != RelationshipStatus::Friend {
Err(Error::NotFriends)?
}
}
let id = Ulid::new().to_string();
let channel = Channel::Group {
id,