www.example.com/*
Forwarding URL (Status Code: 302 - Temporary Redirect, Url: https://example.com/$)
{
id: 1,
type: "like",
userId: 1,
isRead: false,
data: {
postId: 357,
likedUserId: 49
}
}
SELECT du.*, (
SELECT COUNT(dm."receiverRead") "unreadMessages"
FROM dialogs_messages dm
WHERE
dm."dialogId" = du."dialogId"
AND dm."receiverRead" = false
AND dm."senderUserId" NOT IN ('69e56a68-edbd-4f8b-8ccd-cb8031c5c865')
AND dm.id NOT IN (
SELECT dmd."messageId" FROM dialogs_messages_deleted dmd
WHERE dmd."userId" = '69e56a68-edbd-4f8b-8ccd-cb8031c5c865'
)
GROUP BY dm."receiverRead"
) FROM (
SELECT
DISTINCT ON (du."dialogId") du."dialogId",
SUBSTRING(dm."message", 1, 60),
du."joinedDateTime",
users."avatarUrl",
users.username
FROM dialogs_users du
LEFT JOIN dialogs_messages dm ON dm."dialogId" = du."dialogId"
LEFT JOIN users on users.id = dm."senderUserId"
WHERE
du."userId" = '69e56a68-edbd-4f8b-8ccd-cb8031c5c865'
AND dm.id NOT IN (
SELECT dmd."messageId" FROM dialogs_messages_deleted dmd
WHERE dmd."userId" = '69e56a68-edbd-4f8b-8ccd-cb8031c5c865'
)
ORDER BY du."dialogId", dm."message" DESC
) du
ORDER BY du."joinedDateTime" DESC;