extract_uid for more legibility when we need to pull 'id' from user parameters
This commit is contained in:
parent
085bad75fd
commit
9e505bd2bb
@ -27,4 +27,11 @@ pub async fn parse_json_params(body_raw: &mut Body) -> Result<Value, serde_json:
|
|||||||
values = serde_json::from_slice(bytes)?;
|
values = serde_json::from_slice(bytes)?;
|
||||||
}
|
}
|
||||||
Ok(values)
|
Ok(values)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn extract_uid(values: &Value) -> u64 {
|
||||||
|
// pulling 'id' from user params is safe because the
|
||||||
|
// auth modules guarantees this to be there already
|
||||||
|
values.get("id").unwrap().as_u64().unwrap()
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user