mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-14 18:11:23 +01:00
Fixed up database modules in webapp
This commit is contained in:
parent
91384cd166
commit
c76e0a4993
@ -4,10 +4,10 @@ import time
|
|||||||
|
|
||||||
class AuthenticatedUsers(db.Model):
|
class AuthenticatedUsers(db.Model):
|
||||||
__tablename__ = "authenticated_users"
|
__tablename__ = "authenticated_users"
|
||||||
id = db.Column(db.Integer, primary_key=True) # Auto increment id
|
id = db.Column(db.Integer, primary_key=True) # Auto increment id
|
||||||
guild_id = db.Column(db.String(255)) # Guild pretaining to the authenticated user
|
guild_id = db.Column(db.String(255), nullable=False) # Guild pretaining to the authenticated user
|
||||||
client_id = db.Column(db.String(255)) # Client ID of the authenticated user
|
client_id = db.Column(db.String(255), nullable=False) # Client ID of the authenticated user
|
||||||
last_timestamp = db.Column(db.TIMESTAMP) # The timestamp of when the user has last sent the heartbeat
|
last_timestamp = db.Column(db.TIMESTAMP, nullable=False) # The timestamp of when the user has last sent the heartbeat
|
||||||
|
|
||||||
def __init__(self, guild_id, client_id):
|
def __init__(self, guild_id, client_id):
|
||||||
self.guild_id = guild_id
|
self.guild_id = guild_id
|
||||||
|
@ -2,6 +2,6 @@ from titanembeds.database import db
|
|||||||
|
|
||||||
class Cosmetics(db.Model):
|
class Cosmetics(db.Model):
|
||||||
__tablename__ = "cosmetics"
|
__tablename__ = "cosmetics"
|
||||||
id = db.Column(db.Integer, primary_key=True) # Auto increment id
|
id = db.Column(db.Integer, primary_key=True) # Auto increment id
|
||||||
user_id = db.Column(db.String(255)) # Discord user id of user of cosmetics
|
user_id = db.Column(db.String(255), nullable=False) # Discord user id of user of cosmetics
|
||||||
css = db.Column(db.Boolean()) # If they can create/edit custom CSS
|
css = db.Column(db.Boolean(), nullable=False) # If they can create/edit custom CSS
|
@ -3,16 +3,16 @@ import json
|
|||||||
|
|
||||||
class GuildMembers(db.Model):
|
class GuildMembers(db.Model):
|
||||||
__tablename__ = "guild_members"
|
__tablename__ = "guild_members"
|
||||||
id = db.Column(db.Integer, primary_key=True) # Auto incremented id
|
id = db.Column(db.Integer, primary_key=True) # Auto incremented id
|
||||||
guild_id = db.Column(db.String(255)) # Discord guild id
|
guild_id = db.Column(db.String(255), nullable=False) # Discord guild id
|
||||||
user_id = db.Column(db.String(255)) # Discord user id
|
user_id = db.Column(db.String(255), nullable=False) # Discord user id
|
||||||
username = db.Column(db.String(255)) # Name
|
username = db.Column(db.String(255), nullable=False) # Name
|
||||||
discriminator = db.Column(db.Integer) # User discriminator
|
discriminator = db.Column(db.Integer, nullable=False) # User discriminator
|
||||||
nickname = db.Column(db.String(255)) # User nickname
|
nickname = db.Column(db.String(255)) # User nickname
|
||||||
avatar = db.Column(db.String(255)) # The avatar str of the user
|
avatar = db.Column(db.String(255)) # The avatar str of the user
|
||||||
active = db.Column(db.Boolean()) # If the user is a member of the guild
|
active = db.Column(db.Boolean(), nullable=False) # If the user is a member of the guild
|
||||||
banned = db.Column(db.Boolean()) # If the user is banned in the guild
|
banned = db.Column(db.Boolean(), nullable=False) # If the user is banned in the guild
|
||||||
roles = db.Column(db.Text()) # Member roles
|
roles = db.Column(db.Text(), nullable=False) # Member roles
|
||||||
|
|
||||||
def __init__(self, guild_id, user_id, username, discriminator, nickname, avatar, active, banned, roles):
|
def __init__(self, guild_id, user_id, username, discriminator, nickname, avatar, active, banned, roles):
|
||||||
self.guild_id = guild_id
|
self.guild_id = guild_id
|
||||||
|
@ -2,18 +2,18 @@ from titanembeds.database import db
|
|||||||
|
|
||||||
class Guilds(db.Model):
|
class Guilds(db.Model):
|
||||||
__tablename__ = "guilds"
|
__tablename__ = "guilds"
|
||||||
id = db.Column(db.Integer, primary_key=True) # Auto incremented id
|
id = db.Column(db.Integer, primary_key=True) # Auto incremented id
|
||||||
guild_id = db.Column(db.String(255)) # Discord guild id
|
guild_id = db.Column(db.String(255), nullable=False) # Discord guild id
|
||||||
name = db.Column(db.String(255)) # Name
|
name = db.Column(db.String(255), nullable=False) # Name
|
||||||
unauth_users = db.Column(db.Boolean()) # If allowed unauth users
|
unauth_users = db.Column(db.Boolean(), nullable=False, default=1) # If allowed unauth users
|
||||||
chat_links = db.Column(db.Boolean()) # If users can post links
|
chat_links = db.Column(db.Boolean(), nullable=False, default=1) # If users can post links
|
||||||
bracket_links = db.Column(db.Boolean()) # If appending brackets to links to prevent embed
|
bracket_links = db.Column(db.Boolean(), nullable=False, default=1) # If appending brackets to links to prevent embed
|
||||||
mentions_limit = db.Column(db.Integer) # If there is a limit on the number of mentions in a msg
|
mentions_limit = db.Column(db.Integer, nullable=False, default=11) # If there is a limit on the number of mentions in a msg
|
||||||
roles = db.Column(db.Text()) # Guild Roles
|
roles = db.Column(db.Text(), nullable=False) # Guild Roles
|
||||||
channels = db.Column(db.Text()) # Guild channels
|
channels = db.Column(db.Text(), nullable=False) # Guild channels
|
||||||
emojis = db.Column(db.Text()) # Guild Emojis
|
emojis = db.Column(db.Text(), nullable=False) # Guild Emojis
|
||||||
owner_id = db.Column(db.String(255)) # Snowflake of the owner
|
owner_id = db.Column(db.String(255), nullable=False) # Snowflake of the owner
|
||||||
icon = db.Column(db.String(255)) # The icon string, null if none
|
icon = db.Column(db.String(255)) # The icon string, null if none
|
||||||
|
|
||||||
def __init__(self, guild_id, name, roles, channels, emojis, owner_id, icon):
|
def __init__(self, guild_id, name, roles, channels, emojis, owner_id, icon):
|
||||||
self.guild_id = guild_id
|
self.guild_id = guild_id
|
||||||
|
@ -52,10 +52,10 @@ def delete_keyvalproperty(key):
|
|||||||
|
|
||||||
class KeyValueProperties(db.Model):
|
class KeyValueProperties(db.Model):
|
||||||
__tablename__ = "keyvalue_properties"
|
__tablename__ = "keyvalue_properties"
|
||||||
id = db.Column(db.Integer, primary_key=True) # Auto incremented id
|
id = db.Column(db.Integer, primary_key=True) # Auto incremented id
|
||||||
key = db.Column(db.String(255)) # Property Key
|
key = db.Column(db.String(255), nullable=False) # Property Key
|
||||||
value = db.Column(db.Text()) # Property value
|
value = db.Column(db.Text()) # Property value
|
||||||
expiration = db.Column(db.TIMESTAMP) # Suggested Expiration for value (None = no expire) in secs
|
expiration = db.Column(db.TIMESTAMP) # Suggested Expiration for value (None = no expire) in secs
|
||||||
|
|
||||||
def __init__(self, key, value, expiration=None):
|
def __init__(self, key, value, expiration=None):
|
||||||
self.key = key
|
self.key = key
|
||||||
|
@ -4,16 +4,16 @@ import json
|
|||||||
|
|
||||||
class Messages(db.Model):
|
class Messages(db.Model):
|
||||||
__tablename__ = "messages"
|
__tablename__ = "messages"
|
||||||
id = db.Column(db.Integer, primary_key=True) # Auto incremented id
|
id = db.Column(db.Integer, primary_key=True) # Auto incremented id
|
||||||
guild_id = db.Column(db.String(255)) # Discord guild id
|
guild_id = db.Column(db.String(255), nullable=False) # Discord guild id
|
||||||
channel_id = db.Column(db.String(255)) # Channel id
|
channel_id = db.Column(db.String(255), nullable=False) # Channel id
|
||||||
message_id = db.Column(db.String(255)) # Message snowflake
|
message_id = db.Column(db.String(255), nullable=False) # Message snowflake
|
||||||
content = db.Column(db.Text()) # Message contents
|
content = db.Column(db.Text(), nullable=False) # Message contents
|
||||||
author = db.Column(db.Text()) # Author
|
author = db.Column(db.Text(), nullable=False) # Author
|
||||||
timestamp = db.Column(db.TIMESTAMP) # Timestamp of when content is created
|
timestamp = db.Column(db.TIMESTAMP, nullable=False) # Timestamp of when content is created
|
||||||
edited_timestamp = db.Column(db.TIMESTAMP) # Timestamp of when content is edited
|
edited_timestamp = db.Column(db.TIMESTAMP) # Timestamp of when content is edited
|
||||||
mentions = db.Column(db.Text()) # Mentions serialized
|
mentions = db.Column(db.Text()) # Mentions serialized
|
||||||
attachments = db.Column(db.Text()) # serialized attachments
|
attachments = db.Column(db.Text()) # serialized attachments
|
||||||
|
|
||||||
def __init__(self, guild_id, channel_id, message_id, content, author, timestamp, edited_timestamp, mentions, attachments):
|
def __init__(self, guild_id, channel_id, message_id, content, author, timestamp, edited_timestamp, mentions, attachments):
|
||||||
self.guild_id = guild_id
|
self.guild_id = guild_id
|
||||||
|
@ -4,15 +4,15 @@ import time
|
|||||||
|
|
||||||
class UnauthenticatedBans(db.Model):
|
class UnauthenticatedBans(db.Model):
|
||||||
__tablename__ = "unauthenticated_bans"
|
__tablename__ = "unauthenticated_bans"
|
||||||
id = db.Column(db.Integer, primary_key=True) # Auto increment id
|
id = db.Column(db.Integer, primary_key=True) # Auto increment id
|
||||||
guild_id = db.Column(db.String(255)) # Guild pretaining to the unauthenticated user
|
guild_id = db.Column(db.String(255), nullable=False) # Guild pretaining to the unauthenticated user
|
||||||
ip_address = db.Column(db.String(255)) # The IP Address of the user
|
ip_address = db.Column(db.String(255), nullable=False) # The IP Address of the user
|
||||||
last_username = db.Column(db.String(255)) # The username when they got banned
|
last_username = db.Column(db.String(255), nullable=False) # The username when they got banned
|
||||||
last_discriminator = db.Column(db.Integer) # The discrim when they got banned
|
last_discriminator = db.Column(db.Integer, nullable=False) # The discrim when they got banned
|
||||||
timestamp = db.Column(db.TIMESTAMP) # The timestamp of when the user got banned
|
timestamp = db.Column(db.TIMESTAMP, nullable=False) # The timestamp of when the user got banned
|
||||||
reason = db.Column(db.Text()) # The reason of the ban set by the guild moderators
|
reason = db.Column(db.Text()) # The reason of the ban set by the guild moderators
|
||||||
lifter_id = db.Column(db.String(255)) # Discord Client ID of the user who lifted the ban
|
lifter_id = db.Column(db.String(255)) # Discord Client ID of the user who lifted the ban
|
||||||
placer_id = db.Column(db.String(255)) # The id of who placed the ban
|
placer_id = db.Column(db.String(255), nullable=False) # The id of who placed the ban
|
||||||
|
|
||||||
def __init__(self, guild_id, ip_address, last_username, last_discriminator, reason, placer_id):
|
def __init__(self, guild_id, ip_address, last_username, last_discriminator, reason, placer_id):
|
||||||
self.guild_id = guild_id
|
self.guild_id = guild_id
|
||||||
|
@ -6,14 +6,14 @@ import string
|
|||||||
|
|
||||||
class UnauthenticatedUsers(db.Model):
|
class UnauthenticatedUsers(db.Model):
|
||||||
__tablename__ = "unauthenticated_users"
|
__tablename__ = "unauthenticated_users"
|
||||||
id = db.Column(db.Integer, primary_key=True) # Auto increment id
|
id = db.Column(db.Integer, primary_key=True, nullable=False) # Auto increment id
|
||||||
guild_id = db.Column(db.String(255)) # Guild pretaining to the unauthenticated user
|
guild_id = db.Column(db.String(255), nullable=False) # Guild pretaining to the unauthenticated user
|
||||||
username = db.Column(db.String(255)) # The username of the user
|
username = db.Column(db.String(255), nullable=False) # The username of the user
|
||||||
discriminator = db.Column(db.Integer) # The discriminator to distinguish unauth users with each other
|
discriminator = db.Column(db.Integer, nullable=False) # The discriminator to distinguish unauth users with each other
|
||||||
user_key = db.Column(db.Text()) # The secret key used to identify the user holder
|
user_key = db.Column(db.Text(), nullable=False) # The secret key used to identify the user holder
|
||||||
ip_address = db.Column(db.String(255)) # The IP Address of the user
|
ip_address = db.Column(db.String(255), nullable=False) # The IP Address of the user
|
||||||
last_timestamp = db.Column(db.TIMESTAMP) # The timestamp of when the user has last sent the heartbeat
|
last_timestamp = db.Column(db.TIMESTAMP, nullable=False) # The timestamp of when the user has last sent the heartbeat
|
||||||
revoked = db.Column(db.Boolean()) # If the user's key has been revoked and a new one is required to be generated
|
revoked = db.Column(db.Boolean(), nullable=False) # If the user's key has been revoked and a new one is required to be generated
|
||||||
|
|
||||||
def __init__(self, guild_id, username, discriminator, ip_address):
|
def __init__(self, guild_id, username, discriminator, ip_address):
|
||||||
self.guild_id = guild_id
|
self.guild_id = guild_id
|
||||||
|
@ -2,10 +2,10 @@ from titanembeds.database import db
|
|||||||
|
|
||||||
class UserCSS(db.Model):
|
class UserCSS(db.Model):
|
||||||
__tablename__ = "user_css"
|
__tablename__ = "user_css"
|
||||||
id = db.Column(db.Integer, primary_key=True) # Auto increment id
|
id = db.Column(db.Integer, primary_key=True) # Auto increment id
|
||||||
name = db.Column(db.String(255)) # CSS Name
|
name = db.Column(db.String(255), nullable=False) # CSS Name
|
||||||
user_id = db.Column(db.String(255)) # Discord client ID of the owner of the css (can edit)
|
user_id = db.Column(db.String(255), nullable=False) # Discord client ID of the owner of the css (can edit)
|
||||||
css = db.Column(db.Text()) # CSS contents
|
css = db.Column(db.Text()) # CSS contents
|
||||||
|
|
||||||
def __init__(self, name, user_id, css=None):
|
def __init__(self, name, user_id, css=None):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
Loading…
Reference in New Issue
Block a user