backend: delete group endpoint (dönerteller protokol abgeschlossen)

This commit is contained in:
Sphereso 2024-07-12 10:47:29 +02:00
parent f1d6fb47db
commit 2db837fbee
2 changed files with 14 additions and 0 deletions

View file

@ -101,4 +101,17 @@ impl LicenseController {
.map_err(ErrorInternalServerError)?; .map_err(ErrorInternalServerError)?;
Ok(HttpResponse::Ok().finish()) Ok(HttpResponse::Ok().finish())
} }
pub async fn delete_group(
state: web::Data<AppState>,
path: Path<Uuid>,
_executor: AuthedUser,
) -> actix_web::Result<impl Responder> {
let db = &state.db;
entity::license_group::Entity::delete_by_id(path.into_inner())
.exec(db)
.await
.map_err(ErrorInternalServerError)?;
Ok(HttpResponse::Ok().finish())
}
} }

View file

@ -26,6 +26,7 @@ pub fn config(cfg: &mut web::ServiceConfig) {
.put(LicenseController::update_license), .put(LicenseController::update_license),
) )
.route("/groups", web::post().to(LicenseController::create_group)) .route("/groups", web::post().to(LicenseController::create_group))
.service(web::resource("/groups/{group_id}").delete(LicenseController::delete_group))
.service(web::scope("/auth").route("/login", web::post().to(AuthController::login))), .service(web::scope("/auth").route("/login", web::post().to(AuthController::login))),
); );
} }