Estou tentando criar um Schema com o Graphcool em uma aplicação Angular. Os tipos são os seguintes:
type User @model {
id: ID! @isUnique
name: String!
email: String! @isUnique
password: String!
createdAt: DateTime!
updatedAt: DateTime!
chats: [Chat!]! @relation(name: "UsersOnChats")
messages: [Message!]! @relation(name: "MessagesOnUser")
photo: File @relation(name: "UserPhoto")
}
type Chat @model {
id: ID! @isUnique
title: String
isGroup: Boolean @defaultValue(value: "false")
createdAt: DateTime!
updatedAt: DateTime!
users: [User!]! @relation(name: "UsersOnChats")
messages: [Message!]! @relation(name: "MessagesOnChat")
photo: File @relation(name: "ChatPhoto")
}
type Message @model {
id: ID! @isUnique
text: String!
createdAt: DateTime!
sender: User! @relation(name: "MessagesOnUser")
chat: Chat! @relation(name: "MessagesOnChat")
}
type File @model {
id: ID! @isUnique
secret: String
name: String
size: Int
url: String
contentType: String
user: User @relation(name: "UserPhoto")
chat: Chat @relation(name: "ChatPhoto")
}
Ao rodar a aplicação e tentar executar o console para verificar minha mutation, recebo o seguinte erro:
ERROR Error: "GraphQL error: A unique constraint would be violated on User. Details: Field name = email"