Skip to content

Commit

Permalink
Merge pull request #152 from Ali-YousefiTelori/develop
Browse files Browse the repository at this point in the history
fix findParentBussinessId strategy
  • Loading branch information
Ali-YousefiTelori authored Feb 2, 2024
2 parents 14b3012 + 6ab1e11 commit 4f4ec87
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>netstandard2.1;net6.0;net7.0;net8.0</TargetFrameworks>
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<Version>0.0.1.46</Version>
<Version>0.0.1.47</Version>
<Description>asp core servces.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,database,services,asp,aspnet</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<Version>0.0.1.46</Version>
<Version>0.0.1.47</Version>
<Description>asp core servces.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,database,services,asp,aspnet,aspcore,efcore</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using EasyMicroservices.Cores.AspEntityFrameworkCoreApi.Interfaces;
using EasyMicroservices.Cores.Database.Managers;
using EasyMicroservices.Cores.Models;
using EasyMicroservices.Database.Interfaces;
using EasyMicroservices.ServiceContracts;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
Expand Down Expand Up @@ -56,14 +55,14 @@ private set
}
}

string GetDefaultUniqueIdentity(ICollection<WhiteLabelContract> whiteLables, long? parentId)
string GetDefaultUniqueIdentity(ICollection<WhiteLabelContract> whiteLabels, long? parentId)
{
var found = whiteLables.FirstOrDefault(x => x.ParentId == parentId);
var found = whiteLabels.FirstOrDefault(x => x.ParentId == parentId);
if (found == null)
{
return "";
}
return $"{DefaultUniqueIdentityManager.GenerateUniqueIdentity(found.Id)}-{GetDefaultUniqueIdentity(whiteLables, found.Id)}".Trim('-');
return $"{DefaultUniqueIdentityManager.GenerateUniqueIdentity(found.Id)}-{GetDefaultUniqueIdentity(whiteLabels, found.Id)}".Trim('-');
}

static SemaphoreSlim SemaphoreSlim { get; set; } = new SemaphoreSlim(1);
Expand Down Expand Up @@ -100,7 +99,12 @@ public async Task<WhiteLabelInfo> Initialize(IHttpContextAccessor httpContext, s

var whiteLabelClient = new WhiteLables.GeneratedServices.WhiteLabelClient(whiteLableRoute, WhiteLabelHttpClient);
var whiteLabels = await whiteLabelClient.GetAllAsync().AsCheckedResult(x => x.Result).ConfigureAwait(false);
var defaultUniqueIdentity = GetDefaultUniqueIdentity(whiteLabels, null);
var findParentBussinessId = whiteLabels.FirstOrDefault(x => x.Name.Equals(microserviceName, StringComparison.OrdinalIgnoreCase))?.Id;
string defaultUniqueIdentity;
if (findParentBussinessId.HasValue)
defaultUniqueIdentity = $"{DefaultUniqueIdentityManager.GenerateUniqueIdentity(findParentBussinessId.Value)}-{GetDefaultUniqueIdentity(whiteLabels, findParentBussinessId)}".Trim('-');
else
defaultUniqueIdentity = GetDefaultUniqueIdentity(whiteLabels, findParentBussinessId);

var microserviceClient = new WhiteLables.GeneratedServices.MicroserviceClient(whiteLableRoute, WhiteLabelHttpClient);
var microservices = await microserviceClient.GetAllAsync().ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ public virtual Task<bool> HasUniqueIdentityRole()
///
/// </summary>
/// <returns></returns>
public string GetFullAccessPersonalAccessToken()
public virtual string GetFullAccessPersonalAccessToken()
{
var config = GetConfiguration();
var section = config?.GetSection("Authorization");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<Version>0.0.1.46</Version>
<Version>0.0.1.47</Version>
<Description>core of database.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,client,clients</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>netstandard2.0;netstandard2.1;net45;net6.0;net8.0</TargetFrameworks>
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<Version>0.0.1.46</Version>
<Version>0.0.1.47</Version>
<Description>core contracts.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,contract,contracts,dto,dtos</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>netstandard2.0;netstandard2.1;net45;net6.0;net8.0</TargetFrameworks>
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<Version>0.0.1.46</Version>
<Version>0.0.1.47</Version>
<Description>core of database.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,database</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>netstandard2.1;net6.0;net8.0</TargetFrameworks>
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<Version>0.0.1.46</Version>
<Version>0.0.1.47</Version>
<Description>ef core of database.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,database,ef,efcore</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>netstandard2.1;net6.0;net7.0;net8.0</TargetFrameworks>
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<Version>0.0.1.46</Version>
<Version>0.0.1.47</Version>
<Description>ef core of Relational database.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,database,ef,efcore,Relational</PackageTags>
Expand Down

0 comments on commit 4f4ec87

Please sign in to comment.