#Exclude returning password from Prisma model

1 messages · Page 1 of 1 (latest)

unique nacelle
#

Is there an easy way to exclude removing a password from a Prisma model? My app isn't huge so it's quite productive for me to share the data/application layer models. E.G I'm just using the created Prisma models rather than custom DTO's. Is there an easy way to exclude things, or otherwise are there any library/gens that can just automate the creation of my DTO's/application models from Prisma models?

earnest pumice
#

i would't suggest using a prisma model as a dto
as this is exactly why and you are not able to add decorators either such as @IsString()
limiting your options on validation
i strongly suggest to create a dto

but if you insist of doing this
create a class that and extends it with the OmitType with the target being the prisma model and omit then remove the password field like that
this would be the closest thing i would say