Skip to content

Commit

Permalink
feat(connector): add sd skipped date to connector (#1234)
Browse files Browse the repository at this point in the history
* feat(connector): enhance GET: /api/administration/connectors/missing-sd-document endpoint
* add a date to determine when the sd document creation was skipped for connectors
Refs: #1180
Refs: #1181
---------
Co-authored-by: Norbert Truchsess <[email protected]>
  • Loading branch information
Phil91 authored Jan 29, 2025
1 parent bfb99e6 commit f4895b4
Show file tree
Hide file tree
Showing 11 changed files with 10,538 additions and 16 deletions.
8 changes: 7 additions & 1 deletion docs/api/administration-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6837,13 +6837,19 @@ components:
connectorId:
type: string
format: uuid
type:
$ref: '#/components/schemas/ConnectorTypeId'
name:
type: string
companyId:
type: string
format: uuid
companyName:
hostCompanyName:
type: string
skippedDate:
type: string
format: date-time
nullable: true
additionalProperties: false
ConnectorMissingSdDocumentDataResponse:
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.ErrorHandling;
using Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Async;
using Org.Eclipse.TractusX.Portal.Backend.Framework.DateTimeProvider;
using Org.Eclipse.TractusX.Portal.Backend.Framework.ErrorHandling;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity;
using Org.Eclipse.TractusX.Portal.Backend.Framework.IO;
Expand All @@ -47,6 +48,7 @@ public class ConnectorsBusinessLogic(
ISdFactoryBusinessLogic sdFactoryBusinessLogic,
IIdentityService identityService,
IServiceAccountManagement serviceAccountManagement,
IDateTimeProvider dateTimeProvider,
ILogger<ConnectorsBusinessLogic> logger)
: IConnectorsBusinessLogic
{
Expand Down Expand Up @@ -231,6 +233,7 @@ private async Task<Guid> CreateAndRegisterConnectorAsync(
connector.TypeId = type;
connector.DateLastChanged = DateTimeOffset.UtcNow;
connector.StatusId = _settings.ClearinghouseConnectDisabled ? ConnectorStatusId.ACTIVE : ConnectorStatusId.PENDING;
connector.SdSkippedDate = _settings.ClearinghouseConnectDisabled ? dateTimeProvider.OffsetNow : null;
if (technicalUserId != null)
{
connector.TechnicalUserId = technicalUserId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ public record ConnectorOfferSubscription(Guid AssignedOfferSubscriptionIds, Offe

public record TechnicalUserData(Guid Id, string Name, string? ClientId, string Description);

public record ConnectorMissingSdDocumentData(Guid ConnectorId, string Name, Guid CompanyId, string CompanyName);
public record ConnectorMissingSdDocumentData(Guid ConnectorId, ConnectorTypeId Type, string Name, Guid CompanyId, string HostCompanyName, DateTimeOffset? SkippedDate);
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,11 @@ public void DeleteConnectorAssignedSubscriptions(Guid connectorId, IEnumerable<G
connector => connector.OrderByDescending(c => c.Name),
con => new ConnectorMissingSdDocumentData(
con.Id,
con.TypeId,
con.Name,
con.HostId ?? con.ProviderId,
con.HostId != null ? con.Host!.Name : con.Provider!.Name)
con.HostId != null ? con.Host!.Name : con.Provider!.Name,
con.SdSkippedDate)
).SingleOrDefaultAsync();

public IAsyncEnumerable<Guid> GetConnectorIdsWithMissingSelfDescription() =>
Expand Down
Loading

0 comments on commit f4895b4

Please sign in to comment.