Merge branch 'develop'
All checks were successful
Build & Deploy Placement Service / build (push) Successful in 1m3s

This commit is contained in:
harid 2025-11-21 10:41:00 +07:00
commit 17259598c9
12 changed files with 21362 additions and 22 deletions

View file

@ -1,4 +1,5 @@
using BMA.EHR.Insignia.Service.Configuration;
using BMA.EHR.Application.Repositories;
using BMA.EHR.Insignia.Service.Configuration;
using SocketIOClient;
using System.Security.Claims;
@ -9,16 +10,17 @@ public class InsigniaRequestProcessService : BackgroundService
{
private readonly IBackgroundTaskQueue _queue;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IServiceScopeFactory _serviceScopeFactory;
public InsigniaRequestProcessService(
IBackgroundTaskQueue queue,
IHttpContextAccessor httpContextAccessor)
IHttpContextAccessor httpContextAccessor,
IServiceScopeFactory serviceScopeFactory)
{
_queue = queue;
_httpContextAccessor = httpContextAccessor;
_serviceScopeFactory = serviceScopeFactory;
}
#region " Properties "
@ -93,6 +95,14 @@ public class InsigniaRequestProcessService : BackgroundService
var endTime = DateTime.Now;
var duration = endTime - startTime;
// Resolve repository from a scope because DbContext is scoped/transient.
using var scope = _serviceScopeFactory.CreateScope();
var userProfileRepository = (UserProfileRepository)scope.ServiceProvider.GetService(typeof(UserProfileRepository));
if (userProfileRepository != null)
{
await userProfileRepository.PostInsigniaMessageToSocket("Task completed", UserId ?? "", AccessToken);
}
}
}
catch (OperationCanceledException)