Hi team!, I am new with prisma, so I am looking fo...
# orm-help
c
Hi team!, I am new with prisma, so I am looking for extend model class, so I have a User model and I want to extend to implement a function
getLastName()
or
getfirstName()
so when I
const user = await prisma.User.FindOne({})
then can do:
user.getLastName()
its possible that ?
n
Hey Cristian, welcome to our community 😄 here’s a guide that should help you accomplish this: https://www.prisma.io/docs/concepts/components/prisma-client/custom-models
c
thank you! I am going to read it 🙂
🙌 1
Hi @nikolasburk I solved my problem with your recommendation, just last Q: can override
delete()
or
deleteMany()
functions? I need to introduce some restrictions to avoid deletion, thanks for you help
n
I don’t think you can override them but you it sounds like Prisma Client’’s middleware might be able to help you with this use case: https://www.prisma.io/docs/concepts/components/prisma-client/middleware