Add package collections

Fixes #378
This commit is contained in:
rubenwardy
2023-08-14 21:48:50 +01:00
parent bf20177756
commit f7a5a1218f
17 changed files with 702 additions and 10 deletions

View File

@@ -90,6 +90,8 @@ class Permission(enum.Enum):
CHANGE_PROFILE_URLS = "CHANGE_PROFILE_URLS"
CHANGE_DISPLAY_NAME = "CHANGE_DISPLAY_NAME"
VIEW_AUDIT_DESCRIPTION = "VIEW_AUDIT_DESCRIPTION"
EDIT_COLLECTION = "EDIT_COLLECTION"
VIEW_COLLECTION = "VIEW_COLLECTION"
# Only return true if the permission is valid for *all* contexts
# See Package.check_perm for package-specific contexts
@@ -183,6 +185,7 @@ class User(db.Model, UserMixin):
threads = db.relationship("Thread", back_populates="author", lazy="dynamic", cascade="all, delete, delete-orphan")
replies = db.relationship("ThreadReply", back_populates="author", lazy="dynamic", cascade="all, delete, delete-orphan", order_by=db.desc("created_at"))
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"))
ban = db.relationship("UserBan", foreign_keys="UserBan.user_id", back_populates="user", uselist=False)