From 85d6d59d768be9f91c1084d502230f7056a5cfb0 Mon Sep 17 00:00:00 2001 From: enrique Date: Thu, 19 Oct 2023 11:28:16 +0200 Subject: [PATCH] fix: search by subscription needs to filter by tokenId --- src/nevermined/api/SearchApi.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/nevermined/api/SearchApi.ts b/src/nevermined/api/SearchApi.ts index 80a7496ea..8cb788929 100644 --- a/src/nevermined/api/SearchApi.ts +++ b/src/nevermined/api/SearchApi.ts @@ -473,6 +473,7 @@ export class SearchApi extends Instantiable { */ public async servicesByNftContract( nftContractAddress: string, + tokenId: string, customNestedQueries?: SearchQuery['query'][], offset = 100, page = 1, @@ -522,6 +523,12 @@ export class SearchApi extends Instantiable { nftContractAddress, }, }, + { + match: { + 'service.attributes.serviceAgreementTemplate.conditions.parameters.value': + tokenId, + }, + }, ], }, }, @@ -588,6 +595,7 @@ export class SearchApi extends Instantiable { return this.servicesByNftContract( nftContractAddress, + subscriptionDid, customNestedQueries, offset, page, @@ -610,6 +618,7 @@ export class SearchApi extends Instantiable { */ public async datasetsByNftContract( nftContractAddress: string, + tokenId: string, customNestedQueries?: SearchQuery['query'][], offset = 100, page = 1, @@ -659,6 +668,12 @@ export class SearchApi extends Instantiable { nftContractAddress, }, }, + { + match: { + 'service.attributes.serviceAgreementTemplate.conditions.parameters.value': + tokenId, + }, + }, ], }, }, @@ -725,6 +740,7 @@ export class SearchApi extends Instantiable { return this.datasetsByNftContract( nftContractAddress, + subscriptionDid, customNestedQueries, offset, page,