Skip to content

Commit

Permalink
Merge pull request #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 Oct 20, 2023
2 parents b2f9af7 + 30b408e commit ff8db4f
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 ff8db4f

Please sign in to comment.