简体   繁体   中英

How do you update/create a null field in a new record with Prisma

I'm setting up permissions for user on a CRUD app, I want to give myself the permission of ADMIN but I can't seem to do it. I have set up my data type for a user as follows:

datamodel.graphql :

type User {
    id: ID! @unique
    name: String!
    email: String! @unique
    password: String!
    resetToken: String
    resetTokenExpiry: String
    permissions: [Permission]
}

schema.graphql :

type User {
    id: ID!
    name: String!
    email: String!
    permissions: [Permission!]!
}

When using my Prisma console, I can fill out all the fields except for permissions .

在此输入图像描述

And when trying to update an existing user's permissions, I can't seem to type anything in that field to update it. Is my schema wrong?

I believe permission is an enum(I am kinda recognising that schema from the Wes Bos Course).

You can add an item to an enum by using the three-dot menu > Add an Item

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM