Enitan
04/20/2019, 12:24 PMEnitan
04/20/2019, 12:24 PMEnitan
04/20/2019, 12:25 PMEnitan
04/20/2019, 12:25 PMenum Permission {
ADMIN
SUPERUSER
USER
}
type User @db(name: "users") {
id: ID! @id
firstName: String
lastName: String
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
phoneNumber: String
permissions: [Permission!]! @scalarList(strategy: RELATION)
emailVerified: Boolean! @default(value: false)
}
type LocalUser @db(name: "local_users") {
id: ID! @id
email: String! @unique
password: String!
resetToken: String
resetTokenExpiry: Float
user: User! @relation(link: INLINE)
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
ezeikel
04/20/2019, 1:02 PMprofilePicture
field on my User
type that is being returned as null even though I can see the data is there in the database. I have the following setup:
// datamodel.prisma
enum ContentType {
IMAGE
VIDEO
}
type Content @embedded {
type: ContentType! @default(value: IMAGE)
url: String
publicId: String
}
type User {
id: ID! @id
name: String
username: String! @unique
profilePicture: Content
website: String
bio: String
email: String! @unique
phoneNumber: Int
gender: Gender! @default(value: NOTSPECIFIED)
following: [User!]! @relation(name: "Following", link: INLINE)
followers: [User!]! @relation(name: "Followers", link: INLINE)
likes: [Like!]! @relation(name: "UserLikes")
comments: [Comment!]! @relation(name: "UserComments")
password: String!
resetToken: String
resetTokenExpiry: String
posts: [Post!]! @relation(name: "Posts")
verified: Boolean! @default(value: false)
permissions: [Permission!]! @default(value: USER)
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
// schema.graphql
type User {
id: ID!
name: String!
username: String!
profilePicture: Content
website: String
bio: String
email: String!
phoneNumber: Int
gender: Gender!
following: [User!]!
followers: [User!]!
verified: Boolean
posts: [Post!]!
likes: [Like!]!
comments: [Comment!]!
permissions: [Permission!]!
}
Like I said there is data in the database but when I run the below query in Playground I get `null`:
// query
{
user(id: "5c8e5fb424aa9a000767c6c0") {
profilePicture {
url
}
}
}
// response
{
"data": {
"user": {
"profilePicture": null
}
}
}
Any idea why?
ctx.prisma.user(({ id }), info);
doesn’t return profilePicture
even though the field exists in generated/prisma.graphql
CCBCodeMonkey
04/20/2019, 3:44 PMCCBCodeMonkey
04/20/2019, 3:46 PMCCBCodeMonkey
04/20/2019, 3:46 PMctx.prisma.user(({ id }), info);
you might have to add a fragment to get the sub fields for profilePictureCCBCodeMonkey
04/20/2019, 3:48 PMAlexandre Alencar Vilela
04/20/2019, 4:27 PMAlexandre Alencar Vilela
04/20/2019, 4:28 PMprisma generate
on version 1.31.1Alexandre Alencar Vilela
04/20/2019, 4:28 PMAlexandre Alencar Vilela
04/20/2019, 4:29 PMAlexandre Alencar Vilela
04/20/2019, 4:32 PMWallop
04/20/2019, 5:21 PMSyntax Error: Unexpected single quote character ('), did you mean to use a double quote (")?
GraphQL request (77:73)
76: entryLocked: Boolean @db(name: "entry_locked") @default(value: 0)
77: entryMetaData: Boolean! @db(name: "entry_meta_data") @default(value: b'0')
^
78: entryName: String @db(name: "entry_name")
alexis
04/20/2019, 7:12 PMAkrem
04/20/2019, 8:37 PMGints Polis
04/21/2019, 4:54 AMericsonluciano
04/21/2019, 6:11 AMYErii
04/21/2019, 7:41 AMmux
04/21/2019, 7:43 AMtype Article {
tags: [String!]!
}
mux
04/21/2019, 7:43 AMValid values for the strategy argument of '@scalarList' are: RELATION.
prilutskiy
04/21/2019, 12:55 PMentities({ where: { field: null } })
However, seems like TS client uses field?: string
instead of field?: string | null
Any workarounds for this?Rafael Gamboa
04/22/2019, 2:00 AMDanilo
04/22/2019, 2:12 AMRafael Gamboa
04/22/2019, 2:15 AMRafael Gamboa
04/22/2019, 2:26 AMLukas
04/22/2019, 2:27 AMAndrew
04/22/2019, 2:58 AMVikas Kundu
04/22/2019, 5:09 AMconst data = await context.prisma.analytics({
where: {ipUrl_contains: args.filter }
})
. Is there an issue with how i wrote where filter?