Add GET /family/{id}/members
This commit is contained in:
parent
5f0842b7dc
commit
e59ed6ed71
@ -242,6 +242,12 @@ pub async fn create(f: FamilyInPath, req: web::Json<MemberRequest>) -> HttpResul
|
|||||||
Ok(HttpResponse::Ok().json(member))
|
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
|
/// Get the information of a single family member
|
||||||
pub async fn get_single(m: FamilyAndMemberInPath) -> HttpResult {
|
pub async fn get_single(m: FamilyAndMemberInPath) -> HttpResult {
|
||||||
Ok(HttpResponse::Ok().json(m.to_member()))
|
Ok(HttpResponse::Ok().json(m.to_member()))
|
||||||
|
@ -127,6 +127,10 @@ async fn main() -> std::io::Result<()> {
|
|||||||
"/family/{id}/member/create",
|
"/family/{id}/member/create",
|
||||||
web::post().to(members_controller::create),
|
web::post().to(members_controller::create),
|
||||||
)
|
)
|
||||||
|
.route(
|
||||||
|
"/family/{id}/members",
|
||||||
|
web::get().to(members_controller::get_all),
|
||||||
|
)
|
||||||
.route(
|
.route(
|
||||||
"/family/{id}/member/{member_id}",
|
"/family/{id}/member/{member_id}",
|
||||||
web::get().to(members_controller::get_single),
|
web::get().to(members_controller::get_single),
|
||||||
|
Loading…
Reference in New Issue
Block a user