Britt Danzer
11/24/2021, 7:13 AMconst data = await prisma.customer.groupBy({
by: ['dueDate'],
where: {
status: {
in: 'PAID',
},
merchantId: 1
},
_sum: {
balancePaid: true
},
orderBy: {
dueDate: 'asc'
}
})
And this is a sample of the return:
[
{
"dueDate": "2021-11-01T06:30:26.387Z",
"_sum": {
"balancePaid": 27337.94
}
},
{
"dueDate": "2021-11-01T09:26:17.966Z",
"_sum": {
"balancePaid": 4320.82
}
},
{
"dueDate": "2021-11-01T09:43:23.207Z",
"_sum": {
"balancePaid": 50684.73
}
},
{
"dueDate": "2021-11-01T10:10:48.072Z",
"_sum": {
"balancePaid": 65238.76
}
},
Is there a way to trunc the dates prisma without having to do a raw query? Or is that not possible? I would like to be able to group by date without a specific time getting in the way.Ryan
11/24/2021, 7:15 AM