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