Skip to content

Commit

Permalink
feat: [NFTIO-2755] add order by created_at to trending collections (#…
Browse files Browse the repository at this point in the history
…1370)

* NFTIO-2755 add orderBy createdAt to trending collections

* Update src/server-extension/resolvers/top_collections.ts

Yeah, I wasn't sure here

Co-authored-by: Raman Shekhawat <[email protected]>

* Update src/server-extension/resolvers/top_collections.ts

* NFTIO-2755

* NFTIO-2755

---------

Co-authored-by: Raman Shekhawat <[email protected]>
  • Loading branch information
pawell67 and justraman authored Oct 31, 2024
1 parent 6abe032 commit 0c03326
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/server-extension/resolvers/top_collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const timeFrameMap = {
}

enum TopCollectionOrderBy {
CREATED_AT = 'created_at',
VOLUME = 'volume',
SALES = 'sales',
VOLUME_CHANGE = 'volume_change',
Expand Down Expand Up @@ -65,7 +66,10 @@ export class CollectionRow {
category!: string

@Field({ nullable: true })
verifiedAt!: string
verified_at!: string

@Field({ nullable: false })
created_at!: string

@Field(() => Json, { nullable: true })
stats!: typeof JSON
Expand Down Expand Up @@ -138,7 +142,8 @@ export class TopCollectionResolver {
.addSelect('NULLIF(MAX(volume_last_duration) OVER(), 0) AS max_volume')
.addSelect('NULLIF(MAX(sales_last_duration) OVER(), 0) AS max_sales')
.addSelect('sales_last_duration AS sales')
.addSelect('verified_at::text AS "verifiedAt"')
.addSelect('verified_at::text AS "verified_at"')
.addSelect('created_at::text AS "created_at"')
.addSelect('category AS category')
.addSelect(
'CASE WHEN volume_previous_duration != 0 THEN ROUND((volume_last_duration - volume_previous_duration) * 100 / volume_previous_duration, 2) ELSE null END AS volume_change'
Expand All @@ -156,6 +161,7 @@ export class TopCollectionResolver {
.addSelect('collection.metadata AS metadata')
.addSelect('collection.stats AS stats')
.addSelect('collection.verified_at AS verified_at')
.addSelect('collection.created_at AS created_at')
.addSelect('collection.category AS category')
if (timeFrame === Timeframe.ALL) {
inBuilder
Expand Down

0 comments on commit 0c03326

Please sign in to comment.