From fcef047afb4c02b9b002d5b892d0aa328c32f428 Mon Sep 17 00:00:00 2001 From: VPrasannaK94 <117351802+VPrasannaK94@users.noreply.github.com> Date: Mon, 11 Sep 2023 17:10:31 +0530 Subject: [PATCH] feat(app) : added subscriptionId field to activeSubscription Endpoint (#258) Refs: CPLP-3233 Reviewed-By: Phil Schneider --- .../Models/OfferSubscriptionStatusData.cs | 3 ++- .../Repositories/OfferSubscriptionsRepository.cs | 3 ++- .../OfferSubscriptionRepositoryTest.cs | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/portalbackend/PortalBackend.DBAccess/Models/OfferSubscriptionStatusData.cs b/src/portalbackend/PortalBackend.DBAccess/Models/OfferSubscriptionStatusData.cs index 5340829a55..1a88ee0411 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Models/OfferSubscriptionStatusData.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Models/OfferSubscriptionStatusData.cs @@ -51,7 +51,8 @@ public record ActiveOfferSubscriptionStatusData( [property: JsonPropertyName("offerId")] Guid OfferId, [property: JsonPropertyName("name")] string? OfferName, [property: JsonPropertyName("provider")] string Provider, - [property: JsonPropertyName("image")] Guid? DocumentId + [property: JsonPropertyName("image")] Guid? DocumentId, + [property: JsonPropertyName("subscriptionId")] Guid OfferSubscriptionId ); /// diff --git a/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs b/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs index c18b755ea1..da4b319185 100644 --- a/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs +++ b/src/portalbackend/PortalBackend.DBAccess/Repositories/OfferSubscriptionsRepository.cs @@ -523,7 +523,8 @@ public IAsyncEnumerable GetOwnCompanyActiveSu .Where(document => document.DocumentTypeId == documentTypeId && document.DocumentStatusId == DocumentStatusId.LOCKED) - .Select(document => document.Id).FirstOrDefault() + .Select(document => document.Id).FirstOrDefault(), + os.Id )).ToAsyncEnumerable(); /// diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/OfferSubscriptionRepositoryTest.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/OfferSubscriptionRepositoryTest.cs index 719e452ed1..5c12731fa1 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/OfferSubscriptionRepositoryTest.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/OfferSubscriptionRepositoryTest.cs @@ -996,7 +996,8 @@ public async Task GetOwnCompanyActiveSubscribedOfferSubscriptionStatusesUntracke x => x.OfferId == new Guid("ac1cf001-7fbc-1f2f-817f-bce0572c0007") && x.OfferName == "Trace-X" && x.Provider == "Catena-X" && - x.DocumentId == new Guid("e020787d-1e04-4c0b-9c06-bd1cd44724b1")); + x.DocumentId == new Guid("e020787d-1e04-4c0b-9c06-bd1cd44724b1") && + x.OfferSubscriptionId == new Guid("ed4de48d-fd4b-4384-a72f-ecae3c6cc5ba")); } [Fact]