Home
/
river.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2110217
)
fix: display feed if no unreaditems
author
xangelo
<me@xangelo.ca>
Mon, 12 Feb 2024 20:31:41 +0000
(15:31 -0500)
committer
xangelo
<me@xangelo.ca>
Mon, 12 Feb 2024 20:31:41 +0000
(15:31 -0500)
src/server.ts
patch
|
blob
|
history
diff --git
a/src/server.ts
b/src/server.ts
index 7ed5556be5f906362630ecbfb2729b8ca9fa277a..58e726c4ca8690585ad89e8981555fba235e5ec6 100644
(file)
--- a/
src/server.ts
+++ b/
src/server.ts
@@
-206,10
+206,11
@@
app.post('/feeds', async (req, res) => {
app.get('/feeds', async (req, res) => {
const feedList: FeedSchemaWithUnread[] = await db.raw(`
-select f.*, count(fe.id) as unread
+select
+ f.*,
+ count(fe.feed_id) - sum(fe.is_read) as unread
from feeds f
-join feed_entry fe on fe.feed_id = f.id
-where fe.is_read is false
+join feed_entry fe on fe.feed_id = f.id
group by fe.feed_id
`);