diff --git a/Documents/Boards/xDashboard.kanban b/Documents/Boards/xDashboard.kanban index beda9ad..18ebdaa 100644 --- a/Documents/Boards/xDashboard.kanban +++ b/Documents/Boards/xDashboard.kanban @@ -4,6 +4,15 @@ "id": "c4f8483a-ebd1-4af6-888d-f285bd159ec8", "title": "Backlogs", "cards": [ + { + "id": "90ddcd60-e75f-45e7-a367-474749302458", + "listId": "c4f8483a-ebd1-4af6-888d-f285bd159ec8", + "title": "Try to Refactor an Test StringService in Hoppscotch ...", + "description": "", + "labels": [], + "checkboxes": [], + "comments": [] + }, { "id": "46e24626-5e56-487d-8d44-209c06ed7b4d", "listId": "c4f8483a-ebd1-4af6-888d-f285bd159ec8", @@ -547,29 +556,38 @@ "comments": [] }, { - "id": "d82776f1-55fe-4977-9db0-f23d17a1ea37", + "id": "07747425-25d1-478b-ba84-c56e978574b3", "listId": "171f43f3-ae73-49b7-9239-9f3fb695cc2b", - "title": "Adding Support for XML Documents Integration for All Exists Assemblies in Swagger", + "title": "Add Support for Add/Update Content by Providing Locales in Content Service ...", "description": "", "labels": [], "checkboxes": [], "comments": [] }, { - "id": "90ddcd60-e75f-45e7-a367-474749302458", + "id": "d3e18512-b4a6-4049-974b-af1b0f27cc47", "listId": "171f43f3-ae73-49b7-9239-9f3fb695cc2b", - "title": "Try to Refactor an Test StringService in Hoppscotch ...", + "title": "add Support for reading Tags in Content Enrichers ...", "description": "", "labels": [], "checkboxes": [], "comments": [] - } + } ] }, { "id": "8c15334f-3b2e-4eca-999e-4c887cb628e9", "title": "Test", "cards": [ + { + "id": "d82776f1-55fe-4977-9db0-f23d17a1ea37", + "listId": "8c15334f-3b2e-4eca-999e-4c887cb628e9", + "title": "Adding Support for XML Documents Integration for All Exists Assemblies in Swagger", + "description": "", + "labels": [], + "checkboxes": [], + "comments": [] + }, { "id": "a42dd42b-8fe0-4853-955e-e06770784e41", "listId": "8c15334f-3b2e-4eca-999e-4c887cb628e9", diff --git a/Documents/Codes/XContentRepositoryService.cs b/Documents/Codes/XContentRepositoryService.cs new file mode 100644 index 0000000..677b4d7 --- /dev/null +++ b/Documents/Codes/XContentRepositoryService.cs @@ -0,0 +1,174 @@ +using System; +using AutoMapper; +using System.Linq; +using xModels.Dtos; +using System.Threading; +using xCommons.Extensions; +using xDataService.Providers; +using System.Threading.Tasks; +using System.Collections.Generic; +using xContentService.Interfaces; +using xContentService.Models.Dtos; +using xIdentityService.Interfaces; +using xIdentityService.Extensions; +using xContentService.Interfaces.Dtos; +using xContentService.Models.Entities; +using xContentService.Interfaces.Entities; + +namespace xContentService.Providers.Dtos +{ + public class XContentRepositoryService : XBaseRepositoryService, IXContentRepositoryService + { + private readonly IXIdentityProvider identityProvider; + private readonly IXContentTitleResourceProvider titleResourceProvider; + private readonly IXContentDescriptionResourceProvider descriptionResourceProvider; + + public XContentRepositoryService( + IXContentRepository repository, + IXIdentityProvider identityProvider, + IXContentTitleResourceProvider titleResourceProvider, + IXContentDescriptionResourceProvider descriptionResourceProvider, + IEnumerable mapperProfiles = null + ) : base( + repository, + mapperProfiles + ) + { + this.identityProvider = identityProvider; + this.titleResourceProvider = titleResourceProvider; + this.descriptionResourceProvider = descriptionResourceProvider; + } + + // + #region Enrichers ... + /// + /// Enrich Specified Item ... + /// + /// + /// + /// + public async Task Enrich( + XContent source, + CancellationToken cancellationToken = default + ) + { + // + // Mapping Default ... + var result = Mapper.Map(source); + result = await Enrich( + source: result, + cancellationToken: cancellationToken + ); + + // + return result; + } + + /// + /// Enrich Specified Item ... + /// + /// + /// + /// + public async Task Enrich( + XContentDto source, + CancellationToken cancellationToken = default + ) + { + // + // Handdle Owner ... + 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(); + } + + // + // Hanlde Content Title ... + string contentTitle = string.Empty; + XResourceDto titleResource = await titleResourceProvider.GetResource( + identifier: source.Id, + cancellationToken: cancellationToken + ); + if (!titleResource.IsNullOrDefault()) + { + contentTitle = titleResource.Resource; + } + + // + // Hanlde Content Description ... + string contentDescription = string.Empty; + XResourceDto descriptionResource = await descriptionResourceProvider.GetResource( + identifier: source.Id, + cancellationToken: cancellationToken + ); + if (!descriptionResource.IsNullOrDefault()) + { + contentDescription = descriptionResource.Resource; + } + + // + // Attach Extracted Items ... + var result = Mapper.Map(source, options => + { + // + options.Items[nameof(source.Owner)] = owner; + options.Items[nameof(source.Title)] = contentTitle; + options.Items[nameof(source.TitleResource)] = titleResource; + options.Items[nameof(source.Description)] = contentDescription; + options.Items[nameof(source.DescriptionResource)] = descriptionResource; + }); + + // + return result; + } + + /// + /// Enrich Specified Items ... + /// + /// + /// + /// + public async Task> EnrichRange( + IEnumerable sources, + CancellationToken cancellationToken = default + ) + { + // + var tasks = sources + .Select(x => Enrich(x, cancellationToken)); + + // + var result = await Task.WhenAll(tasks); + return result; + } + + /// + /// Enrich Specified Items ... + /// + /// + /// + /// + public async Task> EnrichRange( + IEnumerable sources, + CancellationToken cancellationToken = default + ) + { + // + var tasks = sources + .Select(x => Enrich(x, cancellationToken)); + + // + var result = await Task.WhenAll(tasks); + return result; + } + #endregion + } +} \ No newline at end of file diff --git a/Documents/Docs/Draws/Friendship.drawio b/Documents/Docs/Draws/Friendship.drawio new file mode 100644 index 0000000..6ddc384 --- /dev/null +++ b/Documents/Docs/Draws/Friendship.drawio @@ -0,0 +1,616 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Documents/Docs/Draws/Referencing.drawio b/Documents/Docs/Draws/Referencing.drawio new file mode 100644 index 0000000..c8694c4 --- /dev/null +++ b/Documents/Docs/Draws/Referencing.drawio @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Documents/Resources/Json/Content.json b/Documents/Resources/Json/Content.json new file mode 100644 index 0000000..bcc282f --- /dev/null +++ b/Documents/Resources/Json/Content.json @@ -0,0 +1,4 @@ +{ + "title": "محتوای تستی", + "description": "توضیحات محتوای تستی" +} \ No newline at end of file diff --git a/Documents/commands.txt b/Documents/commands.txt index 92f7d71..853b681 100644 --- a/Documents/commands.txt +++ b/Documents/commands.txt @@ -9,3 +9,7 @@ git reset --hard 6c669f8 # npm run repackFrameworkCore; npm run repackFrameworkServices; npm run repackFrameworkComponents; npm run pServeXFrameworkTest npm run repackFrameworkComponents; npm run pServeXFrameworkTest + +# +# Refresh Databases ... +npm run refreshApiDbs; npm run refreshAiApiDbs; npm run refreshIdentityDbs diff --git a/Modules/xAiModels b/Modules/xAiModels index a9b75b3..f9b5f1f 160000 --- a/Modules/xAiModels +++ b/Modules/xAiModels @@ -1 +1 @@ -Subproject commit a9b75b3c334afb2ae9795b9d414a1a333a9a854a +Subproject commit f9b5f1f6aa839a36ef43b29147cdedca9b463876 diff --git a/Modules/xContentService b/Modules/xContentService index 5d9cd2a..7802ff9 160000 --- a/Modules/xContentService +++ b/Modules/xContentService @@ -1 +1 @@ -Subproject commit 5d9cd2afbeebae17438f7d30178df0e5d1786547 +Subproject commit 7802ff9561ff7613599d9f080d807e385f7ab69f