Add GET /family/{id}/members

This commit is contained in:
2023-08-05 10:38:10 +02:00
parent 5f0842b7dc
commit e59ed6ed71
2 changed files with 10 additions and 0 deletions

View File

@ -242,6 +242,12 @@ pub async fn create(f: FamilyInPath, req: web::Json<MemberRequest>) -> HttpResul
Ok(HttpResponse::Ok().json(member))
}
/// Get the entire list of members of the family
pub async fn get_all(f: FamilyInPath) -> HttpResult {
let members = members_service::get_all_of_family(f.family_id()).await?;
Ok(HttpResponse::Ok().json(members))
}
/// Get the information of a single family member
pub async fn get_single(m: FamilyAndMemberInPath) -> HttpResult {
Ok(HttpResponse::Ok().json(m.to_member()))