backend: fix update endpoint (gyros)
This commit is contained in:
parent
1c5c30be6e
commit
bc18bb647b
1 changed files with 12 additions and 3 deletions
|
@ -68,14 +68,23 @@ impl LicenseController {
|
|||
|
||||
pub async fn update_license(
|
||||
state: web::Data<AppState>,
|
||||
license: web::Json<entity::license::ActiveModel>,
|
||||
license: web::Json<entity::license::Model>,
|
||||
path: Path<Uuid>,
|
||||
_executor: AuthedUser,
|
||||
) -> actix_web::Result<impl Responder> {
|
||||
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))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue