Michał Chmura
06/03/2019, 1:20 PMPrisma.query.users()
call? e.g. if I do await Prisma.query.users(data, `{ id email tasks { id } }`)
but it's unmaintainable for bigger models:
is there GraphQLResolveInfo
option to resolve all?Craig
06/03/2019, 1:25 PMMichał Chmura
06/03/2019, 1:56 PMMichał Chmura
06/03/2019, 1:56 PMmeta
statistics (e.g. numberOfTasks
)Michał Chmura
06/03/2019, 1:57 PMtasks
from user
and count total themselves but I'd like to expose some data for dashboard purposesevan
06/03/2019, 2:01 PMFragment Tasks on User { ... }
so it is reusable, and a little less verbose when you want that dataCraig
06/03/2019, 2:07 PMnumberOfTasks
property and make the resolver something like prisma.taskConnection({ where: { user: { id: parent.id } } }).aggregate().count()
Michał Chmura
06/03/2019, 2:14 PMMichał Chmura
06/03/2019, 2:15 PMMichał Chmura
06/03/2019, 2:15 PMCraig
06/03/2019, 2:17 PMknex
. Eg:
other props...,
averageSentiment(parent) {
return db.survey('average_provider_sentiment').select('avg')
.where('id', parent.id)
.then(data => (data.length > 0 ? data[0].avg : null))
.catch(err => new Error(err))
},
Craig
06/03/2019, 2:17 PMCraig
06/03/2019, 2:18 PMMichał Chmura
06/03/2019, 2:33 PMMichał Chmura
06/03/2019, 2:34 PMMichał Chmura
06/03/2019, 2:35 PMknex
seems like an interesting solution, thanks for proposing thatCraig
06/03/2019, 2:36 PM