I’m trying to add a count field to a result set which is counting all my unread messages
this is my query at the moment.
from c in Comment,
join: uc in UsersComments,
where: uc.comment_id == c.id,
where: uc.user_id == ^user.id,
where: is_nil(c.thread_id)
select: c
I would like to add a unread_count: field to the result, to fetch my main thread messages and unread sub messages count in one go.
unread_count: -> select where c.thread_id == c.id and is_nil(c.read_at)