prisma / prisma-admin-feedback

Feedback for Prisma Admin (currently in invite-only preview)
6 stars 1 forks source link

Encrypt database values #146

Open jnhooper opened 5 years ago

jnhooper commented 5 years ago

I love the prisma admin tool so far but one thing i'm trying to figure out is how to encrypt certain model attributes from the admin panel. Here is my datamodel.prisma

type User {
  id: ID! @id
  email: String @unique
  password: String!
  name: String!
  role: Role! @default(value: USER)
  posts: [Post]!
}

as you can see a user requires a password, but i dont want this password to be stored in plain text. I have resolvers setup so that when a user is created from the my api it encrypts the password using bcrypt. I'm wondering if it would be possible to have prisma deploy or generate hook into these resolvers so that a user created from the admin panel would have a usable password? or do you recommend that users have dummy non functioning passwords when created through the admin and then reset their password or something later?