【问题标题】:How do you update/create a null field in a new record with Prisma您如何使用 Prisma 在新记录中更新/创建空字段
【发布时间】:2019-08-19 18:54:53
【问题描述】:

我正在为 CRUD 应用程序上的用户设置权限,我想给自己ADMIN 的权限,但我似乎做不到。我已经为user 设置了我的数据类型,如下所示:

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!]!
}

当使用我的 Prisma 控制台时,我可以为permissions 填写所有字段除了

当尝试更新现有用户的权限时,我似乎无法在该字段中输入任何内容来更新它。我的架构错了吗?

【问题讨论】:

    标签: graphql prisma


    【解决方案1】:

    我相信许可是一个枚举(我有点认识到 Wes Bos 课程中的模式)。

    您可以使用三点菜单 > 添加项目来将项目添加到枚举中

    【讨论】:

      猜你喜欢
      • 2022-01-04
      • 2022-12-17
      • 2021-04-03
      • 2011-04-10
      • 1970-01-01
      • 1970-01-01
      • 2020-09-23
      • 2017-01-12
      • 1970-01-01
      相关资源
      最近更新 更多