fix: deleted posts not returned

This commit is contained in:
Yanislav Igonin 2021-10-22 15:27:08 +03:00
parent d099f76d25
commit 6bff9179f2

View File

@ -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
` `