From b46a6e932c60318af4c1a4c59649e905681551bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Wed, 19 Jun 2024 17:29:02 +0200 Subject: [PATCH] Update admin and templates --- src/api/admin.rs | 6 ++--- src/db/models/user.rs | 2 +- src/static/templates/admin/organizations.hbs | 10 ++++---- src/static/templates/admin/users.hbs | 24 ++++++++++---------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/api/admin.rs b/src/api/admin.rs index a7ab60ca..22e6f80b 100644 --- a/src/api/admin.rs +++ b/src/api/admin.rs @@ -326,9 +326,9 @@ async fn get_users_json(_token: AdminToken, mut conn: DbConn) -> Json { let mut users_json = Vec::with_capacity(users.len()); for u in users { 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 { + 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::), }; diff --git a/src/db/models/user.rs b/src/db/models/user.rs index 45cbb7f9..a02b694d 100644 --- a/src/db/models/user.rs +++ b/src/db/models/user.rs @@ -240,7 +240,7 @@ impl User { }; json!({ - "_Status": status as i32, + "_status": status as i32, "id": self.uuid, "name": self.name, "email": self.email, diff --git a/src/static/templates/admin/organizations.hbs b/src/static/templates/admin/organizations.hbs index a5676994..46547b28 100644 --- a/src/static/templates/admin/organizations.hbs +++ b/src/static/templates/admin/organizations.hbs @@ -17,12 +17,12 @@ {{#each page_data}} - +
- {{Name}} - ({{BillingEmail}}) + {{name}} + ({{billingEmail}}) - {{Id}} + {{id}}
@@ -44,7 +44,7 @@ Events: {{event_count}} -
+
{{/each}} diff --git a/src/static/templates/admin/users.hbs b/src/static/templates/admin/users.hbs index b8552bd7..1765876a 100644 --- a/src/static/templates/admin/users.hbs +++ b/src/static/templates/admin/users.hbs @@ -18,21 +18,21 @@ {{#each page_data}} - +
- {{Name}} - {{Email}} + {{name}} + {{email}} {{#unless user_enabled}} Disabled {{/unless}} - {{#if TwoFactorEnabled}} + {{#if twoFactorEnabled}} 2FA {{/if}} - {{#case _Status 1}} + {{#case _status 1}} Invited {{/case}} - {{#if EmailVerified}} + {{#if emailVerified}} Verified {{/if}} @@ -54,15 +54,15 @@ {{/if}} -
- {{#each Organizations}} - +
+ {{#each organizations}} + {{/each}}
- - {{#if TwoFactorEnabled}} + + {{#if twoFactorEnabled}}
{{/if}}
@@ -72,7 +72,7 @@ {{else}}
{{/if}} - {{#case _Status 1}} + {{#case _status 1}}
{{/case}}