hi ... how do I turn this here into a code in pri...
# orm-help
v
hi ... how do I turn this here into a code in prism.client ??? `return await this.prismaService.$queryRaw``
SELECT date(extract_created_at)
FROM payment_gateway_extracts
WHERE client_id = ${clientId}
GROUP BY date(extract_created_at)
ORDER BY date(extract_created_at) DESC
OFFSET ${skip}
LIMIT ${take}
``;`
👀 1
j
did you figure it out yet?
Copy code
const groupedDates = await prisma.paymentGateWayExtracts.groupBy({
  by: ['extract_created_at'],
  where: {
    clientId: ?
  },
  orderBy: {
    extract_created_at: 'desc',
  },
  take: ?,
  skip ?
})
👍 1
something like that maybe?
n
What jdkdev suggested looks perfect, can you try it out?
v
my question is in the extractCreatedAt attribute because I only need the date to group. If you use the timestamp, the result returned is different e.g with queryRaw
Copy code
[
  { date: '2022-07-21' },
  { date: '2022-07-20' },
  { date: '2022-07-11' },
  { date: '2022-07-10' }
]
e.g with code jdkdev
Copy code
[
  { date: 'Thu, 21 Jul 2022 16:54:21 GMT' },
  { date: 'Thu, 21 Jul 2022 16:49:08 GMT' },
  { date: 'Thu, 21 Jul 2022 16:18:06 GMT' },
  { date: 'Thu, 21 Jul 2022 14:07:38 GMT' }
]
even if you make a map and use with UTC the values are different
j
@Vinicius Carvalho yeah, not sure about that one, I don't know how Prisma would know to a manipulated form of the the values it has stored in there
...except that that seems like what queryRaw is for
v
I understand, in this case it has to be like this