Skip to content

Commit

Permalink
Revert "feat: add emoteHasSound and emoteHasGeometry filters (#343)" (#…
Browse files Browse the repository at this point in the history
…345)

This reverts commit a4b68de.
  • Loading branch information
meelrossi committed Sep 6, 2023
1 parent a4b68de commit 35cf682
Show file tree
Hide file tree
Showing 15 changed files with 13 additions and 90 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"printWidth": 80
},
"dependencies": {
"@dcl/schemas": "^9.5.0",
"@dcl/schemas": "^9.1.0",
"@well-known-components/env-config-provider": "^1.2.0",
"@well-known-components/http-requests-logger-component": "^2.1.0",
"@well-known-components/http-server": "^1.1.6",
Expand Down
4 changes: 1 addition & 3 deletions src/adapters/handlers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ export const getItemsParams = (params: Params) => {
? ethers.utils.parseEther(minPrice).toString()
: undefined,
urns: params.getList('urn'),
ids: params.getList('id'),
emoteHasSound: params.getBoolean('emoteHasSound'),
emoteHasGeometry: params.getBoolean('emoteHasGeometry'),
ids: params.getList('id')
}
}
4 changes: 0 additions & 4 deletions src/logic/nfts/collections.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ describe('when building a result from the collections subgraph fragment', () =>
rarity: Rarity.LEGENDARY,
bodyShapes: [BodyShape.MALE, BodyShape.FEMALE],
loop: false,
hasSound: false,
hasGeometry: false,
},
}
})
Expand All @@ -84,8 +82,6 @@ describe('when building a result from the collections subgraph fragment', () =>
bodyShapes: [BodyShape.MALE, BodyShape.FEMALE],
rarity: Rarity.LEGENDARY,
loop: false,
hasGeometry: false,
hasSound: false
})
})
})
Expand Down
8 changes: 1 addition & 7 deletions src/logic/nfts/collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ export const getCollectionsFields = () => `
rarity
bodyShapes
loop
hasSound
hasGeometry
}
}
createdAt
Expand Down Expand Up @@ -107,9 +105,7 @@ export type CollectionsFields = Omit<
category: EmoteCategory
rarity: Rarity
bodyShapes: BodyShape[]
loop: boolean,
hasSound: boolean,
hasGeometry: boolean
loop: boolean
} | null
}
createdAt: string
Expand Down Expand Up @@ -181,8 +177,6 @@ export function fromCollectionsFragment(
description: fragment.metadata.emote!.description,
rarity: fragment.metadata.emote!.rarity,
loop: fragment.metadata.emote!.loop,
hasSound: fragment.metadata.emote!.hasSound,
hasGeometry: fragment.metadata.emote!.hasGeometry
},
}
break
Expand Down
17 changes: 3 additions & 14 deletions src/ports/catalog/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,6 @@ export const getIdsWhere = (filters: CatalogFilters) => {
return SQL`items.id = ANY(${filters.ids})`
}

export const getHasSoundWhere = () => {
return SQL`items.search_emote_has_sound = true`
}

export const getHasGeometryWhere = () => {
return SQL`items.search_emote_has_geometry = true`
}

export const getUrnsWhere = (filters: CatalogFilters) => {
return SQL`items.urn = ANY(${filters.urns})`
}
Expand Down Expand Up @@ -236,8 +228,6 @@ export const getCollectionsQueryWhere = (filters: CatalogFilters) => {
filters.onlyListing ? getOnlyListingsWhere() : undefined,
filters.onlyMinting ? getOnlyMintingWhere() : undefined,
filters.ids?.length ? getIdsWhere(filters) : undefined,
filters.emoteHasSound ? getHasSoundWhere() : undefined,
filters.emoteHasGeometry ? getHasGeometryWhere() : undefined,
filters.urns?.length ? getUrnsWhere(filters) : undefined,
].filter(Boolean)

Expand Down Expand Up @@ -404,10 +394,9 @@ export const getCollectionsItemsCatalogQuery = (
emote.body_shapes,
emote.rarity,
emote.name,
emote.loop,
emote.has_sound,
emote.has_geometry
FROM `
emote.loop
FROM
`
)
.append(schemaVersion)
.append(
Expand Down
2 changes: 0 additions & 2 deletions src/ports/catalog/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ export type CollectionsItemDBResult = {
rarity: string
name: string
loop?: boolean
has_sound: boolean,
has_geometry: boolean
}
urn: string
}
Expand Down
4 changes: 0 additions & 4 deletions src/ports/catalog/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ export function fromCollectionsItemDbResultToCatalogItem(
rarity,
loop,
category: emoteCategory,
has_sound,
has_geometry
} = dbItem.metadata
;(name = emoteName), (category = NFTCategory.EMOTE)
data = {
Expand All @@ -111,8 +109,6 @@ export function fromCollectionsItemDbResultToCatalogItem(
bodyShapes: body_shapes as BodyShape[],
rarity: rarity as Rarity,
loop: !!loop,
hasSound: !!has_sound,
hasGeometry: !!has_geometry
},
}
break
Expand Down
2 changes: 0 additions & 2 deletions src/ports/items/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ export type ItemFragment = {
description: string
category: EmoteCategory
loop: boolean
hasSound: boolean
hasGeometry: boolean
} | null
}
searchWearableBodyShapes: BodyShape[] | null
Expand Down
2 changes: 0 additions & 2 deletions src/ports/items/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,6 @@ describe('#fromItemFragment', () => {
description: 'description',
loop: false,
name: 'name',
hasGeometry: false,
hasSound: false
},
},
searchWearableBodyShapes: null,
Expand Down
4 changes: 0 additions & 4 deletions src/ports/items/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ export function fromItemFragment(
bodyShapes: fragment.searchEmoteBodyShapes!,
rarity: fragment.rarity,
loop: fragment.metadata.emote!.loop,
hasGeometry: fragment.metadata.emote!.hasGeometry,
hasSound: fragment.metadata.emote!.hasSound
},
}
break
Expand Down Expand Up @@ -125,8 +123,6 @@ export const getItemFragment = () => `
description
category
loop
hasSound
hasGeometry
}
}
searchWearableBodyShapes
Expand Down
2 changes: 0 additions & 2 deletions src/tests/adapters/handlers/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ describe('getItemsParams', () => {
urns: [],
wearableCategory: undefined,
wearableGenders: [],
emoteHasSound: false,
emoteHasGeometry: false,
})
})
})
Expand Down
30 changes: 0 additions & 30 deletions src/tests/ports/catalog-queries.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,36 +322,6 @@ test('catalog utils', () => {
])
})
})

