add bookmark collection editor
This commit is contained in:
@@ -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']
|
||||
|
||||
Reference in New Issue
Block a user