Add reports to database
This commit is contained in:
@@ -130,6 +130,24 @@ class AuditLogEntry(db.Model):
|
||||
raise Exception("Permission {} is not related to audit log entries".format(perm.name))
|
||||
|
||||
|
||||
class Report(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
|
||||
created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)
|
||||
|
||||
user_id = db.Column(db.Integer, db.ForeignKey("user.id"), nullable=True)
|
||||
user = db.relationship("User", foreign_keys=[user_id], back_populates="reports")
|
||||
|
||||
thread_id = db.Column(db.Integer, db.ForeignKey("thread.id"), nullable=True)
|
||||
thread = db.relationship("Thread", foreign_keys=[thread_id])
|
||||
|
||||
url = db.Column(db.String, nullable=True)
|
||||
title = db.Column(db.Unicode(300), nullable=False)
|
||||
message = db.Column(db.UnicodeText, nullable=False)
|
||||
|
||||
is_resolved = db.Column(db.Boolean, nullable=False, default=False)
|
||||
|
||||
|
||||
REPO_BLACKLIST = [".zip", "mediafire.com", "dropbox.com", "weebly.com",
|
||||
"minetest.net", "luanti.org", "dropboxusercontent.com", "4shared.com",
|
||||
"digitalaudioconcepts.com", "hg.intevation.org", "www.wtfpl.net",
|
||||
|
||||
@@ -210,6 +210,7 @@ class User(db.Model, UserMixin):
|
||||
forum_topics = db.relationship("ForumTopic", back_populates="author", lazy="dynamic", cascade="all, delete, delete-orphan")
|
||||
collections = db.relationship("Collection", back_populates="author", lazy="dynamic", cascade="all, delete, delete-orphan", order_by=db.asc("title"))
|
||||
clients = db.relationship("OAuthClient", back_populates="owner", lazy="dynamic", cascade="all, delete, delete-orphan")
|
||||
reports = db.relationship("Report", back_populates="user", lazy="dynamic", cascade="all")
|
||||
|
||||
ban = db.relationship("UserBan", foreign_keys="UserBan.user_id", back_populates="user", uselist=False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user