Can leave a family
This commit is contained in:
@ -79,6 +79,13 @@ pub async fn single_info(f: FamilyInPath) -> HttpResult {
|
||||
.json(families_service::get_family_membership(f.family_id(), f.user_id()).await?))
|
||||
}
|
||||
|
||||
/// Attempt to leave a family
|
||||
pub async fn leave(f: FamilyInPath) -> HttpResult {
|
||||
families_service::remove_membership(f.family_id(), f.user_id()).await?;
|
||||
|
||||
Ok(HttpResponse::Accepted().finish())
|
||||
}
|
||||
|
||||
/// Get the list of users who belongs to a family
|
||||
pub async fn users(f: FamilyInPath) -> HttpResult {
|
||||
Ok(HttpResponse::Ok().json(families_service::get_memberships_of_family(f.family_id()).await?))
|
||||
|
Reference in New Issue
Block a user