mirror of
https://github.com/yanislav-igonin/micrach
synced 2024-12-22 22:32:33 +03:00
fix: deleted posts not returned
This commit is contained in:
parent
d099f76d25
commit
6bff9179f2
@ -17,7 +17,7 @@ func (r *PostsRepository) Get(limit, offset int) ([]Post, error) {
|
|||||||
FROM posts
|
FROM posts
|
||||||
WHERE
|
WHERE
|
||||||
is_parent = true
|
is_parent = true
|
||||||
AND is_deleted = false
|
AND is_deleted != true
|
||||||
ORDER BY updated_at DESC
|
ORDER BY updated_at DESC
|
||||||
OFFSET $1
|
OFFSET $1
|
||||||
LIMIT $2
|
LIMIT $2
|
||||||
@ -65,7 +65,7 @@ func (r *PostsRepository) GetCount() (int, error) {
|
|||||||
FROM posts
|
FROM posts
|
||||||
WHERE
|
WHERE
|
||||||
is_parent = true
|
is_parent = true
|
||||||
AND is_deleted = false
|
AND is_deleted != true
|
||||||
`
|
`
|
||||||
|
|
||||||
row := Db.Pool.QueryRow(context.TODO(), sql)
|
row := Db.Pool.QueryRow(context.TODO(), sql)
|
||||||
@ -116,7 +116,7 @@ func (r *PostsRepository) GetThreadByPostID(ID int) ([]Post, error) {
|
|||||||
FROM posts
|
FROM posts
|
||||||
WHERE
|
WHERE
|
||||||
(id = $1 AND is_parent = true) OR parent_id = $1
|
(id = $1 AND is_parent = true) OR parent_id = $1
|
||||||
AND is_deleted = false
|
AND is_deleted != true
|
||||||
ORDER BY created_at ASC
|
ORDER BY created_at ASC
|
||||||
`
|
`
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user