Skip to content

Commit

Permalink
fix: add registration for missing services (#1147)
Browse files Browse the repository at this point in the history
Refs: #1144
Reviewed-By: Evelyn Gurschler <[email protected]>
  • Loading branch information
Phil91 authored Nov 13, 2024
1 parent 15c845b commit 14e6d1a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
6 changes: 6 additions & 0 deletions src/Portal.Backend.sln
Original file line number Diff line number Diff line change
Expand Up @@ -1678,6 +1678,12 @@ Global
{07BDC20D-23DD-4C0E-9C3D-B1D232AF17E3}.Release|x86.Build.0 = Release|Any CPU
{D666EADA-770A-42FF-B891-5745F7A6BC2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D666EADA-770A-42FF-B891-5745F7A6BC2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D666EADA-770A-42FF-B891-5745F7A6BC2F}.Release|x86.ActiveCfg = Release|Any CPU
{D666EADA-770A-42FF-B891-5745F7A6BC2F}.Release|x86.Build.0 = Release|Any CPU
{D666EADA-770A-42FF-B891-5745F7A6BC2F}.Debug|x86.ActiveCfg = Debug|Any CPU
{D666EADA-770A-42FF-B891-5745F7A6BC2F}.Debug|x86.Build.0 = Debug|Any CPU
{D666EADA-770A-42FF-B891-5745F7A6BC2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D666EADA-770A-42FF-B891-5745F7A6BC2F}.Release|Any CPU.Build.0 = Release|Any CPU
{59E4B63B-BEA2-4CDA-98F0-13962146AEA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{59E4B63B-BEA2-4CDA-98F0-13962146AEA5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{59E4B63B-BEA2-4CDA-98F0-13962146AEA5}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down
12 changes: 12 additions & 0 deletions src/maintenance/Maintenance.App/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@
using Laraue.EfCoreTriggers.PostgreSql.Extensions;
using Microsoft.EntityFrameworkCore;
using Org.Eclipse.TractusX.Portal.Backend.Clearinghouse.Library;
using Org.Eclipse.TractusX.Portal.Backend.Custodian.Library;
using Org.Eclipse.TractusX.Portal.Backend.Custodian.Library.BusinessLogic;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Logging;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Token;
using Org.Eclipse.TractusX.Portal.Backend.Maintenance.App.DependencyInjection;
using Org.Eclipse.TractusX.Portal.Backend.Maintenance.App.Services;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Auditing;
using Org.Eclipse.TractusX.Portal.Backend.Processes.ApplicationChecklist.Library;
using Org.Eclipse.TractusX.Portal.Backend.Processes.ProcessIdentity;
using Org.Eclipse.TractusX.Portal.Backend.Processes.ProcessIdentity.DependencyInjection;
using Serilog;

Expand All @@ -41,8 +47,14 @@
.AddMaintenanceService()
.AddConfigurationProcessIdentityIdDetermination(hostContext.Configuration.GetSection("ProcessIdentity"))
.AddBatchDelete(hostContext.Configuration.GetSection("BatchDelete"))
.AddTransient<ITokenService, TokenService>()
.AddTransient<ICustodianBusinessLogic, CustodianBusinessLogic>()
.AddTransient<ICustodianService, CustodianService>()
.AddTransient<IApplicationChecklistService, ApplicationChecklistService>()
.AddTransient<IProcessIdentityDataDetermination, ProcessIdentityDataDetermination>()
.AddClearinghouseService(hostContext.Configuration.GetSection("Clearinghouse"))
.AddDbAuditing()
.AddPortalRepositories(hostContext.Configuration)
.AddDbContext<PortalDbContext>(o =>
o.UseNpgsql(hostContext.Configuration.GetConnectionString("PortalDb"))
.UsePostgreSqlTriggers());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,21 @@

namespace Org.Eclipse.TractusX.Portal.Backend.Processes.ProcessIdentity;

public class ProcessIdentityDataDetermination : IProcessIdentityDataDetermination
public class ProcessIdentityDataDetermination(
IPortalRepositories portalRepositories,
IProcessIdentityDataBuilder processIdentityDataBuilder)
: IProcessIdentityDataDetermination
{
private readonly IIdentityRepository _identityRepository;
private readonly IProcessIdentityDataBuilder _processIdentityDataBuilder;

public ProcessIdentityDataDetermination(IPortalRepositories portalRepositories, IProcessIdentityDataBuilder processIdentityDataBuilder)
{
_identityRepository = portalRepositories.GetInstance<IIdentityRepository>();
_processIdentityDataBuilder = processIdentityDataBuilder;
}
private readonly IIdentityRepository _identityRepository = portalRepositories.GetInstance<IIdentityRepository>();

/// <inheritdoc />
public async Task GetIdentityData()
{
(IdentityTypeId IdentityTypeId, Guid CompanyId) identityData;

if ((identityData = await _identityRepository.GetActiveIdentityDataByIdentityId(_processIdentityDataBuilder.IdentityId).ConfigureAwait(ConfigureAwaitOptions.None)) == default)
throw new ConflictException($"Identity {_processIdentityDataBuilder.IdentityId} could not be found");
if ((identityData = await _identityRepository.GetActiveIdentityDataByIdentityId(processIdentityDataBuilder.IdentityId).ConfigureAwait(ConfigureAwaitOptions.None)) == default)
throw new ConflictException($"Identity {processIdentityDataBuilder.IdentityId} could not be found");

_processIdentityDataBuilder.AddIdentityData(identityData.IdentityTypeId, identityData.CompanyId);
processIdentityDataBuilder.AddIdentityData(identityData.IdentityTypeId, identityData.CompanyId);
}
}
1 change: 1 addition & 0 deletions src/registration/Registration.Service/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ await WebAppHelper
builder.Services.AddTransient<IUserProvisioningService, UserProvisioningService>();
builder.Services.AddTransient<IStaticDataBusinessLogic, StaticDataBusinessLogic>();
builder.Services.AddTransient<IRegistrationBusinessLogic, RegistrationBusinessLogic>()
.AddTransient<IIdentityProviderProvisioningService, IdentityProviderProvisioningService>()
.ConfigureRegistrationSettings(builder.Configuration.GetSection("Registration"))
.AddTransient<INetworkBusinessLogic, NetworkBusinessLogic>();
Expand Down

0 comments on commit 14e6d1a

Please sign in to comment.