...
This commit is contained in:
@@ -411,10 +411,9 @@ namespace Hushian.Application.Services
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public async Task<ResponseBase<ChatItemDto>> GetLastOpenChatInCompany(int CompanyID, int UserID)
|
||||
public async Task<ChatItemDto?> GetLastOpenChatInCompany(int CompanyID, int UserID)
|
||||
{
|
||||
ResponseBase<ChatItemDto> Response = new();
|
||||
Response.Value = await _ConversationRepository.Get()
|
||||
return await _ConversationRepository.Get()
|
||||
.Include(inc => inc.Group)
|
||||
.Include(inc => inc.ConversationResponses).ThenInclude(tinc => tinc.Exper)
|
||||
.Where(w => w.UserID == UserID && w.CompanyID == CompanyID && w.Status != ConversationStatus.Finished)
|
||||
@@ -449,13 +448,11 @@ namespace Hushian.Application.Services
|
||||
|
||||
}).FirstOrDefaultAsync();
|
||||
|
||||
if (Response.Value != null) Response.Success = true;
|
||||
return Response;
|
||||
|
||||
}
|
||||
public async Task<ResponseBase<ChatItemDto>> GetChat(int ChatID, int UserID)
|
||||
public async Task<ChatItemDto?> GetChat(int ChatID, int UserID)
|
||||
{
|
||||
ResponseBase<ChatItemDto> Response = new();
|
||||
Response.Value = await _ConversationRepository.Get()
|
||||
return await _ConversationRepository.Get()
|
||||
.Include(inc => inc.Group)
|
||||
.Include(inc => inc.ConversationResponses).ThenInclude(tinc => tinc.Exper)
|
||||
.Where(w => w.UserID == UserID && w.ID == ChatID)
|
||||
@@ -490,8 +487,7 @@ namespace Hushian.Application.Services
|
||||
|
||||
}).FirstOrDefaultAsync();
|
||||
|
||||
if (Response.Value != null) Response.Success = true;
|
||||
return Response;
|
||||
|
||||
}
|
||||
public async Task WriteInHubFromCompany(ChatItemResponseDto item, string ToUser)
|
||||
{
|
||||
@@ -524,5 +520,22 @@ namespace Hushian.Application.Services
|
||||
.SendAsync("NewChat", CompanyID);
|
||||
}
|
||||
|
||||
public async Task<(int, int)?> GetLastChat(int UserID)
|
||||
{
|
||||
int companyid = 0;
|
||||
var request = _ConversationRepository.Get()
|
||||
.Include(inc => inc.Group)
|
||||
.Include(inc => inc.ConversationResponses).ThenInclude(tinc => tinc.Exper)
|
||||
.Where(w => w.UserID == UserID)
|
||||
.OrderByDescending(o => o.ID);
|
||||
var item1=await request.Select(s => s.ID).FirstOrDefaultAsync();
|
||||
if (item1 == null) return null;
|
||||
else
|
||||
{
|
||||
companyid = await request.Select(s => s.CompanyID).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
return (item1,companyid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user