From 6c0b48a941e024f1c811886fa0467e8bda027e12 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Thu, 16 Feb 2023 17:00:55 +0100 Subject: [PATCH] Added logic to show createdAt & modifiedAt in auth user list #78 --- kdb-bot/src/bot_api/model/auth_user_dto.py | 18 + .../transformer/auth_user_transformer.py | 4 +- kdb-bot/src/bot_data/model/auth_user.py | 2 +- kdb-web/package.json | 2 +- kdb-web/src/app/models/auth/auth-user.dto.ts | 4 +- .../auth-user/auth-user.component.html | 405 ++++++++++-------- kdb-web/src/assets/config.json | 2 +- kdb-web/src/assets/i18n/de.json | 4 +- 8 files changed, 250 insertions(+), 191 deletions(-) diff --git a/kdb-bot/src/bot_api/model/auth_user_dto.py b/kdb-bot/src/bot_api/model/auth_user_dto.py index 8d0d98b3..6d80410b 100644 --- a/kdb-bot/src/bot_api/model/auth_user_dto.py +++ b/kdb-bot/src/bot_api/model/auth_user_dto.py @@ -1,3 +1,4 @@ +from datetime import datetime from typing import Optional from bot_api.abc.dto_abc import DtoABC @@ -14,6 +15,8 @@ class AuthUserDTO(DtoABC): password: str = None, confirmation_id: Optional[str] = None, auth_role: AuthRoleEnum = None, + created_at: datetime = None, + modified_at: datetime = None, ): DtoABC.__init__(self) @@ -24,6 +27,8 @@ class AuthUserDTO(DtoABC): self._password = password self._is_confirmed = confirmation_id is None self._auth_role = auth_role + self._created_at = created_at + self._modified_at = modified_at @property def id(self) -> int: @@ -77,6 +82,14 @@ class AuthUserDTO(DtoABC): def auth_role(self, value: AuthRoleEnum): self._auth_role = value + @property + def created_at(self) -> datetime: + return self._created_at + + @property + def modified_at(self) -> datetime: + return self._modified_at + def from_dict(self, values: dict): self._id = values["id"] self._first_name = values["firstName"] @@ -86,6 +99,9 @@ class AuthUserDTO(DtoABC): self._is_confirmed = values["isConfirmed"] self._auth_role = AuthRoleEnum(values["authRole"]) + self._created_at = values["createdAt"] + self._modified_at = values["modifiedAt"] + def to_dict(self) -> dict: return { "id": self._id, @@ -95,4 +111,6 @@ class AuthUserDTO(DtoABC): "password": self._password, "isConfirmed": self._is_confirmed, "authRole": self._auth_role.value, + "createdAt": self._created_at, + "modifiedAt": self._modified_at, } diff --git a/kdb-bot/src/bot_api/transformer/auth_user_transformer.py b/kdb-bot/src/bot_api/transformer/auth_user_transformer.py index 56b35504..0e47ae35 100644 --- a/kdb-bot/src/bot_api/transformer/auth_user_transformer.py +++ b/kdb-bot/src/bot_api/transformer/auth_user_transformer.py @@ -1,4 +1,4 @@ -from datetime import datetime, timezone +from datetime import datetime from bot_api.abc.transformer_abc import TransformerABC from bot_api.model.auth_user_dto import AuthUserDTO @@ -34,4 +34,6 @@ class AuthUserTransformer(TransformerABC): "" if password is None else password, db.confirmation_id, db.auth_role, + db.created_at, + db.modified_at, ) diff --git a/kdb-bot/src/bot_data/model/auth_user.py b/kdb-bot/src/bot_data/model/auth_user.py index 7a91373d..f3a46707 100644 --- a/kdb-bot/src/bot_data/model/auth_user.py +++ b/kdb-bot/src/bot_data/model/auth_user.py @@ -1,11 +1,11 @@ import uuid from datetime import datetime from typing import Optional + from cpl_core.database import TableABC from cpl_query.extension import List from bot_data.model.auth_role_enum import AuthRoleEnum -from bot_data.model.server import Server from bot_data.model.user import User diff --git a/kdb-web/package.json b/kdb-web/package.json index 02ac81a3..0df95016 100644 --- a/kdb-web/package.json +++ b/kdb-web/package.json @@ -1,6 +1,6 @@ { "name": "kdb-web", - "version": "0.3.dev89", + "version": "0.3.dev78", "scripts": { "ng": "ng", "update-version": "ts-node-esm update-version.ts", diff --git a/kdb-web/src/app/models/auth/auth-user.dto.ts b/kdb-web/src/app/models/auth/auth-user.dto.ts index 17604288..5f38cbeb 100644 --- a/kdb-web/src/app/models/auth/auth-user.dto.ts +++ b/kdb-web/src/app/models/auth/auth-user.dto.ts @@ -8,4 +8,6 @@ export interface AuthUserDTO { password: string | null; isConfirmed?: boolean authRole?: AuthRoles; -} \ No newline at end of file + createdAt?: string; + modifiedAt?: string; +} diff --git a/kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.html b/kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.html index 9f810bda..86d29795 100644 --- a/kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.html +++ b/kdb-web/src/app/modules/admin/auth-users/components/auth-user/auth-user.component.html @@ -1,201 +1,236 @@

