add user posts view
This commit is contained in:
@@ -50,6 +50,10 @@ class Users(Model):
|
||||
WHERE users.id = ?"""
|
||||
return db.fetch_one(q, self.id)
|
||||
|
||||
def get_posts(self, per_page: int, page: int) -> list:
|
||||
q = f'{Posts.FULL_POSTS_QUERY} WHERE posts.user_id = ? ORDER BY posts.created_at DESC LIMIT ? OFFSET ?'
|
||||
return db.query(q, self.id, per_page, (page - 1) * per_page)
|
||||
|
||||
def get_all_subscriptions(self):
|
||||
q = """
|
||||
SELECT threads.title AS thread_title, threads.slug AS thread_slug
|
||||
|
||||
Reference in New Issue
Block a user