mirror of
https://github.com/Llloooggg/TextSouls.git
synced 2026-03-06 04:26:23 +03:00
not working mess
This commit is contained in:
@@ -21,6 +21,65 @@ class User(db.Model, SerializerMixin):
|
||||
)
|
||||
is_admin = db.Column(db.Boolean, nullable=False, default=False)
|
||||
characters = db.relationship("Character", backref="user", lazy="dynamic")
|
||||
destinations = db.relationship(
|
||||
"SendlistDestination", backref="sendlist", lazy="dynamic"
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.id}: {self.username}"
|
||||
|
||||
|
||||
class Sendlist(db.Model, SerializerMixin):
|
||||
|
||||
__tablename__ = "sendlists"
|
||||
|
||||
serialize_rules = ("-destination",)
|
||||
|
||||
id = db.Column(db.BigInteger, primary_key=True)
|
||||
message = db.Column(db.String(255), nullable=True)
|
||||
destinations = db.relationship(
|
||||
"SendlistDestination", backref="sendlist", lazy="dynamic"
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.message[:12]}..."
|
||||
|
||||
|
||||
class SendlistDestinationStatus(db.Model, SerializerMixin):
|
||||
|
||||
__tablename__ = "sendlists_destionations_statuses"
|
||||
|
||||
serialize_rules = ("-destination",)
|
||||
|
||||
id = db.Column(db.BigInteger, primary_key=True)
|
||||
name = db.Column(db.String(255), nullable=False)
|
||||
destinations = db.relationship(
|
||||
"SendlistDestination",
|
||||
backref="status",
|
||||
lazy="dynamic",
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class SendlistDestination(db.Model, SerializerMixin):
|
||||
|
||||
__tablename__ = "sendlists_destionations"
|
||||
|
||||
id = db.Column(db.BigInteger, primary_key=True)
|
||||
sendlist_id = db.Column(
|
||||
db.Integer,
|
||||
db.ForeignKey("sendlists.id", ondelete="CASCADE"),
|
||||
)
|
||||
user_id = db.Column(
|
||||
db.BigInteger,
|
||||
db.ForeignKey("users.id", ondelete="CASCADE"),
|
||||
)
|
||||
status_id = db.Column(
|
||||
db.Integer,
|
||||
db.ForeignKey("sendlists_destionations_types.id", ondelete="CASCADE"),
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.message[:12]}..."
|
||||
|
||||
Reference in New Issue
Block a user