fix: get thread by id for deleted

This commit is contained in:
Yanislav Igonin 2021-10-22 15:36:50 +03:00
parent 6bff9179f2
commit 3a8077f85d

View File

@ -115,8 +115,8 @@ func (r *PostsRepository) GetThreadByPostID(ID int) ([]Post, error) {
is_parent is_parent
FROM posts FROM posts
WHERE WHERE
(id = $1 AND is_parent = true) OR parent_id = $1 (id = $1 AND is_parent = true AND is_deleted != true)
AND is_deleted != true OR (parent_id = $1 AND is_deleted != true)
ORDER BY created_at ASC ORDER BY created_at ASC
` `