diff options
Diffstat (limited to 'src/db/rest/comment/api_comment.sql')
-rw-r--r-- | src/db/rest/comment/api_comment.sql | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/db/rest/comment/api_comment.sql b/src/db/rest/comment/api_comment.sql new file mode 100644 index 0000000..c8a0e19 --- /dev/null +++ b/src/db/rest/comment/api_comment.sql @@ -0,0 +1,29 @@ +CREATE VIEW api.comment AS + SELECT + c.id, + c.user_id, + c.post_id, + c.content, + c.created, + c.modified + FROM + admin.comment c + LEFT JOIN + admin.post p + ON + p.id = c.post_id + LEFT JOIN + admin.user u + ON + u.id = c.user_id + WHERE + c.deleted <> TRUE AND + p.deleted <> TRUE AND + u.deleted <> TRUE + ORDER BY + id ASC; + +GRANT SELECT ON TABLE api.comment + TO rest_anon, rest_user; +GRANT SELECT ON TABLE admin.comment + TO rest_anon, rest_user; |