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

fix(leadPictureId): responding image id for service offer type #1042

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public async Task<ServiceDetailResponse> GetServiceDetailsAsync(Guid serviceId,
result.Id,
result.Title,
result.Provider,
result.LeadPictureId,
result.ContactEmail,
result.Description,
result.LicenseTypeId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.Services.Service.ViewModels;
/// <param name="Id">ID of the app.</param>
/// <param name="Title">Title or name of the app.</param>
/// <param name="Provider">Provider of the app.</param>
/// <param name="LeadPictureId">Lead pircture Id.</param>
tfjanjua marked this conversation as resolved.
Show resolved Hide resolved
/// <param name="ContactEmail">Contact email address.</param>
/// <param name="Description">The description of the service.</param>
/// <param name="LicenseType">LicenseType for offer</param>
Expand All @@ -42,6 +43,7 @@ public record ServiceDetailResponse(
Guid Id,
string? Title,
string Provider,
Guid LeadPictureId,
string? ContactEmail,
tfjanjua marked this conversation as resolved.
Show resolved Hide resolved
string? Description,
LicenseTypeId LicenseType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public record OfferDetailData(
/// <param name="Id">ID of the app.</param>
/// <param name="Title">Title or name of the app.</param>
/// <param name="Provider">Provider of the app.</param>
/// <param name="LeadPictureId">Lead pircture Id.</param>
/// <param name="ContactEmail">Contact email address.</param>
/// <param name="Description">The description of the service.</param>
/// <param name="Price">Pricing information of the app.</param>
Expand All @@ -59,6 +60,7 @@ public record ServiceDetailData(
Guid Id,
string? Title,
string Provider,
Guid LeadPictureId,
string? ContactEmail,
string? Description,
string Price,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models;
/// <param name="Id">ID of the service.</param>
/// <param name="Title">Title or name of the service.</param>
/// <param name="Provider">Provider of the service.</param>
/// <param name="LeadPictureUri">Uri to service's lead picture.</param>
/// <param name="LeadPictureId">Lead pircture Id.</param>
/// <param name="ContactEmail">Contact email address.</param>
/// <param name="Description">The description of the service.</param>
/// <param name="LicenseType">License TypeId for offer.</param>
Expand All @@ -37,6 +37,7 @@ public record ServiceOverviewData(
Guid Id,
string? Title,
string Provider,
Guid LeadPictureId,
string? ContactEmail,
string? Description,
LicenseTypeId LicenseType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ public void RemoveAppLanguages(IEnumerable<(Guid appId, string languageShortName
service.Id,
service.Name,
service.ProviderCompany!.Name,
service.Documents.Where(document => document.DocumentTypeId == DocumentTypeId.SERVICE_LEADIMAGE && document.DocumentStatusId != DocumentStatusId.INACTIVE).Select(document => document.Id).FirstOrDefault(),
tfjanjua marked this conversation as resolved.
Show resolved Hide resolved
service.ContactEmail,
service.OfferDescriptions.SingleOrDefault(ln => ln.LanguageShortName == languageShortName)!.DescriptionShort,
service.LicenseTypeId,
Expand Down Expand Up @@ -273,6 +274,7 @@ public void RemoveAppLanguages(IEnumerable<(Guid appId, string languageShortName
offer.Id,
offer.Name,
offer.ProviderCompany!.Name,
offer.Documents.Where(document => document.DocumentTypeId == DocumentTypeId.SERVICE_LEADIMAGE && document.DocumentStatusId != DocumentStatusId.INACTIVE).Select(document => document.Id).FirstOrDefault(),
tfjanjua marked this conversation as resolved.
Show resolved Hide resolved
offer.ContactEmail,
offer.OfferDescriptions.SingleOrDefault(d => d.LanguageShortName == languageShortName)!.DescriptionLong,
offer.OfferLicenses.FirstOrDefault()!.Licensetext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ public async Task GetServiceDetailsAsync_WithExistingServiceAndLanguageCode_Retu
x => x.Key == DocumentTypeId.ADDITIONAL_DETAILS && x.Value.Count() == 1 && x.Value.Any(y => y.DocumentName == "testDocument"));
result.TechnicalUserProfile.Should().ContainSingle().Which.Should().Match<KeyValuePair<Guid, IEnumerable<string>>>(
x => x.Value.SequenceEqual(new[] { "role1", "role2" }));
result.LeadPictureId.Should().NotBeEmpty();
}

[Fact]
Expand Down Expand Up @@ -642,7 +643,8 @@ private void SetupRepositories()
{
OfferSubscriptionDetailData = new[] { new OfferSubscriptionStateDetailData(Guid.NewGuid(), OfferSubscriptionStatusId.ACTIVE) },
Documents = new[] { new DocumentTypeData(DocumentTypeId.ADDITIONAL_DETAILS, Guid.NewGuid(), "testDocument") },
TechnicalUserProfile = new[] { new TechnicalUserRoleData(Guid.NewGuid(), new[] { "role1", "role2" }) }
TechnicalUserProfile = new[] { new TechnicalUserRoleData(Guid.NewGuid(), new[] { "role1", "role2" }) },
LeadPictureId = Guid.NewGuid()
});
A.CallTo(() => _offerRepository.GetServiceDetailByIdUntrackedAsync(A<Guid>.That.Not.Matches(x => x == _existingServiceId), A<string>._, A<Guid>._))
.Returns<ServiceDetailData?>(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ public async Task GetServiceDetailByIdUntrackedAsync_ReturnsExpectedResult()
offerDetail.TechnicalUserProfile.Should().NotBeEmpty().And.HaveCount(2)
.And.Satisfy(x => technicalUserRoleDatas.Single(t => t.TechnicalUserProfileId == x.TechnicalUserProfileId).UserRoles.Count() == 1,
x => technicalUserRoleDatas.Single(t => t.TechnicalUserProfileId == x.TechnicalUserProfileId).UserRoles.Count() == 2);
offerDetail.LeadPictureId.Should().NotBeEmpty();
}

#endregion
Expand All @@ -467,8 +468,8 @@ public async Task GetOfferDeclineDataAsync_ReturnsExpectedResult()
// Assert
offerDetail.Should().NotBeNull();
offerDetail.OfferStatus.Should().Be(OfferStatusId.ACTIVE);
offerDetail.ActiveDocumentStatusDatas.Should().ContainSingle().And.Satisfy(
x => x.DocumentId == new Guid("0d68c68c-d689-474c-a3be-8493f99feab2") && x.StatusId == DocumentStatusId.LOCKED);
offerDetail.ActiveDocumentStatusDatas.Should().ContainEquivalentOf(
new DocumentStatusData(new Guid("0d68c68c-d689-474c-a3be-8493f99feab2"), DocumentStatusId.LOCKED));
}

#endregion
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
"offer_id": "ac1cf001-7fbc-1f2f-817f-bce0000c0001",
"document_id": "0d68c68c-d689-474c-a3be-8493f99feab2"
},
{
"offer_id": "ac1cf001-7fbc-1f2f-817f-bce0000c0001",
"document_id": "9685f744-9d90-4102-a949-fcd0bb86f951"
},
{
"offer_id": "ac1cf001-7fbc-1f2f-817f-bce0000c0001",
"document_id": "3291cae8-3c7b-4862-8cec-93ea0dc8c61e"
Expand Down
Loading