diff --git a/crates/backend/src/controller/license.rs b/crates/backend/src/controller/license.rs index fa8fe3f..86cfdf0 100644 --- a/crates/backend/src/controller/license.rs +++ b/crates/backend/src/controller/license.rs @@ -68,14 +68,23 @@ impl LicenseController { pub async fn update_license( state: web::Data, - license: web::Json, + license: web::Json, path: Path, _executor: AuthedUser, ) -> actix_web::Result { let db = &state.db; - let mut license = license.into_inner(); + let license = license.into_inner(); let id = path.into_inner(); - license.id = ActiveValue::Unchanged(id); + let license = entity::license::ActiveModel { + id: ActiveValue::Unchanged(id), + amount: ActiveValue::Set(license.amount), + name: ActiveValue::Set(license.name), + start: ActiveValue::Set(license.start), + end: ActiveValue::Set(license.end), + key: ActiveValue::Set(license.key), + group_id: ActiveValue::Set(license.group_id), + note: ActiveValue::Set(license.note), + }; let res = license.update(db).await.map_err(ErrorInternalServerError)?; Ok(web::Json(res)) }