From b8e4146b33c3a2f348c05eca4c5e479ccf42d374 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Wed, 8 Mar 2023 14:55:26 +0100 Subject: [PATCH] Added history to all data tables #246 --- kdb-bot/src/bot_graphql/model/autoRole.gql | 1 - .../src/bot_graphql/model/autoRoleRule.gql | 1 - kdb-bot/src/bot_graphql/model/level.gql | 2 +- .../queries/auto_role_history_query.py | 13 ++------ .../queries/auto_role_rule_history_query.py | 7 +--- .../src/app/models/graphql/queries.model.ts | 32 +++++++++++++++++++ .../auto-roles-rules.component.html | 1 + .../auto-roles/auto-roles.component.html | 1 + .../components/levels/levels.component.html | 1 + kdb-web/src/assets/i18n/de.json | 11 ++++++- 10 files changed, 49 insertions(+), 21 deletions(-) diff --git a/kdb-bot/src/bot_graphql/model/autoRole.gql b/kdb-bot/src/bot_graphql/model/autoRole.gql index 4381a420..e859a364 100644 --- a/kdb-bot/src/bot_graphql/model/autoRole.gql +++ b/kdb-bot/src/bot_graphql/model/autoRole.gql @@ -18,7 +18,6 @@ type AutoRole implements TableWithHistoryQuery { type AutoRoleHistory implements HistoryTableQuery { id: ID channelId: String - channelName: String messageId: String server: ID diff --git a/kdb-bot/src/bot_graphql/model/autoRoleRule.gql b/kdb-bot/src/bot_graphql/model/autoRoleRule.gql index a7f4134e..2008424e 100644 --- a/kdb-bot/src/bot_graphql/model/autoRoleRule.gql +++ b/kdb-bot/src/bot_graphql/model/autoRoleRule.gql @@ -16,7 +16,6 @@ type AutoRoleRuleHistory implements HistoryTableQuery { id: ID emojiName: String roleId: String - roleName: String autoRole: ID diff --git a/kdb-bot/src/bot_graphql/model/level.gql b/kdb-bot/src/bot_graphql/model/level.gql index 6a6e2a41..cc937291 100644 --- a/kdb-bot/src/bot_graphql/model/level.gql +++ b/kdb-bot/src/bot_graphql/model/level.gql @@ -20,7 +20,7 @@ type LevelHistory implements HistoryTableQuery { minXp: Int permissions: String - server: Server + server: ID deleted: Boolean dateFrom: String diff --git a/kdb-bot/src/bot_graphql/queries/auto_role_history_query.py b/kdb-bot/src/bot_graphql/queries/auto_role_history_query.py index 678c6d52..7a96ad1d 100644 --- a/kdb-bot/src/bot_graphql/queries/auto_role_history_query.py +++ b/kdb-bot/src/bot_graphql/queries/auto_role_history_query.py @@ -4,7 +4,6 @@ from bot_data.abc.auto_role_repository_abc import AutoRoleRepositoryABC from bot_data.abc.server_repository_abc import ServerRepositoryABC from bot_data.model.auto_role import AutoRole from bot_graphql.abc.history_query_abc import HistoryQueryABC -from bot_graphql.filter.server_filter import ServerFilter class AutoRoleHistoryQuery(HistoryQueryABC): @@ -22,7 +21,6 @@ class AutoRoleHistoryQuery(HistoryQueryABC): self.set_field("id", self.resolve_id) self.set_field("channelId", self.resolve_channel_id) - self.set_field("channelName", self.resolve_channel_name) self.set_field("messageId", self.resolve_message_id) self.set_field("server", self.resolve_server) @@ -34,16 +32,9 @@ class AutoRoleHistoryQuery(HistoryQueryABC): def resolve_channel_id(x: AutoRole, *_): return x.discord_channel_id - @staticmethod - def resolve_channel_name(x: AutoRole, *_): - return x.discord_channel_name - @staticmethod def resolve_message_id(x: AutoRole, *_): return x.discord_message_id - def resolve_server(self, x: AutoRole, *_, filter: ServerFilter = None): - if filter is not None: - return filter.filter(self._servers.get_server_by_id(x.server.id)) - - return self._servers.get_server_by_id(x.server.id) + def resolve_server(self, x: AutoRole, *_): + return x.server diff --git a/kdb-bot/src/bot_graphql/queries/auto_role_rule_history_query.py b/kdb-bot/src/bot_graphql/queries/auto_role_rule_history_query.py index e0ea623e..8cfb6869 100644 --- a/kdb-bot/src/bot_graphql/queries/auto_role_rule_history_query.py +++ b/kdb-bot/src/bot_graphql/queries/auto_role_rule_history_query.py @@ -19,7 +19,6 @@ class AutoRoleRuleHistoryQuery(HistoryQueryABC): self.set_field("id", self.resolve_id) self.set_field("emojiName", self.resolve_emoji_name) self.set_field("roleId", self.resolve_role_id) - self.set_field("roleName", self.resolve_role_name) self.set_field("autoRole", self.resolve_auto_role) @staticmethod @@ -34,9 +33,5 @@ class AutoRoleRuleHistoryQuery(HistoryQueryABC): def resolve_role_id(x: AutoRoleRule, *_): return x.role_id - @staticmethod - def resolve_role_name(x: AutoRoleRule, *_): - return x.role_name - def resolve_auto_role(self, x: AutoRoleRule, *_): - return self._auto_roles.get_auto_role_by_id(x.auto_role.id) + return x.auto_role diff --git a/kdb-web/src/app/models/graphql/queries.model.ts b/kdb-web/src/app/models/graphql/queries.model.ts index 08108784..e9941f26 100644 --- a/kdb-web/src/app/models/graphql/queries.model.ts +++ b/kdb-web/src/app/models/graphql/queries.model.ts @@ -62,6 +62,18 @@ export class Queries { } createdAt modifiedAt + + history { + id + name + color + minXp + permissions + server + deleted + dateFrom + dateTo + } } } } @@ -148,6 +160,16 @@ export class Queries { createdAt modifiedAt + + history { + id + channelId + messageId + server + deleted + dateFrom + dateTo + } } } } @@ -170,6 +192,16 @@ export class Queries { createdAt modifiedAt + + history { + id + emojiName + roleId + autoRole + deleted + dateFrom + dateTo + } } } } diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.html b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.html index 8a6bfdaf..60c0d0eb 100644 --- a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.html +++ b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.html @@ -160,6 +160,7 @@
+ diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.html b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.html index 6b332b3e..f6695fca 100644 --- a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.html +++ b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.html @@ -193,6 +193,7 @@
+ diff --git a/kdb-web/src/app/modules/view/server/levels/components/levels/levels.component.html b/kdb-web/src/app/modules/view/server/levels/components/levels/levels.component.html index 0e5ed0ed..83f32aa3 100644 --- a/kdb-web/src/app/modules/view/server/levels/components/levels/levels.component.html +++ b/kdb-web/src/app/modules/view/server/levels/components/levels/levels.component.html @@ -184,6 +184,7 @@
+