holaplex / indexer

Index Solana data using a Geyser plugin (downstream service cluster)
https://holaplex.com
GNU Affero General Public License v3.0
167 stars 39 forks source link

dao-marketplace/#45: collection stats #690

Closed austinmilt closed 2 years ago

austinmilt commented 2 years ago

This PR adds three new fields to the Collection object to support collection display in the marketplace.

Usage

{
  collectionsFeaturedByMarketCap(orderDirection:DESC, startDate:"2020-07-04T17:06:10Z", endDate: "2022-08-22T17:06:10Z", limit:5, offset: 0){
    floorPrice
    nftCount
    listedCount
    volumeTotal(startDate:"2022-07-04T17:06:10Z", endDate:"2022-08-22T17:06:10Z")
    holderCount
  }
}

Changes

austinmilt commented 2 years ago

Fine for speed writing the queries as sql strings but doing them through diesel dsl helps ensure further updates don't break the query as the type system validates the queries. I think all these queries are supported by diesel.

Great point! I was thinking I needed GROUP BY which diesel doesnt support, but since it's just a single collection, the GROUP BY shouldnt be necessary. I'll refactor