describe('and passing emoteHasSound as true', () => {
beforeEach(() => {
filters = {
emoteCategory,
emoteHasSound: true,
}
})

it('should add the sound related definition to the WHERE', () => {
expect(getCollectionsQueryWhere(filters).text).toContain(
'items.search_emote_has_sound = true'
)
})
})

describe('and passing emoteHasGeometry as true', () => {
beforeEach(() => {
filters = {
emoteCategory,
emoteHasGeometry: true,
}
})

it('should add the geometry related definition to the WHERE', () => {
expect(getCollectionsQueryWhere(filters).text).toContain(
'items.search_emote_has_geometry = true'
)
})
})
})
})

Expand Down
4 changes: 0 additions & 4 deletions src/tests/ports/catalog.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ const mockedDBItemResponse: CollectionsItemDBResult = {
rarity: 'legendary',
name: 'Descension',
loop: false,
has_geometry: false,
has_sound: false
},
image:
'https://peer-lb.decentraland.org/lambdas/collections/contents/urn:decentraland:matic:collections-v2:0xe42257bb4aada439179d736a64a736be0693a4ec:2/thumbnail',
Expand Down Expand Up @@ -132,8 +130,6 @@ test('catalog component', function () {
rarity: 'legendary',
name: 'Descension',
loop: false,
has_geometry: false,
has_sound: false
},
image:
'https://peer-lb.decentraland.org/lambdas/collections/contents/urn:decentraland:matic:collections-v2:0xe42257bb4aada439179d736a64a736be0693a4ec:2/thumbnail',
Expand Down
4 changes: 0 additions & 4 deletions src/tests/ports/nfts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ describe('when fetching emotes', () => {
rarity: Rarity.COMMON,
bodyShapes: [BodyShape.MALE, BodyShape.FEMALE],
loop: false,
hasGeometry: false,
hasSound: false
},
},
createdAt: Date.now().toString(),
Expand Down Expand Up @@ -259,8 +257,6 @@ describe('when fetching nfts', () => {
rarity: Rarity.COMMON,
bodyShapes: [BodyShape.MALE, BodyShape.FEMALE],
loop: false,
hasGeometry: false,
hasSound: false
},
},
createdAt: Date.now().toString(),
Expand Down

0 comments on commit 35cf682

Please sign in to comment.