diff --git a/src/ThirdParty/ThirdParty.router.spec.ts b/src/ThirdParty/ThirdParty.router.spec.ts index 7c88cfa6..5c69364b 100644 --- a/src/ThirdParty/ThirdParty.router.spec.ts +++ b/src/ThirdParty/ThirdParty.router.spec.ts @@ -23,12 +23,12 @@ describe('ThirdParty router', () => { thirdParty: { name: 'a name', description: 'a description' }, } fragments = [ - { id: '1', managers: ['0x1'], maxItems: 3, totalItems: 2, metadata }, + { id: '1', managers: ['0x1'], maxItems: '3', totalItems: '2', metadata }, { id: '2', managers: ['0x2', '0x3'], - maxItems: 2, - totalItems: 1, + maxItems: '2', + totalItems: '1', metadata, }, ] diff --git a/src/ThirdParty/ThirdParty.router.ts b/src/ThirdParty/ThirdParty.router.ts index 2021df62..246ed66a 100644 --- a/src/ThirdParty/ThirdParty.router.ts +++ b/src/ThirdParty/ThirdParty.router.ts @@ -1,7 +1,7 @@ import { server } from 'decentraland-server' import { Router } from '../common/Router' -import { withAuthentication, AuthRequest } from '../middleware/authentication' +import { AuthRequest, withAuthentication } from '../middleware/authentication' import { thirdPartyAPI } from '../ethereum/api/thirdParty' import { ThirdParty } from './ThirdParty.types' import { toThirdParty } from './utils' @@ -19,13 +19,12 @@ export class ThirdPartyRouter extends Router { } async getThirdParties(req: AuthRequest): Promise { - let manager = '' + let manager: string | undefined try { manager = server.extractFromReq(req, 'manager') } catch (e) { // We support empty manager filters on the query string } - const fragments = await thirdPartyAPI.fetchThirdParties(manager) return fragments.map(toThirdParty) } diff --git a/src/ThirdParty/utils.spec.ts b/src/ThirdParty/utils.spec.ts index 4c5ef21b..a3bf1ee3 100644 --- a/src/ThirdParty/utils.spec.ts +++ b/src/ThirdParty/utils.spec.ts @@ -13,8 +13,8 @@ describe('toThirdParty', () => { fragment = { id: 'some:id', managers: ['0x1', '0x2'], - maxItems: 1, - totalItems: 1, + maxItems: '1', + totalItems: '1', metadata: { type: ThirdPartyMetadataType.THIRD_PARTY_V1, thirdParty: { @@ -47,8 +47,8 @@ describe('toThirdParty', () => { fragment = { id: 'some:other:id', managers: ['0x2'], - maxItems: 2, - totalItems: 1, + maxItems: '2', + totalItems: '1', metadata: { type: ThirdPartyMetadataType.THIRD_PARTY_V1, thirdParty: null, diff --git a/src/ethereum/api/fragments.ts b/src/ethereum/api/fragments.ts index ae28701d..a75d9fed 100644 --- a/src/ethereum/api/fragments.ts +++ b/src/ethereum/api/fragments.ts @@ -146,8 +146,8 @@ export type CollectionFragment = { export type ThirdPartyFragment = { id: string managers: string[] - maxItems: number - totalItems: number + maxItems: string + totalItems: string metadata: ThirdPartyMetadata } diff --git a/src/ethereum/api/thirdParty.ts b/src/ethereum/api/thirdParty.ts index 452807ae..bf896f90 100644 --- a/src/ethereum/api/thirdParty.ts +++ b/src/ethereum/api/thirdParty.ts @@ -65,11 +65,11 @@ const getThirdPartyCollectionItemsQuery = () => gql` export class ThirdPartyAPI extends BaseGraphAPI { fetchThirdParties = async ( - manager: string = '' + manager?: string ): Promise => { return this.paginate(['thirdParties'], { query: getThirdPartiesQuery(), - variables: { managers: [manager.toLowerCase()] }, + variables: { managers: manager ? [manager.toLowerCase()] : [] }, }) }