refactor person owner reader ...
This commit is contained in:
@@ -15,14 +15,17 @@ namespace xAiModels.Providers.Enrichers
|
||||
{
|
||||
public class XAiMessageEnricher : IXAiMessageEnricher
|
||||
{
|
||||
private readonly IXPersonService personService;
|
||||
private readonly IXIdentityProvider identityProvider;
|
||||
private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider;
|
||||
|
||||
public XAiMessageEnricher(
|
||||
IXPersonService personService,
|
||||
IXIdentityProvider identityProvider,
|
||||
IXAiConversationTitleResourceProvider conversationTitleResourceProvider
|
||||
)
|
||||
{
|
||||
this.personService = personService;
|
||||
this.identityProvider = identityProvider;
|
||||
this.conversationTitleResourceProvider = conversationTitleResourceProvider;
|
||||
}
|
||||
@@ -68,14 +71,7 @@ namespace xAiModels.Providers.Enrichers
|
||||
XPersonDto owner = null;
|
||||
if (!source.OwnerId.IsNullOrEmpty())
|
||||
{
|
||||
//
|
||||
// Try to Retrieve User Info ...
|
||||
var device = identityProvider.GetDevice();
|
||||
var userInfo = await identityProvider.GetUserInfo(
|
||||
device: device,
|
||||
userSelectByParam: source.OwnerId
|
||||
);
|
||||
owner = userInfo.ToXPersonDto();
|
||||
owner = await personService.GetPerson(source.OwnerId);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -8,7 +8,6 @@ using System.Threading.Tasks;
|
||||
using xAiModels.Models.Entities;
|
||||
using System.Collections.Generic;
|
||||
using xIdentityService.Interfaces;
|
||||
using xIdentityService.Extensions;
|
||||
using xAiModels.Interfaces.Entities;
|
||||
using xAiModels.Interfaces.Enrichers;
|
||||
|
||||
@@ -16,6 +15,7 @@ namespace xAiModels.Providers.Enrichers
|
||||
{
|
||||
public class XAiProjectEnricher : IXAiProjectEnricher
|
||||
{
|
||||
private readonly IXPersonService personService;
|
||||
private readonly IXIdentityProvider identityProvider;
|
||||
private readonly IXAiMessageRepository messageRepository;
|
||||
private readonly IXAiConversationRepository conversationRepository;
|
||||
@@ -24,6 +24,7 @@ namespace xAiModels.Providers.Enrichers
|
||||
private readonly IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider;
|
||||
|
||||
public XAiProjectEnricher(
|
||||
IXPersonService personService,
|
||||
IXIdentityProvider identityProvider,
|
||||
IXAiMessageRepository messageRepository,
|
||||
IXAiConversationRepository conversationRepository,
|
||||
@@ -33,6 +34,7 @@ namespace xAiModels.Providers.Enrichers
|
||||
)
|
||||
{
|
||||
//
|
||||
this.personService = personService;
|
||||
this.identityProvider = identityProvider;
|
||||
this.messageRepository = messageRepository;
|
||||
this.conversationRepository = conversationRepository;
|
||||
@@ -92,14 +94,7 @@ namespace xAiModels.Providers.Enrichers
|
||||
XPersonDto owner = null;
|
||||
if (!source.OwnerId.IsNullOrEmpty())
|
||||
{
|
||||
//
|
||||
// Try to Retrieve User Info ...
|
||||
var device = identityProvider.GetDevice();
|
||||
var userInfo = await identityProvider.GetUserInfo(
|
||||
device: device,
|
||||
userSelectByParam: source.OwnerId
|
||||
);
|
||||
owner = userInfo.ToXPersonDto();
|
||||
owner = await personService.GetPerson(source.OwnerId);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user