-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Holder Entity for collection activity #33
Conversation
cc @vikiival |
allows for this query - which is what we need in collection activity: query MyQuery {
collectionEntities(limit: 3) {
name
holders(limit:3, orderBy: nftCount_DESC where: {nftCount_gt: 0}) {
holder
lastActivity
nftCount
totalBought
totalSold
nfts(limit: 2) {
name
}
}
}
}
result: {
"data": {
"collectionEntities": [
{
"name": "5 year anniversary at Parity",
"holders": [
{
"holder": "FsrKTLkQFD1fE5aRn65uPeuSUm54um3oj7J35Cbki3dVqM9",
"lastActivity": "2021-10-20T18:58:00.242000Z",
"nftCount": 1,
"totalBought": "0",
"totalSold": "0",
"nfts": [
{
"name": "Marek Kotewicz, 5 years anniversary at Parity"
}
]
},
{
"holder": "FcxNWVy5RESDsErjwyZmPCW6Z8Y3fbfLzmou34YZTrbcraL",
"lastActivity": "2021-10-28T16:28:12.253000Z",
"nftCount": 1,
"totalBought": "0",
"totalSold": "0",
"nfts": [
{
"name": "Gavin Wood, 5 years anniversary at Parity"
}
]
},
{
"holder": "E3J2HzvLxMpkJpSiQFwAq4y3dXM9KNYPb82YqmC1j1x2Fwk",
"lastActivity": "2021-10-20T18:58:00.242000Z",
"nftCount": 1,
"totalBought": "0",
"totalSold": "0",
"nfts": [
{
"name": "Daniel Greeff, 5 years anniversary at Parity"
}
]
}
]
},
{
"name": null,
"holders": []
},
{
"name": "Gav's NFTs",
"holders": [
{
"holder": "DBHNS3re4bsjUVNtrLqp12ZctCeTA4GnKZWgPLvVVzCC9Zc",
"lastActivity": "2021-09-29T10:53:42.256000Z",
"nftCount": 1,
"totalBought": "0",
"totalSold": "0",
"nfts": []
},
{
"holder": "GbqtkjvQKWsgovW69Ga4WBnJxH3fSv3XkP7yLWC33j4yaQB",
"lastActivity": "2021-10-02T09:46:06.483000Z",
"nftCount": 1,
"totalBought": "0",
"totalSold": "0",
"nfts": [
{
"name": "Mamacita"
}
]
}
]
}
]
}
}
|
|
||
async handleMint({ ownerId, collection, timestamp }: HandleMintParams): Promise<HA> { | ||
const holderActivity = await this.getOrCreateHolder(ownerId, collection, timestamp) | ||
await this.store.update(HA, { id: holderActivity.id }, { nftCount: 1, lastActivity: timestamp }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for Viki
Hello sir, I made a resolver for that, calculation time is about ~46 on the prod DB |
Ok |
No but I won't overfetch the resolver. |
so... I understand you prefer resolver approach over new entities? |
I prefer simple (working) things first. This is honestly a bit over-engineered and there other things to be solved on the entity level like ... |
No description provided.