Compare commits
5
Commits
0d06d98060
...
490c30e88c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
490c30e88c | ||
|
|
35670358c4 | ||
|
|
7a59f3b453 | ||
|
|
e01ab64411 | ||
|
|
df482d80f0 |
@@ -1,6 +1,6 @@
|
||||
"""File holds all model definitions of SQL tables."""
|
||||
|
||||
from sqlalchemy.dialects.mysql import BIGINT, INTEGER, VARCHAR
|
||||
from sqlalchemy.dialects.mysql import BIGINT, BOOLEAN, INTEGER, VARCHAR
|
||||
from sqlmodel import Column, Field, ForeignKey, Relationship, SQLModel
|
||||
|
||||
|
||||
@@ -70,9 +70,9 @@ class CouncilMember(SQLModel, table=True):
|
||||
)
|
||||
member_id: int = Field(sa_column=Column("MemberId", BIGINT(unsigned=True), primary_key=True, nullable=False))
|
||||
speech_msg_id: int = Field(sa_column=Column("SpeechMsgId", BIGINT(unsigned=True), nullable=False))
|
||||
elected: bool = Field(sa_column=Column("Elected"), default=False)
|
||||
discord_manager: bool = Field(sa_column=Column("DiscordManager"), default=False)
|
||||
clan_leader: bool = Field(sa_column=Column("ClanLeader"), default=False)
|
||||
elected: bool = Field(sa_column=Column("Elected", BOOLEAN), default=False)
|
||||
discord_manager: bool = Field(sa_column=Column("DiscordManager", BOOLEAN), default=False)
|
||||
clan_leader: bool = Field(sa_column=Column("ClanLeader", BOOLEAN), default=False)
|
||||
discord_manager_speech_id: int = Field(
|
||||
sa_column=Column("DiscordManagerSpeechId", BIGINT(unsigned=True), nullable=True)
|
||||
)
|
||||
@@ -146,3 +146,65 @@ class Presence(SQLModel, table=True):
|
||||
|
||||
id: int | None = Field(sa_column=Column("Id", INTEGER, primary_key=True), default=None)
|
||||
presence: str = Field(sa_column=Column("Presence", VARCHAR, nullable=False), max_length=100)
|
||||
|
||||
|
||||
class Points(SQLModel, table=True):
|
||||
"""
|
||||
Stores activity points a user can gain by participating in clan activities.
|
||||
|
||||
Event points and clan points were separated out.
|
||||
|
||||
Attributes:
|
||||
quarter_name: Name of the quarter the points were earned in.
|
||||
user_id: The user that earned them. Is a discord id if the user is a discord member, otherwise their rsn.
|
||||
discord_member: Boolean on whether the user is a discord member or not. Used to know what the user_id
|
||||
represents.
|
||||
event_points: Event points earned during the quarter.
|
||||
clan_points: Clan points earned during the quarter.
|
||||
"""
|
||||
|
||||
quarter_name: str = Field(sa_column=Column("QuarterName", VARCHAR, primary_key=True, nullable=False), max_length=30)
|
||||
user_id: str = Field(sa_column=Column("UserId", VARCHAR, primary_key=True, nullable=False), max_length=32)
|
||||
discord_member: bool = Field(sa_column=Column("DiscordMember", BOOLEAN, nullable=False))
|
||||
event_points: int = Field(sa_column=Column("EventPoints", INTEGER(unsigned=True), nullable=False), default=0)
|
||||
clan_points: int = Field(sa_column=Column("ClanPoints", INTEGER(unsigned=True), nullable=False), default=0)
|
||||
|
||||
|
||||
class Message(SQLModel, table=True):
|
||||
"""
|
||||
Table is used to map folders and files to channels and messages in discord.
|
||||
|
||||
If folder name is stored in path, the corresponding id is a channel id. If the path is to a file, the id is for a
|
||||
message.
|
||||
|
||||
Attributes:
|
||||
path: Either directory or file pathname.
|
||||
id: Channel or message id depending on the path.
|
||||
"""
|
||||
|
||||
__tablename__: str = "Messages"
|
||||
|
||||
path: str = Field(sa_column=Column("Path", primary_key=True, nullable=False), max_length=100)
|
||||
id: int = Field(sa_column=Column("Id", BIGINT(unsigned=True), nullable=False))
|
||||
|
||||
|
||||
class PointsLimit(SQLModel, table=True):
|
||||
"""
|
||||
Table tracks how many points a user has gained in a week.
|
||||
|
||||
Council didn't want users spamming points, so they added a limit to how many can be gained in a week. This table
|
||||
tracks point gain per week.
|
||||
|
||||
Attributes:
|
||||
user_id: The user that earned points. Is a discord id if the user is a discord member, otherwise their rsn.
|
||||
week: week number/year representation of the week. Ex: 04/2025.
|
||||
event_points: Number of event points earned during this week.
|
||||
clan_points: Number of clan points earned during this week.
|
||||
"""
|
||||
|
||||
user_id: str = Field(sa_column=Column("UserId", VARCHAR, primary_key=True, nullable=False), max_length=32)
|
||||
|
||||
# Maybe should break this out into two columns, week and year. Better data validation and more clear.
|
||||
week: str = Field(sa_column=Column("Week", VARCHAR, primary_key=True, nullable=False), max_length=7)
|
||||
event_points: int = Field(sa_column=Column("EventPoints", INTEGER(unsigned=True), nullable=False), default=0)
|
||||
clan_points: int = Field(sa_column=Column("ClanPoints", INTEGER(unsigned=True), nullable=False), default=0)
|
||||
|
||||
Reference in New Issue
Block a user