- {{'admin.auth_users.header' | translate}} + {{'admin.auth_users.header' | translate}}

-
- +
+ - -
-
- {{users.length}} {{'admin.auth_users.of' | translate}} - {{dt.totalRecords}} - - {{'admin.auth_users.users' | translate}} -
+ +
+
+ {{users.length}} {{'admin.auth_users.of' | translate}} + {{dt.totalRecords}} + + {{'admin.auth_users.users' | translate}} +
-
- - -
-
-
+
+ + +
+
+
- - - -
-
{{'admin.auth_users.headers.first_name' | translate}}
- -
- + + + +
+
{{'admin.auth_users.headers.first_name' | translate}}
+ +
+ - -
-
{{'admin.auth_users.headers.last_name' | translate}}
- -
- + +
+
{{'admin.auth_users.headers.last_name' | translate}}
+ +
+ - -
-
{{'admin.auth_users.headers.e_mail' | translate}}
- -
- + +
+
{{'admin.auth_users.headers.e_mail' | translate}}
+ +
+ - -
-
{{'admin.auth_users.headers.active' | translate}}
- -
- + +
+
{{'admin.auth_users.headers.active' | translate}}
+ +
+ - -
-
{{'admin.auth_users.headers.role' | translate}}
- -
- + +
+
{{'admin.auth_users.headers.role' | translate}}
+ +
+ - -
-
{{'admin.auth_users.headers.password' | translate}}
-
- + +
+
{{'admin.auth_users.headers.password' | translate}}
+
+ - -
-
{{'admin.auth_users.headers.actions' | translate}}
-
- - - - -
- -
- - -
- -
- - -
- -
- - - -
- -
- - - - -
+ +
+
{{'admin.auth_users.headers.created_at' | translate}}
+
+ - - - - - - - - - {{user.firstName}} - - - - - - - - - - {{user.lastName}} - - - - - - - - - - {{user.email}} - - - - - - - - - - - - - - - - - - - - - - {{user.authRole | authRole}} - - - - - - - - - - - - - -
- - + +
+
{{'admin.auth_users.headers.modified_at' | translate}}
+
+ - - -
- - -
+ +
+
{{'admin.auth_users.headers.actions' | translate}}
+
+ - - - {{'admin.auth_users.no_entries_found' | translate}} - - + + + +
+ +
+ + +
+ +
+ + +
+ +
+ + + +
+ +
+ + + + + + +
- - -
-
-
\ No newline at end of file + + + + + + + + + {{user.firstName}} + + + + + + + + + + {{user.lastName}} + + + + + + + + + + {{user.email}} + + + + + + + + + + + + + + + + + + + + + + {{user.authRole | authRole}} + + + + + + + + + + + + + + + + {{user.createdAt}} + + + {{user.createdAt | date:'dd.MM.yy HH:mm'}} + + + + + + + {{user.modifiedAt}} + + + {{user.modifiedAt | date:'dd.MM.yy HH:mm'}} + + + + +
+ + + + + +
+ + +
+ + + + {{'admin.auth_users.no_entries_found' | translate}} + + + + + + +
+ diff --git a/kdb-web/src/assets/config.json b/kdb-web/src/assets/config.json index 3aa6de44..87e33a65 100644 --- a/kdb-web/src/assets/config.json +++ b/kdb-web/src/assets/config.json @@ -3,7 +3,7 @@ "WebVersion": { "Major": "0", "Minor": "3", - "Micro": "dev89" + "Micro": "dev78" }, "Themes": [ { diff --git a/kdb-web/src/assets/i18n/de.json b/kdb-web/src/assets/i18n/de.json index 94ffc852..9317f607 100644 --- a/kdb-web/src/assets/i18n/de.json +++ b/kdb-web/src/assets/i18n/de.json @@ -64,7 +64,9 @@ "active": "Aktiv", "role": "Rolle", "password": "Passwort", - "actions": "Aktionen" + "actions": "Aktionen", + "created_at": "Erstellt am", + "modified_at": "Bearbeitet am" }, "no_entries_found": "Keine Einträge gefunden", "message": { -- 2.45.2