Skip to content

Commit

Permalink
fix: Not existing columns in ethereum network (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyaiox authored Feb 13, 2024
1 parent f5f8800 commit 528dae8
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/ports/catalog/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,12 @@ export const getEmotePlayModeWhere = (filters: CatalogFilters) => {
: SQL`metadata_emote.loop = ${filters.emotePlayMode === EmotePlayMode.LOOP}`
}

export const getEmoteHasGeometryWhere = () => {
return SQL`metadata_emote.has_geometry = true`
export const getEmoteHasGeometryWhere = (filters: CatalogFilters) => {
return filters.network === Network.MATIC ? SQL`metadata_emote.has_geometry = true` : undefined
}

export const getEmoteHasSoundWhere = () => {
return SQL`metadata_emote.has_sound = true`
export const getEmoteHasSoundWhere = (filters: CatalogFilters) => {
return filters.network === Network.MATIC ? SQL`metadata_emote.has_sound = true` : undefined
}

export const getSearchWhere = (filters: CatalogFilters) => {
Expand Down Expand Up @@ -377,8 +377,8 @@ export const getCollectionsQueryWhere = (filters: CatalogFilters) => {
filters.wearableGenders?.length ? getWearableGenderWhere(filters) : undefined,
filters.emoteCategory ? getEmoteCategoryWhere(filters) : undefined,
filters.emotePlayMode?.length ? getEmotePlayModeWhere(filters) : undefined,
filters.emoteHasGeometry ? getEmoteHasGeometryWhere() : undefined,
filters.emoteHasSound ? getEmoteHasSoundWhere() : undefined,
filters.emoteHasGeometry ? getEmoteHasGeometryWhere(filters) : undefined,
filters.emoteHasSound ? getEmoteHasSoundWhere(filters) : undefined,
filters.contractAddresses?.length ? getContractAddressWhere(filters) : undefined,
filters.minPrice ? getMinPriceWhere(filters) : undefined,
filters.maxPrice ? getMaxPriceWhere(filters) : undefined,
Expand Down Expand Up @@ -513,10 +513,18 @@ const addMetadataJoins = (schemaVersion: string, filters: CatalogQueryFilters) =
emote.category,
emote.body_shapes,
emote.name,
emote.loop,
emote.has_geometry,
emote.has_sound
emote.loop`
.append(
filters.network === Network.MATIC
? SQL` ,
emote.has_geometry,
emote.has_sound`
: ''
)
.append(
SQL`
FROM `
)
.append(schemaVersion)
.append('.emote AS emote JOIN ')
.append(schemaVersion).append(SQL`.metadata AS metadata ON metadata.emote = emote.id
Expand Down

0 comments on commit 528dae8

Please sign in to comment.