Compare commits
No commits in common. "2763f254af5c17d32ba80eba59066e5599e7d111" and "0f26db3d745f94e1c5d636424a557cbf6243188a" have entirely different histories.
2763f254af
...
0f26db3d74
@ -69,11 +69,11 @@ class ApiKey(TableABC):
|
|||||||
return str(
|
return str(
|
||||||
f"""
|
f"""
|
||||||
INSERT INTO `ApiKeys` (
|
INSERT INTO `ApiKeys` (
|
||||||
`Identifier`, `Key`, {"" if self._creator is None else "`CreatorId`,"} `CreatedAt`, `LastModifiedAt`
|
`Identifier`, `Key`, `CreatorId`, `CreatedAt`, `LastModifiedAt`
|
||||||
) VALUES (
|
) VALUES (
|
||||||
'{self._identifier}',
|
'{self._identifier}',
|
||||||
'{self._key}',
|
'{self._key}',
|
||||||
{"" if self._creator is None else f"{self._creator.id},"}
|
{"NULL" if self._creator is None else self._creator.id},
|
||||||
'{self._created_at}',
|
'{self._created_at}',
|
||||||
'{self._modified_at}'
|
'{self._modified_at}'
|
||||||
);
|
);
|
||||||
@ -87,7 +87,6 @@ class ApiKey(TableABC):
|
|||||||
UPDATE `ApiKeys`
|
UPDATE `ApiKeys`
|
||||||
SET `Identifier` = '{self._identifier}',
|
SET `Identifier` = '{self._identifier}',
|
||||||
`Key` = '{self._key}',
|
`Key` = '{self._key}',
|
||||||
{"" if self._creator is None else f"`CreatorId` = {self._creator.id},"}
|
|
||||||
`LastModifiedAt` = '{self._modified_at}'
|
`LastModifiedAt` = '{self._modified_at}'
|
||||||
WHERE `Id` = {self._id};
|
WHERE `Id` = {self._id};
|
||||||
"""
|
"""
|
||||||
|
@ -215,30 +215,30 @@ class AuthUser(TableABC):
|
|||||||
`EMail`,
|
`EMail`,
|
||||||
`Password`,
|
`Password`,
|
||||||
`PasswordSalt`,
|
`PasswordSalt`,
|
||||||
{"" if self._refresh_token is None else f"`RefreshToken`,"}
|
`RefreshToken`,
|
||||||
{"" if self._confirmation_id is None else f"`ConfirmationId`,"}
|
`ConfirmationId`,
|
||||||
{"" if self._forgot_password_id is None else f"`ForgotPasswordId`,"}
|
`ForgotPasswordId`,
|
||||||
{"" if self._oauth_id is None else f"`OAuthId`,"}
|
`OAuthId`,
|
||||||
`RefreshTokenExpiryTime`,
|
`RefreshTokenExpiryTime`,
|
||||||
`AuthRole`,
|
`AuthRole`,
|
||||||
`CreatedAt`,
|
`CreatedAt`,
|
||||||
`LastModifiedAt`
|
`LastModifiedAt`
|
||||||
) VALUES (
|
) VALUES (
|
||||||
{self._auth_user_id},
|
{self._auth_user_id},
|
||||||
'{self._first_name}',
|
'{self._first_name}',
|
||||||
'{self._last_name}',
|
'{self._last_name}',
|
||||||
'{self._email}',
|
'{self._email}',
|
||||||
'{self._password}',
|
'{self._password}',
|
||||||
'{self._password_salt}',
|
'{self._password_salt}',
|
||||||
{"" if self._refresh_token is None else f"'{self._refresh_token}',"}
|
'{"NULL" if self._refresh_token is None else self._refresh_token}',
|
||||||
{"" if self._confirmation_id is None else f"'{self._confirmation_id}',"}
|
'{"NULL" if self._confirmation_id is None else self._confirmation_id}',
|
||||||
{"" if self._forgot_password_id is None else f"'{self._forgot_password_id}',"}
|
'{"NULL" if self._forgot_password_id is None else self._forgot_password_id}',
|
||||||
{"" if self._oauth_id is None else f"'{self._oauth_id}',"}
|
'{"NULL" if self._oauth_id is None else self._oauth_id}',
|
||||||
'{self._refresh_token_expire_time.isoformat()}',
|
'{self._refresh_token_expire_time.isoformat()}',
|
||||||
{self._auth_role_id.value},
|
{self._auth_role_id.value},
|
||||||
'{self._created_at}',
|
'{self._created_at}',
|
||||||
'{self._modified_at}'
|
'{self._modified_at}'
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -252,10 +252,10 @@ class AuthUser(TableABC):
|
|||||||
`EMail` = '{self._email}',
|
`EMail` = '{self._email}',
|
||||||
`Password` = '{self._password}',
|
`Password` = '{self._password}',
|
||||||
`PasswordSalt` = '{self._password_salt}',
|
`PasswordSalt` = '{self._password_salt}',
|
||||||
{'' if self._refresh_token is None else f"`RefreshToken` = '{self._refresh_token}',"}
|
`RefreshToken` = '{'null' if self._refresh_token is None else f'{self._refresh_token}'}',
|
||||||
{'' if self._confirmation_id is None else f"'`ConfirmationId` = '{self._confirmation_id}',"}
|
`ConfirmationId` = '{'null' if self._confirmation_id is None else f'{self._confirmation_id}'}',
|
||||||
{'' if self._forgot_password_id is None else f"`ForgotPasswordId` = '{self._forgot_password_id}',"}
|
`ForgotPasswordId` = '{'null' if self._forgot_password_id is None else f'{self._forgot_password_id}'}',
|
||||||
{'' if self._oauth_id is None else f"`OAuthId` = '{self._oauth_id}',"}
|
`OAuthId` = '{'null' if self._oauth_id is None else f'{self._oauth_id}'}',
|
||||||
`RefreshTokenExpiryTime` = '{self._refresh_token_expire_time.isoformat()}',
|
`RefreshTokenExpiryTime` = '{self._refresh_token_expire_time.isoformat()}',
|
||||||
`AuthRole` = {self._auth_role_id.value},
|
`AuthRole` = {self._auth_role_id.value},
|
||||||
`LastModifiedAt` = '{self._modified_at}'
|
`LastModifiedAt` = '{self._modified_at}'
|
||||||
|
@ -150,11 +150,11 @@ class User(TableABC):
|
|||||||
return str(
|
return str(
|
||||||
f"""
|
f"""
|
||||||
INSERT INTO `Users` (
|
INSERT INTO `Users` (
|
||||||
`DiscordId`, `XP`, {"" if self._minecraft_id is None else "`MinecraftId`,"} `ServerId`, `CreatedAt`, `LastModifiedAt`
|
`DiscordId`, `XP`, `MinecraftId`, `ServerId`, `CreatedAt`, `LastModifiedAt`
|
||||||
) VALUES (
|
) VALUES (
|
||||||
{self._discord_id},
|
{self._discord_id},
|
||||||
{self._xp},
|
{self._xp},
|
||||||
{"" if self._minecraft_id is None else f"'{self._minecraft_id}',"}
|
'{self._minecraft_id}',
|
||||||
{self._server.id},
|
{self._server.id},
|
||||||
'{self._created_at}',
|
'{self._created_at}',
|
||||||
'{self._modified_at}'
|
'{self._modified_at}'
|
||||||
@ -168,7 +168,7 @@ class User(TableABC):
|
|||||||
f"""
|
f"""
|
||||||
UPDATE `Users`
|
UPDATE `Users`
|
||||||
SET `XP` = {self._xp},
|
SET `XP` = {self._xp},
|
||||||
{"" if self._minecraft_id is None else f"`MinecraftId` = '{self._minecraft_id}',"}
|
`MinecraftId` = {'null' if self.minecraft_id is None else f'{self._minecraft_id}'},
|
||||||
`LastModifiedAt` = '{self._modified_at}'
|
`LastModifiedAt` = '{self._modified_at}'
|
||||||
WHERE `UserId` = {self._user_id};
|
WHERE `UserId` = {self._user_id};
|
||||||
"""
|
"""
|
||||||
|
@ -98,28 +98,42 @@ class UserJoinedGameServer(TableABC):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def insert_string(self) -> str:
|
def insert_string(self) -> str:
|
||||||
return str(
|
if self._leaved_on is not None:
|
||||||
f"""
|
return str(
|
||||||
INSERT INTO `UserJoinedGameServer` (
|
f"""
|
||||||
`UserId`, `GameServer`, `JoinedOn`, {"" if self._leaved_on is None else "`LeavedOn`,"} `CreatedAt`, `LastModifiedAt`
|
INSERT INTO `UserJoinedGameServer` (
|
||||||
) VALUES (
|
`UserId`, `GameServer`, `JoinedOn`, `LeavedOn`, `CreatedAt`, `LastModifiedAt`
|
||||||
{self._user.id},
|
) VALUES (
|
||||||
'{self._game_server}',
|
{self._user.id},
|
||||||
'{self._joined_on}',
|
'{self._game_server}',
|
||||||
{"" if self._leaved_on is None else f"'{self._leaved_on}',"}
|
'{self._joined_on}',
|
||||||
'{self._created_at}',
|
'{self._leaved_on}',
|
||||||
'{self._modified_at}'
|
'{self._created_at}',
|
||||||
);
|
'{self._modified_at}'
|
||||||
"""
|
);
|
||||||
)
|
"""
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return str(
|
||||||
|
f"""
|
||||||
|
INSERT INTO `UserJoinedGameServer` (
|
||||||
|
`UserId`, `GameServer`, `JoinedOn`, `CreatedAt`, `LastModifiedAt`
|
||||||
|
) VALUES (
|
||||||
|
{self._user.id},
|
||||||
|
'{self._game_server}',
|
||||||
|
'{self._joined_on}',
|
||||||
|
'{self._created_at}',
|
||||||
|
'{self._modified_at}'
|
||||||
|
);
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def udpate_string(self) -> str:
|
def udpate_string(self) -> str:
|
||||||
return str(
|
return str(
|
||||||
f"""
|
f"""
|
||||||
UPDATE `UserJoinedGameServer`
|
UPDATE `UserJoinedGameServer`
|
||||||
SET
|
SET `LeavedOn` = '{self._leaved_on}',
|
||||||
{"" if self._leaved_on is None else f"`LeavedOn` = '{self._leaved_on}',"}
|
|
||||||
`LastModifiedAt` = '{self._modified_at}'
|
`LastModifiedAt` = '{self._modified_at}'
|
||||||
WHERE `Id` = {self._id};
|
WHERE `Id` = {self._id};
|
||||||
"""
|
"""
|
||||||
|
@ -97,27 +97,40 @@ class UserJoinedServer(TableABC):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def insert_string(self) -> str:
|
def insert_string(self) -> str:
|
||||||
return str(
|
if self._leaved_on is not None:
|
||||||
f"""
|
return str(
|
||||||
INSERT INTO `UserJoinedServers` (
|
f"""
|
||||||
`UserId`, `JoinedOn`, {"" if self._leaved_on is None else "`LeavedOn`,"} `CreatedAt`, `LastModifiedAt`
|
INSERT INTO `UserJoinedServers` (
|
||||||
) VALUES (
|
`UserId`, `JoinedOn`, `LeavedOn`, `CreatedAt`, `LastModifiedAt`
|
||||||
{self._user.id},
|
) VALUES (
|
||||||
'{self._joined_on}',
|
{self._user.id},
|
||||||
{"" if self._leaved_on is None else f"'{self._leaved_on}',"}
|
'{self._joined_on}',
|
||||||
'{self._created_at}',
|
'{self._leaved_on}',
|
||||||
'{self._modified_at}'
|
'{self._created_at}',
|
||||||
);
|
'{self._modified_at}'
|
||||||
"""
|
);
|
||||||
)
|
"""
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return str(
|
||||||
|
f"""
|
||||||
|
INSERT INTO `UserJoinedServers` (
|
||||||
|
`UserId`, `JoinedOn`, `CreatedAt`, `LastModifiedAt`
|
||||||
|
) VALUES (
|
||||||
|
{self._user.id},
|
||||||
|
'{self._joined_on}',
|
||||||
|
'{self._created_at}',
|
||||||
|
'{self._modified_at}'
|
||||||
|
);
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def udpate_string(self) -> str:
|
def udpate_string(self) -> str:
|
||||||
return str(
|
return str(
|
||||||
f"""
|
f"""
|
||||||
UPDATE `UserJoinedServers`
|
UPDATE `UserJoinedServers`
|
||||||
SET
|
SET `LeavedOn` = '{self._leaved_on}',
|
||||||
{"" if self._leaved_on is None else f"`LeavedOn` = '{self._leaved_on}',"}
|
|
||||||
`LastModifiedAt` = '{self._modified_at}'
|
`LastModifiedAt` = '{self._modified_at}'
|
||||||
WHERE `UserId` = {self._user.id};
|
WHERE `UserId` = {self._user.id};
|
||||||
"""
|
"""
|
||||||
|
@ -105,28 +105,42 @@ class UserJoinedVoiceChannel(TableABC):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def insert_string(self) -> str:
|
def insert_string(self) -> str:
|
||||||
return str(
|
if self._leaved_on is not None:
|
||||||
f"""
|
return str(
|
||||||
INSERT INTO `UserJoinedVoiceChannel` (
|
f"""
|
||||||
`UserId`, `DiscordChannelId`, `JoinedOn`, {"" if self._leaved_on is None else "`LeavedOn`,"} `CreatedAt`, `LastModifiedAt`
|
INSERT INTO `UserJoinedVoiceChannel` (
|
||||||
) VALUES (
|
`UserId`, `DiscordChannelId`, `JoinedOn`, `LeavedOn`, `CreatedAt`, `LastModifiedAt`
|
||||||
{self._user.id},
|
) VALUES (
|
||||||
{self._channel_id},
|
{self._user.id},
|
||||||
'{self._joined_on}',
|
{self._channel_id},
|
||||||
{"" if self._leaved_on is None else f"'{self._leaved_on}',"}
|
'{self._joined_on}',
|
||||||
'{self._created_at}',
|
'{self._leaved_on}',
|
||||||
'{self._modified_at}'
|
'{self._created_at}',
|
||||||
);
|
'{self._modified_at}'
|
||||||
"""
|
);
|
||||||
)
|
"""
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return str(
|
||||||
|
f"""
|
||||||
|
INSERT INTO `UserJoinedVoiceChannel` (
|
||||||
|
`UserId`, `DiscordChannelId`, `JoinedOn`, `CreatedAt`, `LastModifiedAt`
|
||||||
|
) VALUES (
|
||||||
|
{self._user.id},
|
||||||
|
{self._channel_id},
|
||||||
|
'{self._joined_on}',
|
||||||
|
'{self._created_at}',
|
||||||
|
'{self._modified_at}'
|
||||||
|
);
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def udpate_string(self) -> str:
|
def udpate_string(self) -> str:
|
||||||
return str(
|
return str(
|
||||||
f"""
|
f"""
|
||||||
UPDATE `UserJoinedVoiceChannel`
|
UPDATE `UserJoinedVoiceChannel`
|
||||||
SET
|
SET `LeavedOn` = '{self._leaved_on}',
|
||||||
{"" if self._leaved_on is None else f"`LeavedOn` = '{self._leaved_on}',"}
|
|
||||||
`LastModifiedAt` = '{self._modified_at}'
|
`LastModifiedAt` = '{self._modified_at}'
|
||||||
WHERE `JoinId` = {self._join_id};
|
WHERE `JoinId` = {self._join_id};
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user