Thomas Yankue
06/26/2022, 6:50 PMmodel Thanks {
target: string
reason: string
}
with target being a user's name. I'm wondering how I can find the top 10 users that have the most thanks? Thank you.Takeo Kusama
06/26/2022, 10:38 PMawait prisma.thanks.groupBy({
orderBy: {
_count: {
target: 'desc'
}
},
_count: {
target: true
},
by: ['target'],
take: 10
})
The result may be what you want.
Each element of that have count of thanks and userId as target.