Add DELETE /family/{id}/member/{id_member}

This commit is contained in:
Pierre HUBERT 2023-08-05 13:56:24 +02:00
parent c6d9264d94
commit aa351bfae9
2 changed files with 10 additions and 0 deletions

View File

@ -286,3 +286,9 @@ pub async fn update(m: FamilyAndMemberInPath, req: web::Json<MemberRequest>) ->
Ok(HttpResponse::Accepted().finish())
}
/// Delete a member
pub async fn delete(m: FamilyAndMemberInPath) -> HttpResult {
members_service::delete(&m).await?;
Ok(HttpResponse::Ok().finish())
}

View File

@ -139,6 +139,10 @@ async fn main() -> std::io::Result<()> {
"/family/{id}/member/{member_id}",
web::put().to(members_controller::update),
)
.route(
"/family/{id}/member/{member_id}",
web::delete().to(members_controller::delete),
)
})
.bind(AppConfig::get().listen_address.as_str())?
.run()