commit bf41d74501907bd545b471752eb2b51f000a9500
parent bc26bfa589c007da9b9be37e1172060f38a948b9
Author: Mathieu Valois <mvalois@teicee.com>
Date: Mon, 2 Oct 2023 17:33:52 +0200
Adds LastActive on /admin/users API route
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/api/admin.rs b/src/api/admin.rs
@@ -326,6 +326,10 @@ async fn get_users_json(_token: AdminToken, mut conn: DbConn) -> Json<Value> {
let mut usr = u.to_json(&mut conn).await;
usr["UserEnabled"] = json!(u.enabled);
usr["CreatedAt"] = json!(format_naive_datetime_local(&u.created_at, DT_FMT));
+ usr["LastActive"] = match u.last_active(&mut conn).await {
+ Some(dt) => json!(format_naive_datetime_local(&dt, DT_FMT)),
+ None => json!("Never"),
+ };
users_json.push(usr);
}