Skip to content

Commit

Permalink
Merge pull request dani-garcia#3951 from teicee/last-active
Browse files Browse the repository at this point in the history
Adds LastActive on /admin/users API route
  • Loading branch information
dani-garcia authored and jayknyn committed Oct 28, 2023
2 parents 3bda8cf + 5f69436 commit 424fd9e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/api/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,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!(None::<String>),
};
users_json.push(usr);
}

Expand Down

0 comments on commit 424fd9e

Please sign in to comment.