backend: use ActiveModel

This commit is contained in:
Sphereso 2024-07-11 21:09:00 +02:00
parent 1dfe2f8ed6
commit 29525608ed

View file

@ -68,12 +68,12 @@ impl LicenseController {
pub async fn update_license( pub async fn update_license(
state: web::Data<AppState>, state: web::Data<AppState>,
license: web::Json<entity::license::Model>, license: web::Json<entity::license::ActiveModel>,
path: Path<Uuid>, path: Path<Uuid>,
_executor: AuthedUser, _executor: AuthedUser,
) -> actix_web::Result<impl Responder> { ) -> actix_web::Result<impl Responder> {
let db = &state.db; let db = &state.db;
let mut license = license.into_inner().into_active_model(); let mut license = license.into_inner();
let id = path.into_inner(); let id = path.into_inner();
license.id = ActiveValue::Unchanged(id); license.id = ActiveValue::Unchanged(id);
let res = license.update(db).await.map_err(ErrorInternalServerError)?; let res = license.update(db).await.map_err(ErrorInternalServerError)?;