diff options
Diffstat (limited to '')
-rw-r--r-- | src/db/rest/post/api_post.sql (renamed from db/rest/post/api_post.sql) | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/db/rest/post/api_post.sql b/src/db/rest/post/api_post.sql index 375f292..0d60473 100644 --- a/db/rest/post/api_post.sql +++ b/src/db/rest/post/api_post.sql @@ -3,7 +3,8 @@ CREATE VIEW api.post AS p.id, p.user_id, p.content, - p.date, + p.created, + p.modified, COALESCE(c.cc, 0) AS comment_count FROM @@ -16,8 +17,19 @@ CREATE VIEW api.post AS admin.comment c GROUP BY c.post_id - ) c ON p.id = c.post_id - ORDER BY p.id DESC; + ) c + ON + p.id = c.post_id + LEFT JOIN + admin.user u + ON + u.id = p.user_id + WHERE + p.deleted <> TRUE + AND + u.deleted <> TRUE + ORDER BY + p.id DESC; GRANT SELECT ON TABLE api.post TO rest_anon, rest_user; |