diff options
author | Freya Murphy <freya@freyacat.org> | 2024-04-05 10:46:09 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-04-05 10:46:09 -0400 |
commit | 530bbf058781e00e588f1457b6ee589a64b74da1 (patch) | |
tree | c6cdd382a86d55538686293e51a1fc056cb59029 /src/db/rest/post | |
parent | remove var (diff) | |
download | xssbook2-530bbf058781e00e588f1457b6ee589a64b74da1.tar.gz xssbook2-530bbf058781e00e588f1457b6ee589a64b74da1.tar.bz2 xssbook2-530bbf058781e00e588f1457b6ee589a64b74da1.zip |
i did thing oh god large commit
Diffstat (limited to 'src/db/rest/post')
-rw-r--r-- | src/db/rest/post/api_post.sql | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/db/rest/post/api_post.sql b/src/db/rest/post/api_post.sql index 0d60473..b5c42a8 100644 --- a/src/db/rest/post/api_post.sql +++ b/src/db/rest/post/api_post.sql @@ -6,7 +6,9 @@ CREATE VIEW api.post AS p.created, p.modified, COALESCE(c.cc, 0) - AS comment_count + AS comment_count, + COALESCE(l.lc, 0) + AS like_count FROM admin.post p LEFT JOIN ( @@ -20,6 +22,17 @@ CREATE VIEW api.post AS ) c ON p.id = c.post_id + LEFT JOIN ( + SELECT + COUNT(l.id) as lc, + l.post_id + FROM + admin.like l + GROUP BY + l.post_id + ) l + ON + p.id = l.post_id LEFT JOIN admin.user u ON |