1 parent
f7fc937d26
commit
f481a97a8c
13 files changed
+547
-60
No files matched your search
@@ -124,11 +124,12 @@ User.getCounts = (userId) => {
|
||||
`SELECT
|
||||
SUM(pinned = 1 && archived = 0 && share_user_id IS NULL) AS pinnedNotes,
|
||||
SUM(archived = 1 && share_user_id IS NULL) AS archivedNotes,
|
||||
SUM(encrypted = 1) AS encryptedNotes,
|
||||
SUM(share_user_id IS NULL) AS totalNotes,
|
||||
SUM(share_user_id != ?) AS sharedToNotes,
|
||||
SUM( (share_user_id != ? && opened IS null) || (share_user_id != ? && note_raw_text.updated > opened) ) AS unreadNotes
|
||||
FROM note
|
||||
JOIN note_raw_text ON (note_raw_text.id = note.note_raw_text_id)
|
||||
LEFT JOIN note_raw_text ON (note_raw_text.id = note.note_raw_text_id)
|
||||
WHERE user_id = ?`, [userId, userId, userId, userId])
|
||||
.then( (rows, fields) => {
|
||||
|
||||
|
||||
Reference in new issue
Block a user