Browse Source

Adding "CreatedAt" member to the json output of a User so the admin/users and admin/users/<ID> routes give the creation time information.

pull/2524/head
Marco 3 years ago
committed by Lyonel Martinez
parent
commit
c093ec6cd6
  1. 4
      src/db/models/user.rs

4
src/db/models/user.rs

@ -2,6 +2,7 @@ use chrono::{Duration, NaiveDateTime, Utc};
use serde_json::Value; use serde_json::Value;
use crate::crypto; use crate::crypto;
use crate::util::format_naive_datetime_local;
use crate::CONFIG; use crate::CONFIG;
db_object! { db_object! {
@ -213,7 +214,7 @@ impl User {
} else { } else {
UserStatus::Enabled UserStatus::Enabled
}; };
const DT_FMT: &str = "%Y-%m-%d %H:%M:%S %Z";
json!({ json!({
"_Status": status as i32, "_Status": status as i32,
"Id": self.uuid, "Id": self.uuid,
@ -232,6 +233,7 @@ impl User {
"ProviderOrganizations": [], "ProviderOrganizations": [],
"ForcePasswordReset": false, "ForcePasswordReset": false,
"Object": "profile", "Object": "profile",
"CreatedAt": format_naive_datetime_local(&self.created_at, DT_FMT),
}) })
} }

Loading…
Cancel
Save