A-0.3 - Basismodul #36
@ -63,25 +63,6 @@ class Client(TableABC):
|
||||
def server(self) -> Server:
|
||||
return self._server
|
||||
|
||||
@staticmethod
|
||||
def get_create_string() -> str:
|
||||
return str(f"""
|
||||
CREATE TABLE IF NOT EXISTS `Clients` (
|
||||
`ClientId` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`DiscordClientId` BIGINT NOT NULL,
|
||||
`SentMessageCount` BIGINT NOT NULL DEFAULT 0,
|
||||
`ReceivedMessageCount` BIGINT NOT NULL DEFAULT 0,
|
||||
`DeletedMessageCount` BIGINT NOT NULL DEFAULT 0,
|
||||
`ReceivedCommandsCount` BIGINT NOT NULL DEFAULT 0,
|
||||
`MovedUsersCount` BIGINT NOT NULL DEFAULT 0,
|
||||
`ServerId` BIGINT,
|
||||
`CreatedAt` DATETIME(6),
|
||||
`LastModifiedAt` DATETIME(6),
|
||||
FOREIGN KEY (`ServerId`) REFERENCES Servers(`ServerId`),
|
||||
PRIMARY KEY(`ClientId`)
|
||||
);
|
||||
""")
|
||||
|
||||
@staticmethod
|
||||
def get_select_all_string() -> str:
|
||||
return str(f"""
|
||||
|
@ -23,18 +23,6 @@ class KnownUser(TableABC):
|
||||
def discord_id(self) -> int:
|
||||
return self._discord_id
|
||||
|
||||
@staticmethod
|
||||
def get_create_string() -> str:
|
||||
return str(f"""
|
||||
CREATE TABLE IF NOT EXISTS `KnownUsers` (
|
||||
`KnownUserId` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`DiscordId` BIGINT NOT NULL,
|
||||
`CreatedAt` DATETIME(6),
|
||||
`LastModifiedAt` DATETIME(6),
|
||||
PRIMARY KEY(`KnownUserId`)
|
||||
);
|
||||
""")
|
||||
|
||||
@staticmethod
|
||||
def get_select_all_string() -> str:
|
||||
return str(f"""
|
||||
|
@ -21,18 +21,6 @@ class Server(TableABC):
|
||||
@property
|
||||
def discord_server_id(self) -> int:
|
||||
return self._discord_server_id
|
||||
|
||||
@staticmethod
|
||||
def get_create_string() -> str:
|
||||
return str(f"""
|
||||
CREATE TABLE IF NOT EXISTS `Servers` (
|
||||
`ServerId` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`DiscordServerId` BIGINT NOT NULL,
|
||||
`CreatedAt` DATETIME(6),
|
||||
`LastModifiedAt` DATETIME(6),
|
||||
PRIMARY KEY(`ServerId`)
|
||||
);
|
||||
""")
|
||||
|
||||
@staticmethod
|
||||
def get_select_all_string() -> str:
|
||||
|
@ -38,21 +38,6 @@ class User(TableABC):
|
||||
def server(self) -> Optional[Server]:
|
||||
return self._server
|
||||
|
||||
@staticmethod
|
||||
def get_create_string() -> str:
|
||||
return str(f"""
|
||||
CREATE TABLE IF NOT EXISTS `Users` (
|
||||
`UserId` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`DiscordId` BIGINT NOT NULL,
|
||||
`XP` BIGINT NOT NULL DEFAULT 0,
|
||||
`ServerId` BIGINT,
|
||||
`CreatedAt` DATETIME(6),
|
||||
`LastModifiedAt` DATETIME(6),
|
||||
FOREIGN KEY (`ServerId`) REFERENCES Servers(`ServerId`),
|
||||
PRIMARY KEY(`UserId`)
|
||||
);
|
||||
""")
|
||||
|
||||
@staticmethod
|
||||
def get_select_all_string() -> str:
|
||||
return str(f"""
|
||||
|
@ -34,21 +34,6 @@ class UserJoinedServer(TableABC):
|
||||
@property
|
||||
def leaved_on(self) -> datetime:
|
||||
return self._leaved_on
|
||||
|
||||
@staticmethod
|
||||
def get_create_string() -> str:
|
||||
return str(f"""
|
||||
CREATE TABLE IF NOT EXISTS `UserJoinedServers` (
|
||||
`JoinId` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`UserId` BIGINT NOT NULL,
|
||||
`JoinedOn` DATETIME(6) NOT NULL,
|
||||
`LeavedOn` DATETIME(6),
|
||||
`CreatedAt` DATETIME(6),
|
||||
`LastModifiedAt` DATETIME(6),
|
||||
FOREIGN KEY (`UserId`) REFERENCES Users(`UserId`),
|
||||
PRIMARY KEY(`JoinId`)
|
||||
);
|
||||
""")
|
||||
|
||||
@staticmethod
|
||||
def get_select_all_string() -> str:
|
||||
|
@ -65,8 +65,6 @@ class KnownUserRepositoryService(KnownUserRepositoryABC):
|
||||
result[1],
|
||||
result[2],
|
||||
result[3],
|
||||
result[4],
|
||||
self._servers.get_server_by_id(result[3]),
|
||||
id=result[0]
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user