🐛 Optimize chat summary
This commit is contained in:
@@ -319,6 +319,7 @@ public partial class ChatService(
|
|||||||
public async Task<Dictionary<Guid, int>> CountUnreadMessageForUser(Guid userId)
|
public async Task<Dictionary<Guid, int>> CountUnreadMessageForUser(Guid userId)
|
||||||
{
|
{
|
||||||
var members = await db.ChatMembers
|
var members = await db.ChatMembers
|
||||||
|
.Where(m => m.LeaveAt == null && m.JoinedAt != null)
|
||||||
.Where(m => m.AccountId == userId)
|
.Where(m => m.AccountId == userId)
|
||||||
.Select(m => new { m.ChatRoomId, m.LastReadAt })
|
.Select(m => new { m.ChatRoomId, m.LastReadAt })
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
@@ -338,6 +339,7 @@ public partial class ChatService(
|
|||||||
public async Task<Dictionary<Guid, Message?>> ListLastMessageForUser(Guid userId)
|
public async Task<Dictionary<Guid, Message?>> ListLastMessageForUser(Guid userId)
|
||||||
{
|
{
|
||||||
var userRooms = await db.ChatMembers
|
var userRooms = await db.ChatMembers
|
||||||
|
.Where(m => m.LeaveAt == null && m.JoinedAt != null)
|
||||||
.Where(m => m.AccountId == userId)
|
.Where(m => m.AccountId == userId)
|
||||||
.Select(m => m.ChatRoomId)
|
.Select(m => m.ChatRoomId)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
Reference in New Issue
Block a user