From f3cda1b3732fea7126ecd348fae6f326998bc8f4 Mon Sep 17 00:00:00 2001 From: Raman Shekhawat Date: Tue, 28 Nov 2023 16:19:56 +0530 Subject: [PATCH] add volume trade in top collection --- src/server-extension/resolvers/top_collections.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/server-extension/resolvers/top_collections.ts b/src/server-extension/resolvers/top_collections.ts index ef9216806..9c760aa84 100644 --- a/src/server-extension/resolvers/top_collections.ts +++ b/src/server-extension/resolvers/top_collections.ts @@ -64,6 +64,9 @@ export class CollectionRow { @Field({ nullable: true }) volume_change!: string + @Field({ nullable: true }) + volume_traded!: string + @Field({ nullable: false }) volume!: string @@ -95,7 +98,7 @@ export class TopCollectionResolver { const builder = manager .createQueryBuilder() .addSelect('collectionId AS id') - .addSelect('( SELECT COUNT(*)::int FROM collection_account a where a.collection_id = l.collectionId ) AS users') + .addSelect('(SELECT COUNT(*)::int FROM collection_account a where a.collection_id = l.collectionId ) AS users') .addSelect('metadata AS metadata') .addSelect('stats AS stats') .addSelect('volume_last_duration AS volume') @@ -103,6 +106,9 @@ export class TopCollectionResolver { .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' ) + .addSelect( + 'CASE WHEN volume_previous_duration != 0 THEN ROUND((volume_last_duration - volume_previous_duration), 2) ELSE volume_last_duration END AS volume_traded' + ) .from((qb) => { const inBuilder = qb .select('collection.id AS collectionId')