diff --git a/Configurations/Entities/XAiConversationMappingAction.cs b/Configurations/Entities/XAiConversationMappingAction.cs index a59bf0b..61a9243 100644 --- a/Configurations/Entities/XAiConversationMappingAction.cs +++ b/Configurations/Entities/XAiConversationMappingAction.cs @@ -1,10 +1,9 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using AutoMapper; +using xAiModels.Interfaces; using xAiModels.Models.Dtos; using xAiModels.Models.Entities; +using xIdentityService.Extensions; using xIdentityService.Interfaces; namespace xAiModels.Configurations.Entities @@ -12,14 +11,23 @@ namespace xAiModels.Configurations.Entities public class XAiConversationMappingAction : IMappingAction { private readonly IXIdentityProvider identityProvider; + private readonly IXAiProjectTitleResourceProvider projectTitleResourceProvider; + private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider; + private readonly IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider; public XAiConversationMappingAction( - IXIdentityProvider identityProvider + IXIdentityProvider identityProvider, + IXAiProjectTitleResourceProvider projectTitleResourceProvider, + IXAiConversationTitleResourceProvider conversationTitleResourceProvider, + IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider ) { this.identityProvider = identityProvider; + this.projectTitleResourceProvider = projectTitleResourceProvider; + this.conversationTitleResourceProvider = conversationTitleResourceProvider; + this.projectDescriptionResourceProvider = projectDescriptionResourceProvider; } - + public void Process( XAiConversation source, XAiConversationDto destination, @@ -28,6 +36,19 @@ namespace xAiModels.Configurations.Entities { // // Retrieve Owner ... + var device = identityProvider.GetDevice(); + var ownerUserInfo = identityProvider.GetUserInfo( + device: device, + userSelectByParam: source.OwnerId + ) + .GetAwaiter() + .GetResult(); + var owner = ownerUserInfo.ToXPersonDto(); + + // + // Setting Owner ... + destination.Owner = owner; + // Retrieve Project Info ... throw new NotImplementedException(); } diff --git a/Configurations/Entities/XAiMessageMappingAction.cs b/Configurations/Entities/XAiMessageMappingAction.cs index 042aa01..e14ff74 100644 --- a/Configurations/Entities/XAiMessageMappingAction.cs +++ b/Configurations/Entities/XAiMessageMappingAction.cs @@ -1,10 +1,8 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using AutoMapper; using xAiModels.Models.Dtos; using xAiModels.Models.Entities; +using xIdentityService.Extensions; using xIdentityService.Interfaces; namespace xAiModels.Configurations.Entities @@ -26,6 +24,21 @@ namespace xAiModels.Configurations.Entities ResolutionContext context ) { + // + // Retrieve Owner ... + var device = identityProvider.GetDevice(); + var ownerUserInfo = identityProvider.GetUserInfo( + device: device, + userSelectByParam: source.OwnerId + ) + .GetAwaiter() + .GetResult(); + var owner = ownerUserInfo.ToXPersonDto(); + + // + // Setting Owner ... + destination.Owner = owner; + // // Retrieve Owner ... // Retrieve Conversation ... diff --git a/Configurations/Entities/XAiProjectMappingAction.cs b/Configurations/Entities/XAiProjectMappingAction.cs index 5eca343..a15af2c 100644 --- a/Configurations/Entities/XAiProjectMappingAction.cs +++ b/Configurations/Entities/XAiProjectMappingAction.cs @@ -1,10 +1,8 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using AutoMapper; using xAiModels.Models.Dtos; using xAiModels.Models.Entities; +using xIdentityService.Extensions; using xIdentityService.Interfaces; namespace xAiModels.Configurations.Entities @@ -26,6 +24,21 @@ namespace xAiModels.Configurations.Entities ResolutionContext context ) { + // + // Retrieve Owner ... + var device = identityProvider.GetDevice(); + var ownerUserInfo = identityProvider.GetUserInfo( + device: device, + userSelectByParam: source.OwnerId + ) + .GetAwaiter() + .GetResult(); + var owner = ownerUserInfo.ToXPersonDto(); + + // + // Setting Owner ... + destination.Owner = owner; + // // Retrieve Owner ... // Retrieve Title Resources ... diff --git a/Models/Dtos/XAiConversationDto.cs b/Models/Dtos/XAiConversationDto.cs index fdd5a48..633862d 100644 --- a/Models/Dtos/XAiConversationDto.cs +++ b/Models/Dtos/XAiConversationDto.cs @@ -21,10 +21,14 @@ namespace xAiModels.Models.Dtos public virtual XPersonDto Owner { get; set; } = null; /// - /// Title of Conversation ... + /// Conversation Title Resource ID ... /// public string Title { get; set; } - public virtual XLocaleResourceDto[] TitleLocales { get; set; } + + /// + /// All Exists Title Locale Resources ... + /// + public virtual XLocaleResourceDto[] TitleLocales { get; set; } /// /// Created Time ... @@ -39,11 +43,26 @@ namespace xAiModels.Models.Dtos /// /// Project ID ... /// - public Guid ProjectId { get; set; } + public Guid ProjectId { get; set; } - public virtual string ProjectTitle { get; set; } = null; - public virtual string ProjectDescription { get; set; } = null; + /// + /// Project Title Resource ID ... + /// + public virtual string ProjectTitle { get; set; } = null; + + /// + /// Project Description Resource ID ... + /// + public virtual string ProjectDescription { get; set; } = null; + + /// + /// Project Title Locale Resources ... + /// public virtual XLocaleResourceDto[] ProjectTitleLocales { get; set; } + + /// + /// Project Description Locale Resources ... + /// public virtual XLocaleResourceDto[] ProjectDescriptionLocales { get; set; } } } \ No newline at end of file