add bookmark collection editor

This commit is contained in:
2026-06-02 08:12:26 +03:00
parent 5676ced836
commit edfa2e232f
9 changed files with 163 additions and 24 deletions

View File

@@ -511,6 +511,12 @@ class BookmarkCollections(Model):
"""
res = db.fetch_one(q, user_id)
@classmethod
def get_for_user(cls, user_id):
q = """SELECT * FROM bookmark_collections WHERE user_id = ? ORDER BY sort_order ASC"""
res = db.query(q, user_id)
return [cls.from_data(row) for row in res]
def has_posts(self):
q = 'SELECT EXISTS(SELECT 1 FROM bookmarked_posts WHERE collection_id = ?) as e'
res = db.fetch_one(q, self.id)['e']