...
This commit is contained in:
@@ -237,7 +237,7 @@ namespace Hushian.Application.Services
|
||||
var convModel = await _ConversationRepository.Get()
|
||||
.Include(inc => inc.ConversationResponses)
|
||||
.FirstOrDefaultAsync(w => w.ID == dto.ConversationID);
|
||||
|
||||
|
||||
if (convModel != null)
|
||||
{
|
||||
if (ExperID.HasValue && !await _experService.CheckExperInCompany(convModel.CompanyID, ExperID.Value))
|
||||
@@ -276,6 +276,9 @@ namespace Hushian.Application.Services
|
||||
convModel.Status = ConversationStatus.InProgress;
|
||||
await _ConversationRepository.UPDATE(convModel);
|
||||
}
|
||||
if (dto.Type != ConversationType.UE)
|
||||
await WriteInHubFromCompany(Response.Value, convModel.UserID);
|
||||
|
||||
}
|
||||
else Response.Errors.Add("گفتگویی یافت نشد");
|
||||
}
|
||||
@@ -448,5 +451,33 @@ namespace Hushian.Application.Services
|
||||
if (Response.Value != null) Response.Success = true;
|
||||
return Response;
|
||||
}
|
||||
public async Task WriteInHubFromCompany(ChatItemResponseDto item,int UserID)
|
||||
{
|
||||
await _hubContext.Clients.User(UserID.ToString())
|
||||
.SendAsync("ReceiveNewChatItemFromCompany", item);
|
||||
|
||||
//// فرض: لیستی از کاربرانی که به گفتگو دسترسی دارند
|
||||
//var usernames = new List<string>();
|
||||
|
||||
//foreach (var usn in usernames)
|
||||
//{
|
||||
// //await _hubContext.Clients.User(usn)
|
||||
// // .SendAsync("ReceiveNewConversation", conv.Id, conv.Title);
|
||||
//}
|
||||
}
|
||||
public async Task WriteInHubFromUser(ChatItemResponseDto item)
|
||||
{
|
||||
await _hubContext.Clients.User(UserID.ToString())
|
||||
.SendAsync("ReceiveNewChatItemFromCompany", item);
|
||||
|
||||
//// فرض: لیستی از کاربرانی که به گفتگو دسترسی دارند
|
||||
//var usernames = new List<string>();
|
||||
|
||||
//foreach (var usn in usernames)
|
||||
//{
|
||||
// //await _hubContext.Clients.User(usn)
|
||||
// // .SendAsync("ReceiveNewConversation", conv.Id, conv.Title);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ namespace Hushian.Application.Services
|
||||
{
|
||||
var claims = new[]
|
||||
{
|
||||
new Claim(JwtRegisteredClaimNames.Sub,UserName),
|
||||
new Claim(JwtRegisteredClaimNames.Sub,userId.ToString()),
|
||||
new Claim(ClaimTypes.NameIdentifier, UserName),
|
||||
new Claim(CustomClaimTypes.Uid,userId.ToString()),
|
||||
new Claim(ClaimTypes.Role, Role)
|
||||
|
Reference in New Issue
Block a user