Hey Prisma community, just wondering if there is a...
# orm-help
m
Hey Prisma community, just wondering if there is a better solution for casting a id to BigInt in a Prisma operation.
return ctx.prisma.dataProvider.update({
data: {
name: args.data?.name,
description: args.data?.description,
},
where: {
id: BigInt(args.data.id), // <===== I have to do this to every Prisma operation where I work with IDS
},
});
Is there something like a way to extend models to accept id as string and cast it at model level with BigInt(id)? Thanks in advance!
prisma cool 1
💭 1
a
Hey motiondev, You could try writing a Prisma middleware to do this casting for you. You would have to check
params.args
for the
id
field and then cast it to a
BigInt
.
👍 1
m
Thanks Austin!