1 Commits

Author SHA1 Message Date
eeda0405f3 Merge pull request 'dev' (#400) from dev into master
All checks were successful
Deploy dev on push / on-push-deploy_sh-edraft (push) Successful in 3m13s
Reviewed-on: sh-edraft.de/kd_discord_bot#400
2023-10-03 11:09:46 +02:00
52 changed files with 240 additions and 1221 deletions

View File

@@ -9,13 +9,11 @@ from bot_data.migration.api_key_migration import ApiKeyMigration
from bot_data.migration.api_migration import ApiMigration
from bot_data.migration.auto_role_fix1_migration import AutoRoleFix1Migration
from bot_data.migration.auto_role_migration import AutoRoleMigration
from bot_data.migration.birthday_migration import BirthdayMigration
from bot_data.migration.config_feature_flags_migration import ConfigFeatureFlagsMigration
from bot_data.migration.config_migration import ConfigMigration
from bot_data.migration.db_history_migration import DBHistoryMigration
from bot_data.migration.default_role_migration import DefaultRoleMigration
from bot_data.migration.fix_updates_migration import FixUpdatesMigration
from bot_data.migration.fix_user_history_migration import FixUserHistoryMigration
from bot_data.migration.initial_migration import InitialMigration
from bot_data.migration.level_migration import LevelMigration
from bot_data.migration.remove_stats_migration import RemoveStatsMigration
@@ -58,5 +56,3 @@ class StartupMigrationExtension(StartupExtensionABC):
services.add_transient(MigrationABC, ShortRoleNameMigration) # 28.09.2023 #378 - 1.1.7
services.add_transient(MigrationABC, FixUpdatesMigration) # 28.09.2023 #378 - 1.1.7
services.add_transient(MigrationABC, ShortRoleNameOnlyHighestMigration) # 02.10.2023 #391 - 1.1.9
services.add_transient(MigrationABC, FixUserHistoryMigration) # 10.10.2023 #401 - 1.2.0
services.add_transient(MigrationABC, BirthdayMigration) # 10.10.2023 #401 - 1.2.0

View File

@@ -229,10 +229,6 @@
"success": "Verlinkung wurde entfernt :D"
},
"user": {
"birthday": {
"success": "Dein Geburtstag wurde eingetragen.",
"success_team": "{} hat seinen Geburtstag eingetragen: {}"
},
"add": {
"xp": "Die {} von {} wurden um {} erhöht"
},

View File

@@ -131,7 +131,7 @@ class ClientUtilsService(ClientUtilsABC):
if current in sl:
sl = sl.skip(sl.index_of(current))
_l = _l.where(lambda x: select(x) in sl)
_l = _l.where(lambda x: x.name in sl)
return _l.take(25)

View File

@@ -1,84 +0,0 @@
from bot_core.logging.database_logger import DatabaseLogger
from bot_data.abc.migration_abc import MigrationABC
from bot_data.db_context import DBContext
class BirthdayMigration(MigrationABC):
name = "1.2.0_BirthdayMigration"
def __init__(self, logger: DatabaseLogger, db: DBContext):
MigrationABC.__init__(self)
self._logger = logger
self._db = db
self._cursor = db.cursor
def upgrade(self):
self._logger.debug(__name__, "Running upgrade")
self._cursor.execute(
str(
f"""
ALTER TABLE Users
ADD Birthday DATE NULL AFTER MessageCount;
"""
)
)
self._cursor.execute(
str(
f"""
ALTER TABLE UsersHistory
ADD Birthday DATE NULL AFTER MessageCount;
"""
)
)
self._exec(__file__, "users.sql")
self._cursor.execute(
str(
f"""
ALTER TABLE CFG_Server
ADD XpForBirthday BIGINT(20) NOT NULL DEFAULT 0 AFTER XpPerAchievement;
"""
)
)
self._cursor.execute(
str(
f"""
ALTER TABLE CFG_ServerHistory
ADD XpForBirthday BIGINT(20) NOT NULL DEFAULT 0 AFTER XpPerAchievement;
"""
)
)
self._exec(__file__, "config/server.sql")
def downgrade(self):
self._cursor.execute(
str(
f"""
ALTER TABLE Users DROP COLUMN Birthday;
"""
)
)
self._cursor.execute(
str(
f"""
ALTER TABLE UsersHistory DROP COLUMN Birthday;
"""
)
)
self._cursor.execute(
str(
f"""
ALTER TABLE CFG_Server DROP COLUMN XpForBirthday;
"""
)
)
self._cursor.execute(
str(
f"""
ALTER TABLE CFG_ServerHistory DROP COLUMN XpForBirthday;
"""
)
)

View File

@@ -9,9 +9,6 @@ CREATE TABLE IF NOT EXISTS `UsersHistory`
`Id` BIGINT(20) NOT NULL,
`DiscordId` BIGINT(20) NOT NULL,
`XP` BIGINT(20) NOT NULL DEFAULT 0,
`ReactionCount` BIGINT(20) NOT NULL DEFAULT 0,
`MessageCount` BIGINT(20) NOT NULL DEFAULT 0,
`Birthday` DATE NULL,
`ServerId` BIGINT(20) DEFAULT NULL,
`Deleted` BOOL DEFAULT FALSE,
`DateFrom` DATETIME(6) NOT NULL,
@@ -25,10 +22,12 @@ CREATE TRIGGER `TR_UsersUpdate`
ON `Users`
FOR EACH ROW
BEGIN
INSERT INTO `UsersHistory` (`Id`, `DiscordId`, `XP`, `ReactionCount`, `MessageCount`, `Birthday`, `ServerId`,
`DateFrom`, `DateTo`)
VALUES (OLD.UserId, OLD.DiscordId, OLD.XP, OLD.ReactionCount, OLD.MessageCount, OLD.Birthday, OLD.ServerId,
OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
INSERT INTO `UsersHistory` (
`Id`, `DiscordId`, `XP`, `ServerId`, `DateFrom`, `DateTo`
)
VALUES (
OLD.UserId, OLD.DiscordId, OLD.XP, OLD.ServerId, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6)
);
END;
DROP TRIGGER IF EXISTS `TR_UsersDelete`;
@@ -38,8 +37,10 @@ CREATE TRIGGER `TR_UsersDelete`
ON `Users`
FOR EACH ROW
BEGIN
INSERT INTO `UsersHistory` (`Id`, `DiscordId`, `XP`, `ReactionCount`, `MessageCount`, `Birthday`, `ServerId`,
`Deleted`, `DateFrom`, `DateTo`)
VALUES (OLD.UserId, OLD.DiscordId, OLD.XP, OLD.ReactionCount, OLD.MessageCount, OLD.Birthday, OLD.ServerId, TRUE,
OLD.LastModifiedAt, CURRENT_TIMESTAMP(6));
INSERT INTO `UsersHistory` (
`Id`, `DiscordId`, `XP`, `ServerId`, `Deleted`, `DateFrom`, `DateTo`
)
VALUES (
OLD.UserId, OLD.DiscordId, OLD.XP, OLD.ServerId, TRUE, OLD.LastModifiedAt, CURRENT_TIMESTAMP(6)
);
END;

View File

@@ -1,45 +0,0 @@
from bot_core.logging.database_logger import DatabaseLogger
from bot_data.abc.migration_abc import MigrationABC
from bot_data.db_context import DBContext
class FixUserHistoryMigration(MigrationABC):
name = "1.2.0_FixUserHistoryMigration"
def __init__(self, logger: DatabaseLogger, db: DBContext):
MigrationABC.__init__(self)
self._logger = logger
self._db = db
self._cursor = db.cursor
def upgrade(self):
self._logger.debug(__name__, "Running upgrade")
# fix 1.1.0_AchievementsMigration
self._cursor.execute(
str(
f"""ALTER TABLE UsersHistory ADD COLUMN IF NOT EXISTS ReactionCount BIGINT NOT NULL DEFAULT 0 AFTER XP;"""
)
)
self._cursor.execute(
str(
f"""ALTER TABLE UsersHistory ADD COLUMN IF NOT EXISTS MessageCount BIGINT NOT NULL DEFAULT 0 AFTER ReactionCount;"""
)
)
self._exec(__file__, "users.sql")
def downgrade(self):
self._cursor.execute(
str(
f"""
ALTER TABLE UsersHistory DROP COLUMN MessageCount;
"""
)
)
self._cursor.execute(
str(
f"""
ALTER TABLE UsersHistory DROP COLUMN ReactionCount;
"""
)
)

View File

@@ -24,7 +24,6 @@ class ServerConfig(TableABC, ConfigurationModelABC):
xp_per_ontime_hour: int,
xp_per_event_participation: int,
xp_per_achievement: int,
xp_for_birthday: int,
afk_command_channel_id: int,
help_voice_channel_id: int,
team_channel_id: int,
@@ -49,7 +48,6 @@ class ServerConfig(TableABC, ConfigurationModelABC):
self._xp_per_ontime_hour = xp_per_ontime_hour
self._xp_per_event_participation = xp_per_event_participation
self._xp_per_achievement = xp_per_achievement
self._xp_for_birthday = xp_for_birthday
self._afk_command_channel_id = afk_command_channel_id
self._help_voice_channel_id = help_voice_channel_id
self._team_channel_id = team_channel_id
@@ -78,7 +76,6 @@ class ServerConfig(TableABC, ConfigurationModelABC):
10,
10,
10,
10,
guild.system_channel.id,
guild.system_channel.id,
guild.system_channel.id,
@@ -167,14 +164,6 @@ class ServerConfig(TableABC, ConfigurationModelABC):
def xp_per_achievement(self, value: int):
self._xp_per_achievement = value
@property
def xp_for_birthday(self) -> int:
return self._xp_for_birthday
@xp_for_birthday.setter
def xp_for_birthday(self, value: int):
self._xp_for_birthday = value
@property
def afk_command_channel_id(self) -> int:
return self._afk_command_channel_id
@@ -291,7 +280,6 @@ class ServerConfig(TableABC, ConfigurationModelABC):
`XpPerOntimeHour`,
`XpPerEventParticipation`,
`XpPerAchievement`,
`XpForBirthday`,
`AFKCommandChannelId`,
`HelpVoiceChannelId`,
`TeamChannelId`,
@@ -310,7 +298,6 @@ class ServerConfig(TableABC, ConfigurationModelABC):
{self._xp_per_ontime_hour},
{self._xp_per_event_participation},
{self._xp_per_achievement},
'{self._xp_for_birthday}',
{self._afk_command_channel_id},
{self._help_voice_channel_id},
{self._team_channel_id},
@@ -337,7 +324,6 @@ class ServerConfig(TableABC, ConfigurationModelABC):
`XpPerOntimeHour` = {self._xp_per_ontime_hour},
`XpPerEventParticipation` = {self._xp_per_event_participation},
`XpPerAchievement` = {self._xp_per_achievement},
`XpForBirthday` = {self._xp_for_birthday},
`AFKCommandChannelId` = {self._afk_command_channel_id},
`HelpVoiceChannelId` = {self._help_voice_channel_id},
`TeamChannelId` = {self._team_channel_id},

View File

@@ -1,4 +1,4 @@
from datetime import datetime, date
from datetime import datetime
from typing import Optional
from cpl_core.database import TableABC
@@ -17,7 +17,6 @@ class User(TableABC):
xp: int,
reaction_count: int,
message_count: int,
birthday: Optional[date],
server: Optional[Server],
created_at: datetime = None,
modified_at: datetime = None,
@@ -28,7 +27,6 @@ class User(TableABC):
self._xp = xp
self._reaction_count = reaction_count
self._message_count = message_count
self._birthday = birthday
self._server = server
TableABC.__init__(self)
@@ -81,14 +79,6 @@ class User(TableABC):
def reaction_count(self, value: int):
self._reaction_count = value
@property
def birthday(self) -> Optional[datetime]:
return self._birthday
@birthday.setter
def birthday(self, value: Optional[datetime]):
self._birthday = value
@property
@ServiceProviderABC.inject
def ontime(self, services: ServiceProviderABC) -> float:
@@ -181,13 +171,12 @@ class User(TableABC):
return str(
f"""
INSERT INTO `Users` (
`DiscordId`, `XP`, `MessageCount`, `ReactionCount`, `Birthday`, `ServerId`
`DiscordId`, `XP`, `MessageCount`, `ReactionCount`, `ServerId`
) VALUES (
{self._discord_id},
{self._xp},
{self._message_count},
{self._reaction_count},
'{self._birthday}',
{self._server.id}
);
"""
@@ -200,8 +189,7 @@ class User(TableABC):
UPDATE `Users`
SET `XP` = {self._xp},
`MessageCount` = {self._message_count},
`ReactionCount` = {self._reaction_count},
`Birthday` = '{self._birthday}'
`ReactionCount` = {self._reaction_count}
WHERE `UserId` = {self._user_id};
"""
)

View File

@@ -1,43 +0,0 @@
from typing import Optional
from bot_data.abc.history_table_abc import HistoryTableABC
# had to name it UserWarnings instead of UserWarning because UserWarning is a builtin class
class UserWarningsHistory(HistoryTableABC):
def __init__(
self,
description: str,
user: int,
author: Optional[int],
deleted: bool,
date_from: str,
date_to: str,
id=0,
):
HistoryTableABC.__init__(self)
self._id = id
self._description = description
self._user = user
self._author = author
self._deleted = deleted
self._date_from = date_from
self._date_to = date_to
@property
def id(self) -> int:
return self._id
@property
def description(self) -> str:
return self._description
@property
def user(self) -> int:
return self._user
@property
def author(self) -> Optional[int]:
return self._author

View File

@@ -66,13 +66,12 @@ class ServerConfigRepositoryService(ServerConfigRepositoryABC):
result[13],
result[14],
result[15],
result[16],
json.loads(result[17]),
self._servers.get_server_by_id(result[18]),
self._get_afk_channel_ids(result[18]),
self._get_team_role_ids(result[18]),
json.loads(result[16]),
self._servers.get_server_by_id(result[17]),
self._get_afk_channel_ids(result[17]),
self._get_team_role_ids(result[17]),
result[18],
result[19],
result[20],
id=result[0],
)

View File

@@ -29,10 +29,9 @@ class UserRepositoryService(UserRepositoryABC):
result[2],
result[3],
result[4],
result[5].strftime("%d.%m.%Y") if result[5] is not None else None,
self._servers.get_server_by_id(result[6]),
self._servers.get_server_by_id(result[5]),
result[6],
result[7],
result[8],
id=result[0],
)

View File

@@ -32,7 +32,7 @@ class UserWarningsRepositoryService(UserWarningsRepositoryABC):
def _from_result(self, sql_result: tuple) -> UserWarnings:
user = self._users.get_user_by_id(self._get_value_from_result(sql_result[2]))
author = None
author_id = self._get_value_from_result(sql_result[3])
author_id = self._get_value_from_result(sql_result[2])
if author_id is not None:
author = self._users.get_user_by_id(author_id)

View File

@@ -1,4 +1,3 @@
from cpl_core.dependency_injection import ServiceProviderABC
from cpl_query.extension import List
from bot_data.model.user import User
@@ -6,14 +5,9 @@ from bot_graphql.abc.filter_abc import FilterABC
class AchievementFilter(FilterABC):
def __init__(
self,
services: ServiceProviderABC,
):
def __init__(self):
FilterABC.__init__(self)
self._services = services
self._id = None
self._name = None
self._description = None

View File

@@ -1,56 +0,0 @@
from cpl_core.dependency_injection import ServiceProviderABC
from cpl_query.extension import List
from bot_data.model.user_warnings import UserWarnings
from bot_graphql.abc.filter_abc import FilterABC
class UserWarningFilter(FilterABC):
def __init__(
self,
services: ServiceProviderABC,
):
FilterABC.__init__(self)
self._services = services
self._id = None
self._user = None
self._description = None
self._author = None
def from_dict(self, values: dict):
if "id" in values:
self._id = int(values["id"])
if "user" in values:
from bot_graphql.filter.user_filter import UserFilter
self._user: UserFilter = self._services.get_service(UserFilter)
self._user.from_dict(values["user"])
if "description" in values:
self._description = values["description"]
if "author" in values:
from bot_graphql.filter.user_filter import UserFilter
self._author: UserFilter = self._services.get_service(UserFilter)
self._author.from_dict(values["author"])
def filter(self, query: List[UserWarnings]) -> List[UserWarnings]:
if self._id is not None:
query = query.where(lambda x: x.id == self._id)
if self._user is not None:
users = self._user.filter(query.select(lambda x: x.user)).select(lambda x: x.id)
query = query.where(lambda x: x.id in users)
if self._description is not None:
query = query.where(lambda x: x.description == self._description or self._description in x.description)
if self._author is not None:
users = self._author.filter(query.select(lambda x: x.author)).select(lambda x: x.id)
query = query.where(lambda x: x.id in users)
return query

View File

@@ -41,9 +41,6 @@ type Query {
shortRoleNames(filter: ShortRoleNameFilter, page: Page, sort: Sort): [ShortRoleName]
shortRoleNamePositions: [String]
userWarningCount: Int
userWarnings(filter: UserWarningFilter, page: Page, sort: Sort): [UserWarning]
technicianConfig: TechnicianConfig
possibleFeatureFlags: [String]
discord: Discord

View File

@@ -9,7 +9,6 @@ type ServerConfig implements TableWithHistoryQuery {
xpPerOntimeHour: Int
xpPerEventParticipation: Int
xpPerAchievement: Int
xpForBirthday: Int
afkCommandChannelId: String
helpVoiceChannelId: String
teamChannelId: String
@@ -42,7 +41,6 @@ type ServerConfigHistory implements HistoryTableQuery {
xpPerOntimeHour: Int
xpPerEventParticipation: Int
xpPerAchievement: Int
xpForBirthday: Int
afkCommandChannelId: String
helpVoiceChannelId: String
teamChannelId: String
@@ -93,7 +91,6 @@ input ServerConfigInput {
xpPerOntimeHour: Int
xpPerEventParticipation: Int
xpPerAchievement: Int
xpForBirthday: Int
afkCommandChannelId: String
helpVoiceChannelId: String
teamChannelId: String

View File

@@ -5,7 +5,6 @@ type User implements TableWithHistoryQuery {
xp: Int
messageCount: Int
reactionCount: Int
birthday: String
ontime: Float
level: Level
@@ -21,9 +20,6 @@ type User implements TableWithHistoryQuery {
achievementCount: Int
achievements(filter: AchievementFilter, page: Page, sort: Sort): [Achievement]
userWarningCount: Int
userWarnings(filter: UserWarningFilter, page: Page, sort: Sort): [UserWarning]
server: Server
leftServer: Boolean
@@ -63,7 +59,5 @@ type UserMutation {
input UserInput {
id: ID
xp: Int
birthday: String
levelId: ID
userWarnings: [UserWarningInput]
}

View File

@@ -1,34 +0,0 @@
type UserWarning implements TableWithHistoryQuery {
id: ID
user: User
description: String
author: User
createdAt: String
modifiedAt: String
history: [UserWarningHistory]
}
type UserWarningHistory implements HistoryTableQuery {
id: ID
user: ID
description: String
author: ID
deleted: Boolean
dateFrom: String
dateTo: String
}
input UserWarningFilter {
id: ID
user: UserFilter
}
input UserWarningInput {
id: ID
user: ID
description: String
author: ID
}

View File

@@ -18,7 +18,6 @@ from bot_graphql.filter.user_filter import UserFilter
from bot_graphql.filter.user_joined_game_server_filter import UserJoinedGameServerFilter
from bot_graphql.filter.user_joined_server_filter import UserJoinedServerFilter
from bot_graphql.filter.user_joined_voice_channel_filter import UserJoinedVoiceChannelFilter
from bot_graphql.filter.user_warning_filter import UserWarningFilter
from bot_graphql.graphql_service import GraphQLService
from bot_graphql.mutation import Mutation
from bot_graphql.mutations.achievement_mutation import AchievementMutation
@@ -67,8 +66,6 @@ from bot_graphql.queries.user_joined_server_query import UserJoinedServerQuery
from bot_graphql.queries.user_joined_voice_channel_history_query import UserJoinedVoiceChannelHistoryQuery
from bot_graphql.queries.user_joined_voice_channel_query import UserJoinedVoiceChannelQuery
from bot_graphql.queries.user_query import UserQuery
from bot_graphql.queries.user_warning_history_query import UserWarningHistoryQuery
from bot_graphql.queries.user_warning_query import UserWarningQuery
from bot_graphql.query import Query
from bot_graphql.schema import Schema
@@ -118,8 +115,6 @@ class GraphQLModule(ModuleABC):
services.add_transient(QueryABC, UserJoinedGameServerQuery)
services.add_transient(QueryABC, ShortRoleNameHistoryQuery)
services.add_transient(QueryABC, ShortRoleNameQuery)
services.add_transient(QueryABC, UserWarningHistoryQuery)
services.add_transient(QueryABC, UserWarningQuery)
services.add_transient(QueryABC, DiscordQuery)
services.add_transient(QueryABC, GuildQuery)
@@ -140,7 +135,6 @@ class GraphQLModule(ModuleABC):
services.add_transient(FilterABC, UserJoinedVoiceChannelFilter)
services.add_transient(FilterABC, UserJoinedGameServerFilter)
services.add_transient(FilterABC, ShortRoleNameFilter)
services.add_transient(FilterABC, UserWarningFilter)
# mutations
services.add_transient(QueryABC, AutoRoleMutation)

View File

@@ -139,7 +139,6 @@ class ServerConfigMutation(QueryABC):
self._update_team_role_ids(server_config)
self._db.save_changes()
self._bot.loop.create_task(self._config_service.reload_server_config(server_config.server))
return server_config
def _update_afk_channel_ids(self, new_config: ServerConfig):
@@ -179,3 +178,5 @@ class ServerConfigMutation(QueryABC):
continue
self._server_configs.add_server_team_role_id_config(role_id)
self._bot.loop.create_task(self._config_service.reload_server_config(new_config.server))

View File

@@ -1,17 +1,11 @@
from datetime import datetime
from cpl_core.database.context import DatabaseContextABC
from cpl_discord.service import DiscordBotServiceABC
from bot_api.route.route import Route
from bot_data.abc.level_repository_abc import LevelRepositoryABC
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from bot_data.abc.user_repository_abc import UserRepositoryABC
from bot_data.abc.user_warnings_repository_abc import UserWarningsRepositoryABC
from bot_data.model.user import User
from bot_data.model.user_role_enum import UserRoleEnum
from bot_graphql.abc.query_abc import QueryABC
from modules.base.service.user_warnings_service import UserWarningsService
from modules.level.service.level_service import LevelService
from modules.permission.service.permission_service import PermissionService
@@ -26,8 +20,6 @@ class UserMutation(QueryABC):
permissions: PermissionService,
levels: LevelRepositoryABC,
level_service: LevelService,
user_warnings: UserWarningsRepositoryABC,
user_warning_service: UserWarningsService,
):
QueryABC.__init__(self, "UserMutation")
@@ -38,19 +30,11 @@ class UserMutation(QueryABC):
self._permissions = permissions
self._levels = levels
self._level_service = level_service
self._user_warnings = user_warnings
self._user_warning_service = user_warning_service
self.set_field("updateUser", self.resolve_update_user)
def resolve_update_user(self, *_, input: dict):
user = self._users.get_user_by_id(input["id"])
auth_user = Route.get_user()
member = self._bot.get_guild(user.server.discord_id).get_member(
auth_user.users.where(lambda x: x.server.id == user.server.id).single().discord_id
)
if member.id != user.discord_id:
self._can_user_mutate_data(user.server, UserRoleEnum.moderator)
new_xp = None
@@ -59,32 +43,11 @@ class UserMutation(QueryABC):
if user.level.id != level.id:
new_xp = level.min_xp
if "userWarnings" in input:
self._update_user_warning(user, input["userWarnings"])
user.xp = new_xp if new_xp is not None else input["xp"] if "xp" in input else user.xp
user.birthday = datetime.strptime(input["birthday"], "%d.%m.%Y") if "birthday" in input else user.birthday
self._users.update_user(user)
self._db.save_changes()
self._bot.loop.create_task(self._level_service.set_level(user))
user = self._users.get_user_by_id(input["id"])
return user
def _update_user_warning(self, user: User, new_warnings: dict):
old_warnings = self._user_warnings.get_user_warnings_by_user_id(user.id)
for warning in old_warnings:
if warning.id in [int(x["id"]) if "id" in x else None for x in new_warnings]:
continue
self._user_warning_service.remove_warnings(warning.id)
for warning in new_warnings:
if "id" in warning and int(warning["id"]) in old_warnings.select(lambda x: x.id):
continue
member = self._bot.get_guild(user.server.discord_id).get_member(user.discord_id)
author = self._users.get_user_by_id(int(warning["author"]))
self._user_warning_service.add_warnings(member, warning["description"], author.discord_id)

View File

@@ -20,7 +20,6 @@ class ServerConfigQuery(DataQueryWithHistoryABC):
self.set_field("xpPerOntimeHour", lambda config, *_: config.xp_per_ontime_hour)
self.set_field("xpPerEventParticipation", lambda config, *_: config.xp_per_event_participation)
self.set_field("xpPerAchievement", lambda config, *_: config.xp_per_achievement)
self.set_field("xpForBirthday", lambda config, *_: config.xp_for_birthday)
self.set_field("afkCommandChannelId", lambda config, *_: config.afk_command_channel_id)
self.set_field("helpVoiceChannelId", lambda config, *_: config.help_voice_channel_id)
self.set_field("teamChannelId", lambda config, *_: config.team_channel_id)

View File

@@ -6,7 +6,6 @@ from bot_data.abc.achievement_repository_abc import AchievementRepositoryABC
from bot_data.abc.user_joined_game_server_repository_abc import UserJoinedGameServerRepositoryABC
from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC
from bot_data.abc.user_joined_voice_channel_repository_abc import UserJoinedVoiceChannelRepositoryABC
from bot_data.abc.user_warnings_repository_abc import UserWarningsRepositoryABC
from bot_data.model.user import User
from bot_data.model.user_history import UserHistory
from bot_graphql.abc.data_query_with_history_abc import DataQueryWithHistoryABC
@@ -14,7 +13,6 @@ from bot_graphql.filter.achievement_filter import AchievementFilter
from bot_graphql.filter.user_joined_game_server_filter import UserJoinedGameServerFilter
from bot_graphql.filter.user_joined_server_filter import UserJoinedServerFilter
from bot_graphql.filter.user_joined_voice_channel_filter import UserJoinedVoiceChannelFilter
from bot_graphql.filter.user_warning_filter import UserWarningFilter
from modules.level.service.level_service import LevelService
from modules.permission.abc.permission_service_abc import PermissionServiceABC
@@ -31,7 +29,6 @@ class UserQuery(DataQueryWithHistoryABC):
user_joined_game_server: UserJoinedGameServerRepositoryABC,
permissions: PermissionServiceABC,
achievements: AchievementRepositoryABC,
user_warnings: UserWarningsRepositoryABC,
):
DataQueryWithHistoryABC.__init__(self, "User", "UsersHistory", UserHistory, db)
@@ -50,7 +47,6 @@ class UserQuery(DataQueryWithHistoryABC):
self.set_field("xp", self.resolve_xp)
self.set_field("messageCount", lambda x, *_: x.message_count)
self.set_field("reactionCount", lambda x, *_: x.reaction_count)
self.set_field("birthday", lambda x, *_: x.birthday)
self.set_field("ontime", self.resolve_ontime)
self.set_field("level", self.resolve_level)
self.add_collection(
@@ -71,9 +67,6 @@ class UserQuery(DataQueryWithHistoryABC):
self.add_collection(
"achievement", lambda user, *_: achievements.get_achievements_by_user_id(user.id), AchievementFilter
)
self.add_collection(
"userWarning", lambda user, *_: user_warnings.get_user_warnings_by_user_id(user.id), UserWarningFilter
)
self.set_field("server", self.resolve_server)
self.set_field("leftServer", self.resolve_left_server)

View File

@@ -1,11 +0,0 @@
from bot_graphql.abc.history_query_abc import HistoryQueryABC
class UserWarningHistoryQuery(HistoryQueryABC):
def __init__(self):
HistoryQueryABC.__init__(self, "UserWarning")
self.set_field("id", lambda x, *_: x.id)
self.set_field("user", lambda x, *_: x.user)
self.set_field("description", lambda x, *_: x.description)
self.set_field("author", lambda x, *_: x.author)

View File

@@ -1,17 +0,0 @@
from cpl_core.database.context import DatabaseContextABC
from bot_data.model.user_warnings_history import UserWarningsHistory
from bot_graphql.abc.data_query_with_history_abc import DataQueryWithHistoryABC
class UserWarningQuery(DataQueryWithHistoryABC):
def __init__(
self,
db: DatabaseContextABC,
):
DataQueryWithHistoryABC.__init__(self, "UserWarning", "UserWarningsHistory", UserWarningsHistory, db)
self.set_field("id", lambda x, *_: x.id)
self.set_field("user", lambda x, *_: x.user)
self.set_field("description", lambda x, *_: x.description)
self.set_field("author", lambda x, *_: x.author)

View File

@@ -15,7 +15,6 @@ from bot_data.abc.user_joined_game_server_repository_abc import UserJoinedGameSe
from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC
from bot_data.abc.user_joined_voice_channel_repository_abc import UserJoinedVoiceChannelRepositoryABC
from bot_data.abc.user_repository_abc import UserRepositoryABC
from bot_data.abc.user_warnings_repository_abc import UserWarningsRepositoryABC
from bot_data.model.short_role_name_position_enum import ShortRoleNamePositionEnum
from bot_graphql.abc.query_abc import QueryABC
from bot_graphql.filter.achievement_filter import AchievementFilter
@@ -29,7 +28,6 @@ from bot_graphql.filter.user_filter import UserFilter
from bot_graphql.filter.user_joined_game_server_filter import UserJoinedGameServerFilter
from bot_graphql.filter.user_joined_server_filter import UserJoinedServerFilter
from bot_graphql.filter.user_joined_voice_channel_filter import UserJoinedVoiceChannelFilter
from bot_graphql.filter.user_warning_filter import UserWarningFilter
from bot_graphql.model.discord import Discord
from modules.achievements.achievement_service import AchievementService
@@ -50,7 +48,6 @@ class Query(QueryABC):
users: UserRepositoryABC,
achievements: AchievementRepositoryABC,
short_role_names: ShortRoleNameRepositoryABC,
user_warnings: UserWarningsRepositoryABC,
achievement_service: AchievementService,
technician_config: TechnicianConfigRepositoryABC,
):
@@ -79,13 +76,11 @@ class Query(QueryABC):
self.add_collection("user", lambda *_: users.get_users(), UserFilter)
self.add_collection("achievement", lambda *_: achievements.get_achievements(), AchievementFilter)
self.add_collection("shortRoleName", lambda *_: short_role_names.get_short_role_names(), ShortRoleNameFilter)
self.add_collection("userWarning", lambda *_: user_warnings.get_user_warnings(), UserWarningFilter)
self.set_field("technicianConfig", lambda *_: technician_config.get_technician_config())
self.set_field("achievementAttributes", lambda *_: achievement_service.get_attributes())
self.set_field("achievementOperators", lambda *_: achievement_service.get_operators())
self.set_field("shortRoleNamePositions", lambda *_: [x.value for x in ShortRoleNamePositionEnum])
self.set_field("possibleFeatureFlags", lambda *_: [e.value for e in FeatureFlagsEnum])
self.set_field("discord", lambda *_: Discord(bot.guilds, List(any).extend(bot.users)))

View File

@@ -61,7 +61,7 @@ class AutoRoleGroup(DiscordCommandABC):
auto_roles = self._auto_roles.get_auto_roles_by_server_id(server.id).select(lambda x: x.id)
return [
app_commands.Choice(name=auto_role, value=auto_role)
for auto_role in self._client_utils.get_auto_complete_list(auto_roles, current, lambda x: x.name)
for auto_role in self._client_utils.get_auto_complete_list(auto_roles, current)
]
@commands.hybrid_group(name="auto-role")

View File

@@ -1,12 +1,10 @@
import datetime
from typing import Optional, List as TList
from typing import Optional, List
import discord
from cpl_core.configuration import ConfigurationABC
from cpl_core.database.context import DatabaseContextABC
from cpl_discord.command import DiscordCommandABC
from cpl_discord.service import DiscordBotServiceABC
from cpl_query.extension import List
from cpl_translation import TranslatePipe
from discord import app_commands
from discord.ext import commands
@@ -24,7 +22,6 @@ from bot_data.abc.user_joined_voice_channel_repository_abc import (
)
from bot_data.abc.user_repository_abc import UserRepositoryABC
from bot_data.abc.user_warnings_repository_abc import UserWarningsRepositoryABC
from bot_data.model.server_config import ServerConfig
from modules.base.service.user_warnings_service import UserWarningsService
from modules.level.service.level_service import LevelService
from modules.permission.abc.permission_service_abc import PermissionServiceABC
@@ -76,7 +73,7 @@ class UserGroup(DiscordCommandABC):
"ontime": self._t.transform("modules.base.user.atr.ontime"),
}
self._atr_TList = [(key, self._atr_dict[key]) for key in self._atr_dict]
self._atr_list = [(key, self._atr_dict[key]) for key in self._atr_dict]
async def _handle_atr_calc(
self,
@@ -119,61 +116,6 @@ class UserGroup(DiscordCommandABC):
async def user(self, ctx: Context):
pass
@user.command()
@commands.guild_only()
@CommandChecks.check_is_ready()
async def birthday(self, ctx: Context, day: int, month: int, year: int):
self._logger.debug(__name__, f"Received command user birthday {ctx}:{ctx.author},{day}:{month}:{year}")
date = datetime.date(year, month, day)
server = self._servers.get_server_by_discord_id(ctx.guild.id)
user = self._users.get_user_by_discord_id_and_server_id(ctx.author.id, server.id)
user.birthday = date
self._users.update_user(user)
self._db.save_changes()
await self._message_service.send_interaction_msg(
ctx.interaction, self._t.transform("modules.base.user.birthday.success")
)
# notify team to prevent multiple entries every day
settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}")
channel = ctx.guild.get_channel(settings.team_channel_id)
await self._message_service.send_channel_message(
channel,
self._t.transform("modules.base.user.birthday.success_team").format(ctx.author.mention, date),
is_persistent=True,
)
self._logger.trace(__name__, f"Finished user-info command")
@birthday.autocomplete("day")
async def birthday_autocomplete(
self, interaction: discord.Interaction, current: str
) -> TList[app_commands.Choice[int]]:
days = List(int, range(0, 32)).select(lambda x: str(x))
return [
app_commands.Choice(name=date, value=date)
for date in self._client_utils.get_auto_complete_list(days, current)
]
@birthday.autocomplete("month")
async def birthday_autocomplete(
self, interaction: discord.Interaction, current: str
) -> TList[app_commands.Choice[int]]:
days = List(int, range(0, 13)).select(lambda x: str(x))
return [
app_commands.Choice(name=date, value=date)
for date in self._client_utils.get_auto_complete_list(days, current)
]
@birthday.autocomplete("year")
async def birthday_autocomplete(
self, interaction: discord.Interaction, current: str
) -> TList[app_commands.Choice[int]]:
today = datetime.date.today()
days = List(int, range(today.year - 75, today.year)).select(lambda x: str(x))
return [
app_commands.Choice(name=date, value=date)
for date in self._client_utils.get_auto_complete_list(days, current)
]
@user.command()
@commands.guild_only()
@CommandChecks.check_is_ready()
@@ -295,8 +237,8 @@ class UserGroup(DiscordCommandABC):
)
@get.autocomplete("atr")
async def get_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]:
return [app_commands.Choice(name=value, value=key) for key, value in self._atr_TList]
async def get_autocomplete(self, interaction: discord.Interaction, current: str) -> List[app_commands.Choice[str]]:
return [app_commands.Choice(name=value, value=key) for key, value in self._atr_list]
@user.command()
@commands.guild_only()
@@ -339,9 +281,9 @@ class UserGroup(DiscordCommandABC):
)
@set.autocomplete("atr")
async def set_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]:
atr_TList = [("xp", self._atr_dict["xp"])]
return [app_commands.Choice(name=value, value=key) for key, value in atr_TList]
async def set_autocomplete(self, interaction: discord.Interaction, current: str) -> List[app_commands.Choice[str]]:
atr_list = [("xp", self._atr_dict["xp"])]
return [app_commands.Choice(name=value, value=key) for key, value in atr_list]
@user.command()
@commands.guild_only()
@@ -352,9 +294,9 @@ class UserGroup(DiscordCommandABC):
await self._handle_atr_calc(ctx, atr, value, member)
@add.autocomplete("atr")
async def set_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]:
atr_TList = [("xp", self._atr_dict["xp"])]
return [app_commands.Choice(name=value, value=key) for key, value in atr_TList]
async def set_autocomplete(self, interaction: discord.Interaction, current: str) -> List[app_commands.Choice[str]]:
atr_list = [("xp", self._atr_dict["xp"])]
return [app_commands.Choice(name=value, value=key) for key, value in atr_list]
@user.command()
@commands.guild_only()
@@ -365,9 +307,9 @@ class UserGroup(DiscordCommandABC):
await self._handle_atr_calc(ctx, atr, value, member, is_remove=True)
@remove.autocomplete("atr")
async def set_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]:
atr_TList = [("xp", self._atr_dict["xp"])]
return [app_commands.Choice(name=value, value=key) for key, value in atr_TList]
async def set_autocomplete(self, interaction: discord.Interaction, current: str) -> List[app_commands.Choice[str]]:
atr_list = [("xp", self._atr_dict["xp"])]
return [app_commands.Choice(name=value, value=key) for key, value in atr_list]
@user.command()
@commands.guild_only()
@@ -407,8 +349,8 @@ class UserGroup(DiscordCommandABC):
@reset.autocomplete("atr")
async def reset_autocomplete(
self, interaction: discord.Interaction, current: str
) -> TList[app_commands.Choice[str]]:
return [app_commands.Choice(name=value, value=key) for key, value in self._atr_TList]
) -> List[app_commands.Choice[str]]:
return [app_commands.Choice(name=value, value=key) for key, value in self._atr_list]
@user.group()
@commands.guild_only()
@@ -458,7 +400,7 @@ class UserGroup(DiscordCommandABC):
async def add(self, ctx: Context, member: discord.Member, description: str):
self._logger.debug(__name__, f"Received command user warning add {ctx}:{member},{description}")
try:
await self._user_warnings_service.add_warnings_async(member, description, ctx.author.id)
await self._user_warnings_service.add_warnings(member, description, ctx.author.id)
await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.base.warnings.add.success"))
except Exception as e:
self._logger.error(__name__, f"Adding user warning failed", e)
@@ -472,7 +414,7 @@ class UserGroup(DiscordCommandABC):
async def remove(self, ctx: Context, warning_id: int):
self._logger.debug(__name__, f"Received command user warning remove {ctx}:{warning_id}")
try:
await self._user_warnings_service.remove_warnings_async(warning_id)
await self._user_warnings_service.remove_warnings(warning_id)
await self._message_service.send_ctx_msg(ctx, self._t.transform("modules.base.warnings.remove.success"))
except Exception as e:
self._logger.error(__name__, f"Removing user warning failed", e)

View File

@@ -108,15 +108,7 @@ class UserWarningsService:
await self.notify_team(member, self._t.transform("modules.base.warnings.kick").format(member.mention))
await member.kick()
async def _notify_after_add(self, member: discord.Member, warning: UserWarnings):
server = self._servers.get_server_by_discord_id(member.guild.id)
user = self._users.get_user_by_discord_id_and_server_id(member.id, server.id)
await self.notify_user(member, self._t.transform("modules.base.warnings.warned").format(warning.description))
await self.notify_team(member, warning.description)
await self.check_for_warnings(member, user)
def _add_warnings(self, member: discord.Member, description: str, author_id: int = None):
async def add_warnings(self, member: discord.Member, description: str, author_id: int = None):
server = self._servers.get_server_by_discord_id(member.guild.id)
user = self._users.get_user_by_discord_id_and_server_id(member.id, server.id)
@@ -127,32 +119,17 @@ class UserWarningsService:
warning = UserWarnings(description, user, author)
self._warnings.add_user_warnings(warning)
self._db.save_changes()
return warning
await self.notify_user(member, self._t.transform("modules.base.warnings.warned").format(warning.description))
await self.notify_team(member, warning.description)
await self.check_for_warnings(member, user)
def add_warnings(self, member: discord.Member, description: str, author_id: int = None):
warning = self._add_warnings(member, description, author_id)
self._bot.loop.create_task(self._notify_after_add(member, warning))
async def add_warnings_async(self, member: discord.Member, description: str, author_id: int = None):
warning = self._add_warnings(member, description, author_id)
await self._notify_after_add(member, warning)
async def _notify_after_remove(self, warning: UserWarnings):
guild = self._bot.get_guild(warning.user.server.discord_id)
member = guild.get_member(warning.user.discord_id)
await self.notify_user(member, self._t.transform("modules.base.warnings.removed").format(warning.description))
await self.notify_team(member, warning.description, removed=True)
def _remove_warnings(self, id: int):
async def remove_warnings(self, id: int):
warning = self._warnings.get_user_warnings_by_id(id)
self._warnings.delete_user_warnings(warning)
self._db.save_changes()
return warning
def remove_warnings(self, id: int):
warning = self._remove_warnings(id)
self._bot.loop.create_task(self._notify_after_remove(warning))
guild = self._bot.get_guild(warning.user.server.discord_id)
member = guild.get_member(warning.user.discord_id)
async def remove_warnings_async(self, id: int):
warning = self._remove_warnings(id)
await self._notify_after_remove(warning)
await self.notify_user(member, self._t.transform("modules.base.warnings.removed").format(warning.description))
await self.notify_team(member, warning.description, removed=True)

View File

@@ -1,12 +1,12 @@
{
"name": "kdb-web",
"version": "1.2.0",
"version": "1.0.dev127_config_in_wi",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "kdb-web",
"version": "1.2.0",
"version": "1.0.dev127_config_in_wi",
"dependencies": {
"@angular/animations": "^15.1.4",
"@angular/common": "^15.1.4",
@@ -21,7 +21,7 @@
"@ngx-translate/core": "^14.0.0",
"@ngx-translate/http-loader": "^7.0.0",
"@types/socket.io-client": "^3.0.0",
"moment": "^2.29.4",
"primeflex": "^3.3.1",
"primeicons": "^6.0.1",
"primeng": "^15.2.0",
"rxjs": "~7.5.0",
@@ -8157,14 +8157,6 @@
"mkdirp": "bin/cmd.js"
}
},
"node_modules/moment": {
"version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
"engines": {
"node": "*"
}
},
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@@ -9311,6 +9303,11 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/primeflex": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/primeflex/-/primeflex-3.3.1.tgz",
"integrity": "sha512-zaOq3YvcOYytbAmKv3zYc+0VNS9Wg5d37dfxZnveKBFPr7vEIwfV5ydrpiouTft8MVW6qNjfkaQphHSnvgQbpQ=="
},
"node_modules/primeicons": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/primeicons/-/primeicons-6.0.1.tgz",

View File

@@ -1,6 +1,6 @@
{
"name": "kdb-web",
"version": "1.2.0",
"version": "1.1.10",
"scripts": {
"ng": "ng",
"update-version": "ts-node update-version.ts",
@@ -30,7 +30,6 @@
"@ngx-translate/core": "^14.0.0",
"@ngx-translate/http-loader": "^7.0.0",
"@types/socket.io-client": "^3.0.0",
"moment": "^2.29.4",
"primeicons": "^6.0.1",
"primeng": "^15.2.0",
"rxjs": "~7.5.0",

View File

@@ -1,22 +1,23 @@
import { HttpClient, HttpClientModule } from "@angular/common/http";
import { APP_INITIALIZER, ErrorHandler, NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { JwtModule } from "@auth0/angular-jwt";
import { TranslateLoader, TranslateModule } from "@ngx-translate/core";
import { TranslateHttpLoader } from "@ngx-translate/http-loader";
import { ConfirmationService, MessageService } from "primeng/api";
import { DialogService } from "primeng/dynamicdialog";
import { AppRoutingModule } from "./app-routing.module";
import { AppComponent } from "./app.component";
import { NotFoundComponent } from "./components/error/not-found/not-found.component";
import { FooterComponent } from "./components/footer/footer.component";
import { HeaderComponent } from "./components/header/header.component";
import { SidebarComponent } from "./components/sidebar/sidebar.component";
import { SpinnerComponent } from "./components/spinner/spinner.component";
import { SharedModule } from "./modules/shared/shared.module";
import { ErrorHandlerService } from "./services/error-handler/error-handler.service";
import { SettingsService } from "./services/settings/settings.service";
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { APP_INITIALIZER, ErrorHandler, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { JwtModule } from '@auth0/angular-jwt';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { ConfirmationService, MessageService } from 'primeng/api';
import { DialogService } from 'primeng/dynamicdialog';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { NotFoundComponent } from './components/error/not-found/not-found.component';
import { FooterComponent } from './components/footer/footer.component';
import { HeaderComponent } from './components/header/header.component';
import { SidebarComponent } from './components/sidebar/sidebar.component';
import { SpinnerComponent } from './components/spinner/spinner.component';
import { SharedModule } from './modules/shared/shared.module';
import { ErrorHandlerService } from './services/error-handler/error-handler.service';
import { SettingsService } from './services/settings/settings.service';
@NgModule({
@@ -62,7 +63,7 @@ import { SettingsService } from "./services/settings/settings.service";
},
MessageService,
ConfirmationService,
DialogService,
DialogService
],
bootstrap: [AppComponent]
})

View File

@@ -5,16 +5,14 @@ import { UserJoinedServer } from "./user_joined_server.model";
import { UserJoinedVoiceChannel } from "./user_joined_voice_channel.model";
import { UserJoinedGameServer } from "./user_joined_game_server.model";
import { Achievement } from "./achievement.model";
import { UserWarning } from "./user_warning.model";
export interface User extends DataWithHistory {
id?: number;
discordId?: number;
name?: string;
xp?: number;
messageCount?: number;
reactionCount?: number;
birthday?: string;
message_count?: number;
reaction_count?: number;
ontime?: number;
level?: Level;
server?: Server;
@@ -31,9 +29,6 @@ export interface User extends DataWithHistory {
achievementCount?: number;
achievements?: Achievement[];
userWarningCount?: number;
userWarnings?: UserWarning[];
}
export interface UserFilter {

View File

@@ -1,16 +0,0 @@
import { DataWithHistory } from "./data.model";
import { User, UserFilter } from "./user.model";
export interface UserWarning extends DataWithHistory {
id?: number;
user?: User;
description?: string;
author?: User;
}
export interface UserWarningFilter {
id?: number;
user?: UserFilter;
description?: string;
author?: UserFilter;
}

View File

@@ -1,22 +1,15 @@
export class Mutations {
static updateUser = `
mutation updateUser($id: ID, $xp: Int $birthday: String, $levelId: ID, $userWarnings: [UserWarningInput]) {
mutation updateUser($id: ID, $xp: Int, $levelId: ID) {
user {
updateUser(input: { id: $id, xp: $xp, birthday: $birthday, levelId: $levelId, userWarnings: $userWarnings }) {
updateUser(input: { id: $id, xp: $xp, levelId: $levelId }) {
id
name
xp
messageCount
reactionCount
birthday
level {
id
name
}
userWarnings {
id
description
}
}
}
}
@@ -321,50 +314,4 @@ export class Mutations {
}
}
`;
static createUserWarning = `
mutation createUserWarning($name: String, $description: String, $attribute: String, $operator: String, $value: String, $serverId: ID) {
userWarning {
createUserWarning(input: { name: $name, description: $description, attribute: $attribute, operator: $operator, value: $value, serverId: $serverId}) {
id
name
description
attribute
operator
value
server {
id
}
}
}
}
`;
static updateUserWarning = `
mutation updateUserWarning($id: ID, $name: String, $description: String, $attribute: String, $operator: String, $value: String) {
userWarning {
updateUserWarning(input: { id: $id, name: $name, description: $description, attribute: $attribute, operator: $operator, value: $value}) {
id
name
description
attribute
operator
value
}
}
}
`;
static deleteUserWarning = `
mutation deleteUserWarning($id: ID) {
userWarning {
deleteUserWarning(id: $id) {
id
name
}
}
}
`;
}

View File

@@ -208,7 +208,7 @@ export class Queries {
query {
shortRoleNamePositions
}
`;
`
static shortRoleNameQuery = `
query ShortRoleNameList($serverId: ID, $filter: ShortRoleNameFilter, $page: Page, $sort: Sort) {
@@ -279,15 +279,13 @@ export class Queries {
static userProfile = `
query UserProfile($serverId: ID, $userId: ID, $page: Page, $sort: Sort) {
servers(filter: {id: $serverId}) {
userCount
users(filter: {server: {id: $serverId}, id: $userId}, page: $page, sort: $sort) {
users(filter: {id: $userId}, page: $page, sort: $sort) {
id
discordId
name
xp
messageCount
reactionCount
birthday
ontime
level {
id
@@ -306,29 +304,6 @@ export class Queries {
leavedOn
}
createdAt
modifiedAt
}
}
`;
static userProfileAchievements = `
query UserProfile($serverId: ID, $userId: ID, $page: Page, $sort: Sort) {
users(filter: {server: {id: $serverId}, id: $userId}, page: $page, sort: $sort) {
achievementCount
achievements {
id
name
description
createdAt
}
}
}
`;
static userProfileVoiceChannelJoins = `
query UserProfile($serverId: ID, $userId: ID, $page: Page, $sort: Sort) {
users(filter: {server: {id: $serverId}, id: $userId}, page: $page, sort: $sort) {
joinedVoiceChannelCount
joinedVoiceChannels {
id
@@ -338,13 +313,7 @@ export class Queries {
joinedOn
leavedOn
}
}
}
`;
static userProfileGameserverJoins = `
query UserProfile($serverId: ID, $userId: ID, $page: Page, $sort: Sort) {
users(filter: {server: {id: $serverId}, id: $userId}, page: $page, sort: $sort) {
userJoinedGameServerCount
userJoinedGameServers {
id
@@ -353,27 +322,15 @@ export class Queries {
joinedOn
leavedOn
}
}
}
`;
static userProfileWarnings = `
query UserProfile($serverId: ID, $userId: ID, $page: Page, $sort: Sort) {
users(filter: {server: {id: $serverId}, id: $userId}, page: $page, sort: $sort) {
userWarningCount
userWarnings {
id
user {
id
name
}
description
author {
achievements {
id
name
createdAt
}
createdAt
modifiedAt
}
}
}

View File

@@ -8,7 +8,6 @@ import { TechnicianConfig } from "../config/technician-config.model";
import { ServerConfig } from "../config/server-config.model";
import { ShortRoleName } from "../data/short_role_name.model";
import { FeatureFlag } from "../config/feature-flags.model";
import { UserWarning } from "../data/user_warning.model";
export interface Query {
serverCount: number;
@@ -32,11 +31,6 @@ export interface UserListQuery {
users: User[];
}
export interface UserWarningQuery {
userWarningCount: number;
userWarnings: UserWarning[];
}
export interface GameServerListQuery {
gameServerCount: number;
gameServers: GameServer[];

View File

@@ -6,7 +6,6 @@ import { Achievement } from "../data/achievement.model";
import { TechnicianConfig } from "../config/technician-config.model";
import { ServerConfig } from "../config/server-config.model";
import { ShortRoleName } from "../data/short_role_name.model";
import { UserWarning } from "../data/user_warning.model";
export interface GraphQLResult {
data: {
@@ -78,11 +77,3 @@ export interface ShortRoleNameMutationResult {
deleteShortRoleName?: ShortRoleName
};
}
export interface UserWarningMutationResult {
userWarning: {
createUserWarning?: UserWarning
updateUserWarning?: UserWarning
deleteUserWarning?: UserWarning
};
}

View File

@@ -32,10 +32,22 @@ import { HideableHeaderComponent } from './components/hideable-header/hideable-h
import { MultiSelectColumnsComponent } from './base/multi-select-columns/multi-select-columns.component';
import { FeatureFlagListComponent } from './components/feature-flag-list/feature-flag-list.component';
import { InputSwitchModule } from "primeng/inputswitch";
import { CalendarModule } from "primeng/calendar";
const PrimeNGModules = [
@NgModule({
declarations: [
AuthRolePipe,
IpAddressPipe,
BoolPipe,
HistoryBtnComponent,
ConfigListComponent,
HideableColumnComponent,
HideableHeaderComponent,
MultiSelectColumnsComponent,
FeatureFlagListComponent,
],
imports: [
CommonModule,
ButtonModule,
PasswordModule,
MenuModule,
@@ -60,37 +72,42 @@ const PrimeNGModules = [
DataViewModule,
MultiSelectModule,
InputSwitchModule,
CalendarModule,
]
@NgModule({
declarations: [
AuthRolePipe,
IpAddressPipe,
BoolPipe,
HistoryBtnComponent,
ConfigListComponent,
HideableColumnComponent,
HideableHeaderComponent,
MultiSelectColumnsComponent,
FeatureFlagListComponent,
],
imports: [
CommonModule,
...PrimeNGModules
],
exports: [
...PrimeNGModules,
ButtonModule,
PasswordModule,
MenuModule,
DialogModule,
ProgressSpinnerModule,
HttpClientModule,
FormsModule,
ReactiveFormsModule,
ToastModule,
ConfirmDialogModule,
TableModule,
InputTextModule,
CheckboxModule,
DropdownModule,
TranslateModule,
DynamicDialogModule,
PanelMenuModule,
PanelModule,
AuthRolePipe,
IpAddressPipe,
BoolPipe,
InputNumberModule,
ImageModule,
SidebarModule,
HistoryBtnComponent,
DataViewModule,
DataViewLayoutOptions,
ConfigListComponent,
MultiSelectModule,
HideableColumnComponent,
HideableHeaderComponent,
MultiSelectColumnsComponent,
FeatureFlagListComponent,
InputSwitchModule,
]
})
export class SharedModule {

View File

@@ -204,7 +204,7 @@
<span class="p-column-title">{{'common.level' | translate}}:</span>
<p-cellEditor>
<ng-template pTemplate="input">
<p-dropdown [options]="levels" [(ngModel)]="member.level" dataKey="id" placeholder="{{'common.level' | translate}}"></p-dropdown>
<p-dropdown [options]="levels" [(ngModel)]="member.level" placeholder="{{'common.level' | translate}}"></p-dropdown>
</ng-template>
<ng-template pTemplate="output">
{{member.level.name}}

View File

@@ -30,32 +30,7 @@
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.profile.xp' | translate}}:</div>
<div *ngIf="!isEditing" class="content-data-value">{{user.xp}}</div>
<div *ngIf="isModerator && isEditing" class="content-data-value"><input class="table-edit-input" pInputText min="0" type="number" [(ngModel)]="user.xp"></div>
</div>
</div>
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.profile.message_count' | translate}}:</div>
<div class="content-data-value">{{user.messageCount}}</div>
</div>
</div>
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.profile.reaction_count' | translate}}:</div>
<div class="content-data-value">{{user.reactionCount}}</div>
</div>
</div>
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.profile.birthday' | translate}}:</div>
<div *ngIf="!isEditing" class="content-data-value">{{user.birthday}}</div>
<div *ngIf="isEditing" class="content-data-value">
<p-calendar [(ngModel)]="user.birthday" dateFormat="dd.mm.yy" [showIcon]="true"></p-calendar>
</div>
<div class="content-data-value">{{user.xp}}</div>
</div>
</div>
@@ -66,14 +41,17 @@
</div>
</div>
<!-- <div class="content-row">-->
<!-- <div class="content-column">-->
<!-- <div class="content-data-name">{{'view.server.profile.minecraft_id' | translate}}:</div>-->
<!-- <div class="content-data-value">{{user.minecraftId}}</div>-->
<!-- </div>-->
<!-- </div>-->
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.profile.level' | translate}}:</div>
<div *ngIf="!isEditing" class="content-data-value">{{user.level?.name}}</div>
<div *ngIf="isModerator && isEditing" class="content-data-value">
<p-dropdown [options]="levels" [(ngModel)]="user.level" dataKey="id" placeholder="{{'common.level' | translate}}">
</p-dropdown>
</div>
<div class="content-data-value">{{user.level?.name}}</div>
</div>
</div>
@@ -98,103 +76,9 @@
</div>
</div>
<div>
<div class="content-divider"></div>
<p-table #dt [value]="(user.userWarnings ?? [])" [responsive]="true" responsiveLayout="stack" [breakpoint]="'720px'" dataKey="id" editMode="row">
<ng-template pTemplate="caption">
<div class="table-caption">
<div class="table-caption-table-info">
<div class="table-caption-text">
<h3>{{'common.user_warnings' | translate}}</h3>
</div>
</div>
<div class="table-caption-btn-wrapper btn-wrapper">
<button pButton label="{{'common.add' | translate}}" class="icon-btn btn"
icon="pi pi-plus" (click)="addNewUserWarning(dt)">
</button>
</div>
</div>
</ng-template>
<ng-template pTemplate="header">
<tr>
<th>
<div class="table-header-label">
<div class="table-header-text">{{'common.description' | translate}}</div>
</div>
</th>
<th>
<div class="table-header-label">
<div class="table-header-text">{{'common.author' | translate}}</div>
</div>
</th>
<th>
<div class="table-header-label">
<div class="table-header-text">{{'common.created_at' | translate}}</div>
</div>
</th>
<th class="table-header-actions">
<div class="table-header-label">
<div class="table-header-text">{{'common.actions' | translate}}</div>
</div>
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-value let-editing="editing" let-ri="rowIndex">
<tr [pEditableRow]="value">
<td>
<p-cellEditor>
<ng-template pTemplate="input">
<input class="table-edit-input" pInputText type="text" [(ngModel)]="value.description">
</ng-template>
<ng-template pTemplate="output">
{{value.description}}
</ng-template>
</p-cellEditor>
</td>
<td>
<p-cellEditor>
<ng-template pTemplate="input">
{{value.author?.name}}
</ng-template>
<ng-template pTemplate="output">
{{value.author?.name}}
</ng-template>
</p-cellEditor>
</td>
<td>
<span class="p-column-title">{{'common.created_at' | translate}}:</span>
<p-cellEditor>
<ng-template pTemplate="input">
{{value.createdAt | date:'dd.MM.yy HH:mm'}}
</ng-template>
<ng-template pTemplate="output">
{{value.createdAt | date:'dd.MM.yy HH:mm'}}
</ng-template>
</p-cellEditor>
</td>
<td>
<div class="btn-wrapper">
<button *ngIf="!editing" pButton type="button" class="btn danger-icon-btn" icon="pi pi-trash" (click)="deleteUserWarning(ri)"></button>
<button *ngIf="editing" pButton type="button" pSaveEditableRow class="btn icon-btn" icon="pi pi-check" (click)="editSaveUserWarning(value, ri)"></button>
<button *ngIf="editing" pButton type="button" pCancelEditableRow class="btn danger-icon-btn" icon="pi pi-times"
(click)="editCancelUserWarning(ri)"></button>
</div>
</td>
</tr>
</ng-template>
</p-table>
<br>
</div>
<div class="content-divider"></div>
<p-panel header="{{'view.server.profile.achievements.header' | translate}}" [toggleable]="true" [collapsed]="true"
(onBeforeToggle)="onBeforeToggle($event.event, $event.collapsed)">
<p-panel header="{{'view.server.profile.achievements.header' | translate}}" [toggleable]="true">
<div *ngFor="let achievement of user.achievements;">
<div class="content-row">
<div class="content-column">
@@ -202,11 +86,6 @@
<div class="content-data-value">{{achievement.name}}</div>
</div>
<div class="content-column">
<div class="content-data-name">{{'common.description' | translate}}:</div>
<div class="content-data-value">{{achievement.description}}</div>
</div>
<div class="content-column">
<div class="content-data-name">{{'view.server.profile.achievements.time' | translate}}:</div>
<div class="content-data-value">{{achievement.createdAt | date:'dd.MM.yyyy HH:mm:ss'}}</div>
@@ -215,8 +94,7 @@
</div>
</p-panel>
<p-panel header="{{'view.server.profile.joined_voice_channel.header' | translate}}" [toggleable]="true" [collapsed]="true"
(onBeforeToggle)="onBeforeToggle($event.event, $event.collapsed)">
<p-panel header="{{'view.server.profile.joined_voice_channel.header' | translate}}" [toggleable]="true">
<div *ngFor="let join of user.joinedVoiceChannels;">
<div class="content-row">
<div class="content-column">
@@ -242,8 +120,7 @@
</div>
</p-panel>
<p-panel header="{{'view.server.profile.joined_game_server.header' | translate}}" [toggleable]="true" [collapsed]="true"
(onBeforeToggle)="onBeforeToggle($event.event, $event.collapsed)">
<p-panel header="{{'view.server.profile.joined_game_server.header' | translate}}" [toggleable]="true">
<div *ngFor="let join of user.userJoinedGameServers;">
<div class="content-row">
<div class="content-column">
@@ -284,16 +161,5 @@
</div>
</div>
</p-panel>
<div class="content-divider"></div>
<div class="content-row">
<div style="width: 100%; display: flex; gap: 10px; justify-content: end;">
<button pButton icon="pi pi-edit" label="{{'common.edit' | translate}}" class="btn login-form-submit-btn"
(click)="toogleEditUser()"></button>
<button pButton icon="pi pi-save" label="{{'common.save' | translate}}" class="btn login-form-submit-btn"
(click)="updateUser()" [disabled]="!isEditing"></button>
</div>
</div>
</div>
</div>

View File

@@ -1,7 +1,7 @@
import { Component, OnDestroy, OnInit } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import { Queries } from "../../../../models/graphql/queries.model";
import { LevelListQuery, Query, UserListQuery, UserWarningQuery } from "../../../../models/graphql/query.model";
import { UserListQuery } from "../../../../models/graphql/query.model";
import { SpinnerService } from "../../../../services/spinner/spinner.service";
import { DataService } from "../../../../services/data/data.service";
import { User } from "../../../../models/data/user.model";
@@ -10,14 +10,8 @@ import { AuthService } from "src/app/services/auth/auth.service";
import { ToastService } from "src/app/services/toast/toast.service";
import { TranslateService } from "@ngx-translate/core";
import { Server } from "../../../../models/data/server.model";
import { forkJoin, Subject, throwError } from "rxjs";
import { catchError, takeUntil } from "rxjs/operators";
import { Table } from "primeng/table";
import { UpdateUserMutationResult } from "../../../../models/graphql/result.model";
import { Mutations } from "../../../../models/graphql/mutations.model";
import { MenuItem } from "primeng/api";
import { UserWarning } from "../../../../models/data/user_warning.model";
import moment from "moment";
import { Subject } from "rxjs";
import { takeUntil } from "rxjs/operators";
@Component({
selector: "app-profile",
@@ -27,13 +21,7 @@ import moment from "moment";
export class ProfileComponent implements OnInit, OnDestroy {
user: User = { createdAt: "", modifiedAt: "" };
levels!: MenuItem[];
private server: Server = {};
private author?: UserDTO;
private clonedUserWarnings: UserWarning[] = [];
public isEditingNewUserWarning: boolean = false;
public isEditing: boolean = false;
public isModerator: boolean = false;
private unsubscriber = new Subject<void>();
@@ -44,17 +32,11 @@ export class ProfileComponent implements OnInit, OnDestroy {
private data: DataService,
private auth: AuthService,
private toast: ToastService,
private translate: TranslateService,
private toastService: ToastService
private translate: TranslateService
) {
}
public ngOnInit(): void {
this.isEditing = false;
this.loadProfile();
}
private loadProfile() {
this.route.params.pipe(takeUntil(this.unsubscriber)).subscribe(params => {
this.data.getServerFromRoute(this.route).then(async (server) => {
if (!params["memberId"] || params["memberId"] == "undefined") {
@@ -63,18 +45,6 @@ export class ProfileComponent implements OnInit, OnDestroy {
}
this.server = server;
this.data.query<LevelListQuery>(Queries.levelQuery, {
serverId: server.id
},
(data: Query) => {
return data.servers[0];
}
).subscribe(data => {
this.levels = data.levels.map(level => {
return { label: level.name, value: level };
});
});
let authUser = await this.auth.getLoggedInUser();
this.spinner.showSpinner();
let user: UserDTO | null = authUser?.users?.find(u => u.server == server.id) ?? null;
@@ -84,161 +54,27 @@ export class ProfileComponent implements OnInit, OnDestroy {
await this.router.navigate(["/server", server.id]);
return;
}
this.author = user;
this.isModerator = user?.isModerator;
this.data.query<UserListQuery>(Queries.userProfile, {
serverId: this.server.id,
userId: params["memberId"]
},
(x: { servers: Server[] }) => {
return x.servers[0];
}
).subscribe(users => {
if (!users.users[0]) {
this.router.navigate([`/server/${server.id}`]);
}
this.user = users.users[0];
this.data.query<UserWarningQuery>(Queries.userProfileWarnings, {
serverId: this.server.id,
userId: this.user.id
},
(data: UserListQuery) => {
return data.users[0];
}
).subscribe(result => {
this.user.userWarningCount = result.userWarningCount;
this.user.userWarnings = result.userWarnings;
this.spinner.hideSpinner();
});
});
});
});
}
public toogleEditUser() {
this.isEditing = !this.isEditing;
}
public updateUser() {
this.spinner.showSpinner();
this.data.mutation<UpdateUserMutationResult>(Mutations.updateUser, {
id: this.user.id,
xp: this.user.xp,
birthday: moment(this.user.birthday).format("DD.MM.YYYY"),
levelId: this.user.level?.id,
userWarnings: this.user.userWarnings?.map(userWarning => {
return {
id: userWarning.id,
user: userWarning.user?.id ?? this.user.id,
description: userWarning.description,
author: userWarning.author?.id ?? this.author?.id
};
})
}
).pipe(catchError(err => {
this.spinner.hideSpinner();
this.isEditing = false;
return throwError(err);
})).subscribe(_ => {
this.spinner.hideSpinner();
this.toastService.success(this.translate.instant("view.server.members.message.user_changed"), this.translate.instant("view.server.members.message.user_changed_d", { name: this.user.name }));
this.isEditing = false;
this.loadProfile();
});
}
public ngOnDestroy(): void {
this.unsubscriber.next();
this.unsubscriber.complete();
}
public onBeforeToggle(event: Event, collapsed: boolean) {
const filterUser = (x: { users: User[] }) => {
const users = x.users ?? [];
return users[0];
};
if (collapsed) {
this.spinner.showSpinner();
forkJoin([
this.data.query<User>(Queries.userProfileAchievements, {
serverId: this.server.id,
userId: this.user.id
},
filterUser
),
this.data.query<User>(Queries.userProfileVoiceChannelJoins, {
serverId: this.server.id,
userId: this.user.id
},
filterUser
),
this.data.query<User>(Queries.userProfileGameserverJoins, {
serverId: this.server.id,
userId: this.user.id
},
filterUser
)
]).subscribe(data => {
this.user.achievementCount = data[0].achievementCount;
this.user.achievements = data[0].achievements;
this.user.joinedVoiceChannelCount = data[1].joinedVoiceChannelCount;
this.user.joinedVoiceChannels = data[1].joinedVoiceChannels;
this.user.userJoinedGameServerCount = data[2].userJoinedGameServerCount;
this.user.userJoinedGameServers = data[2].userJoinedGameServers;
this.spinner.hideSpinner();
});
return;
}
this.user.achievementCount = 0;
this.user.achievements = [];
this.user.userJoinedGameServerCount = 0;
this.user.userJoinedGameServers = [];
this.user.joinedVoiceChannelCount = 0;
this.user.joinedVoiceChannels = [];
}
public addNewUserWarning(table: Table) {
const newWarning: UserWarning = {
description: "",
user: this.user
};
this.user.userWarnings = [newWarning, ...this.user.userWarnings ?? []];
table.initRowEdit(newWarning);
const index = this.user.userWarnings.findIndex(l => l.id == newWarning.id);
this.onRowEditInit(table, newWarning, index);
this.isEditingNewUserWarning = true;
}
public onRowEditInit(table: Table, user: User, index: number): void {
this.clonedUserWarnings[index] = { ...user };
}
public deleteUserWarning(index: number) {
this.user.userWarnings?.splice(index, 1);
}
public editSaveUserWarning(value: any, index: number) {
this.isEditingNewUserWarning = false;
if (!value.value || !this.user.userWarnings || this.user.userWarnings[index] == this.clonedUserWarnings[index]) {
return;
}
delete this.clonedUserWarnings[index];
}
public editCancelUserWarning(index: number) {
if (this.user.userWarnings) {
this.user.userWarnings[index] = this.clonedUserWarnings[index];
}
delete this.clonedUserWarnings[index];
}
}

View File

@@ -1,11 +1,12 @@
import { NgModule } from "@angular/core";
import { CommonModule } from "@angular/common";
import { ServerDashboardComponent } from "./server-dashboard/server-dashboard.component";
import { ServerRoutingModule } from "./server-routing.module";
import { SharedModule } from "../../shared/shared.module";
import { ProfileComponent } from "./profile/profile.component";
import { MembersComponent } from "./members/members.component";
import { ClientComponent } from "./server-dashboard/components/client/client.component";
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ServerDashboardComponent } from './server-dashboard/server-dashboard.component';
import { ServerRoutingModule } from './server-routing.module';
import { SharedModule } from '../../shared/shared.module';
import { ProfileComponent } from './profile/profile.component';
import { MembersComponent } from './members/members.component';
import { ClientComponent } from './server-dashboard/components/client/client.component';
@NgModule({

View File

@@ -194,6 +194,7 @@ export class SidebarService {
let user: UserDTO | null = authUser?.users?.find(u => u.server == this.server?.id) ?? null;
let isTechnician = (authUser?.users?.map(u => u.isTechnician).filter(u => u) ?? []).length > 0;
let isTechnicianAndFullAccessActive = this.hasFeature("TechnicianFullAccess") && isTechnician;
console.log(this.hasFeature("TechnicianFullAccess"))
if (build || this.menuItems$.value.length == 0) {
await this.buildMenu(user, hasPermission, isTechnician);

View File

@@ -122,9 +122,6 @@
}
},
"common": {
"edit": "Bearbeiten",
"user_warnings": "Verwarnungen",
"author": "Autor",
"404": "404 - Der Eintrag konnte nicht gefunden werden",
"actions": "Aktionen",
"active": "Aktiv",
@@ -485,9 +482,6 @@
}
},
"profile": {
"message_count": "Anzahl Nachrichten",
"reaction_count": "Anzahl Reaktionen",
"birthday": "Geburtstag",
"achievements": {
"header": "Errungeschaften",
"time": "Erreicht am"

View File

@@ -1,7 +1,7 @@
{
"WebVersion": {
"Major": "1",
"Minor": "2",
"Micro": "0"
"Minor": "1",
"Micro": "10"
}
}

View File

@@ -201,10 +201,10 @@ header {
font-size: 18px;
}
}
.content-divider {
margin: 10px 0;
margin: 5px 0;
}
}
p-panel {
@@ -493,7 +493,7 @@ header {
}
.content-divider {
margin: 10px 0;
margin: 5px 0;
}
.content-input-field {

View File

@@ -94,14 +94,9 @@ p-table {
}
}
.content-row {
p-dropdown,
.p-dropdown,
p-calendar,
.p-calendar, {
.p-dropdown {
width: 100% !important;
}
}
.pi-sort-alt:before {
content: "\e915" !important;

View File

@@ -20,8 +20,7 @@
background-color: $primaryBackgroundColor;
h1,
h2,
h3 {
h2 {
color: $primaryHeaderColor;
}

View File

@@ -20,8 +20,7 @@
background-color: $primaryBackgroundColor;
h1,
h2,
h3 {
h2 {
color: $primaryHeaderColor;
}

View File

@@ -21,8 +21,7 @@
h1,
h2,
h3 {
h2 {
color: $primaryHeaderColor;
}
@@ -683,77 +682,4 @@
p-inputNumber {
background-color: $primaryBackgroundColor !important;
}
p-calendar > span > button {
background-color: $primaryHeaderColor !important;
border: 1px solid $primaryHeaderColor !important;
&:focus {
box-shadow: none !important;
}
}
.p-calendar {
.p-datepicker:not(.p-datepicker-inline) {
background-color: $secondaryBackgroundColor !important;
}
.p-datepicker {
.p-datepicker-header {
color: $primaryHeaderColor !important;
background-color: $primaryBackgroundColor !important;
.p-datepicker-title .p-datepicker-year,
.p-datepicker-title .p-datepicker-month,
.p-datepicker .p-datepicker-header .p-datepicker-title .p-datepicker-month {
color: $primaryTextColor !important;
&:hover {
color: $primaryHeaderColor !important;
}
&:focus {
box-shadow: none !important;
}
}
}
}
table td > span {
color: $primaryTextColor !important;
&:hover {
color: $primaryHeaderColor !important;
background-color: $primaryBackgroundColor !important;
}
&:focus {
box-shadow: none !important;
}
}
table td.p-datepicker-today > span {
color: $primaryHeaderColor !important;
background-color: $primaryBackgroundColor !important;
}
table td > span.p-highlight {
color: $primaryHeaderColor !important;
background-color: $primaryBackgroundColor !important;
}
.p-yearpicker .p-yearpicker-year,
.p-monthpicker .p-monthpicker-month:not(.p-disabled):not(.p-highlight) {
color: $primaryTextColor !important;
background-color: $secondaryBackgroundColor !important;
&:hover {
color: $primaryHeaderColor !important;
}
&:focus {
box-shadow: none !important;
}
}
}
}

View File

@@ -20,8 +20,7 @@
background-color: $primaryBackgroundColor;
h1,
h2,
h3 {
h2 {
color: $primaryHeaderColor;
}