Make PATCH only modify name, description, and updated_at fields

This commit is contained in:
ManyTheFish 2022-05-25 10:41:06 +02:00
parent 96a5791e39
commit d54643455c

View File

@ -97,20 +97,10 @@ impl Key {
self.description = des?; self.description = des?;
} }
if let Some(act) = value.get("actions") { if let Some(des) = value.get("name") {
let act = from_value(act.clone()) let des = from_value(des.clone())
.map_err(|_| AuthControllerError::InvalidApiKeyActions(act.clone())); .map_err(|_| AuthControllerError::InvalidApiKeyName(des.clone()));
self.actions = act?; self.name = des?;
}
if let Some(ind) = value.get("indexes") {
let ind = from_value(ind.clone())
.map_err(|_| AuthControllerError::InvalidApiKeyIndexes(ind.clone()));
self.indexes = ind?;
}
if let Some(exp) = value.get("expiresAt") {
self.expires_at = parse_expiration_date(exp)?;
} }
self.updated_at = OffsetDateTime::now_utc(); self.updated_at = OffsetDateTime::now_utc();