Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(companyData): enhance GET: /api/administration/companyData/missing-sd-document #1236

Merged
merged 3 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/api/administration-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6444,8 +6444,18 @@ components:
companyId:
type: string
format: uuid
bpn:
type: string
nullable: true
name:
type: string
shortName:
type: string
nullable: true
skippedDate:
type: string
format: date-time
nullable: true
additionalProperties: false
CompanyMissingSdDocumentDataResponse:
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;

public record CompanyMissingSdDocumentData(
Guid CompanyId,
string Name
string? Bpn,
string Name,
string? ShortName,
DateTimeOffset? SkippedDate
);
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using Org.Eclipse.TractusX.Portal.Backend.Framework.DBAccess;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Identity;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Models;
using Org.Eclipse.TractusX.Portal.Backend.Framework.Processes.Library.Enums;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities;
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities.Entities;
Expand Down Expand Up @@ -424,7 +425,20 @@ public void RemoveProviderCompanyDetails(Guid providerCompanyDetailId) =>
c => c.OrderByDescending(company => company.Name),
c => new CompanyMissingSdDocumentData(
c.Id,
c.Name)
c.BusinessPartnerNumber,
c.Name,
c.Shortname,
c.CompanyApplications
.Where(ca =>
ca.ApplicationChecklistEntries.Any(a =>
a.ApplicationChecklistEntryTypeId == ApplicationChecklistEntryTypeId.SELF_DESCRIPTION_LP &&
a.ApplicationChecklistEntryStatusId != ApplicationChecklistEntryStatusId.SKIPPED))
.SelectMany(ca =>
ca.ChecklistProcess!.ProcessSteps.Where(ps =>
ps.ProcessStepTypeId == ProcessStepTypeId.START_SELF_DESCRIPTION_LP &&
ps.ProcessStepStatusId == ProcessStepStatusId.SKIPPED))
.OrderByDescending(ps => ps.DateLastChanged)
.FirstOrDefault()!.DateLastChanged)
).SingleOrDefaultAsync();

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