Entrepreneur3
09/28/2018, 10:19 AMVinnie
09/28/2018, 11:04 AMVinnie
09/28/2018, 11:05 AMtadejstanic
09/28/2018, 11:52 AMVinnie
09/28/2018, 3:33 PMVinnie
09/28/2018, 5:06 PMzonofthor
09/28/2018, 5:33 PMreturn await ctx.db.query.entries(
{
where: {
title_contains: searchText,
stationOwner: {
id: stationId
}
}
},
info
)
yantakus
09/28/2018, 7:03 PMprisma-binding
to prisma-client
and I’d like to say it’s amazing! But I have a question. In my schema.graphql
file I had the following import: # import Video, Topic, Tag, Complexity, TopicCreateManyInput, TagCreateManyInput from "./generated/prisma.graphql"
but now this file is missing. How do I import these types now? I have index.ts
and prisma-schema.ts
in generated
directory.woz
09/28/2018, 9:03 PMLuke
09/29/2018, 3:09 AMLuke
09/29/2018, 3:09 AMLuke
09/29/2018, 3:13 AMDATA MODEL
type Query {
products(first: Int): [Product!]!
}
type Product {
id: ID!
name: String!
slug: String!
imageUrl: String!
description: String!
votesCount: Int!
commentsCount: Int!
topics: [Topic!]!
}
type Topic {
id: ID!
name: String!
slug: String!
}
QUERY
query {
products {
id
slug
description
topics {
name
}
}
}
RESOLVER
products(root, args, context, info) {
return context.prisma.products({ first: args.first });
},
RETURNED DATA
{
"data": null,
"errors": [
{
"message": "Cannot return null for non-nullable field Product.topics.",
"locations": [
{
"line": 6,
"column": 5
}
],
"path": [
"products",
0,
"topics"
]
}
]
}
Luke
09/29/2018, 3:13 AMLuke
09/29/2018, 3:13 AMLuke
09/29/2018, 3:14 AMtopic1: createTopic(data: { name: "Productivity", slug: "productivity" }) {
id
}
topic2: createTopic(data: { name: "Tech", slug: "tech" }) {
id
}
topic3: createTopic(data: { name: "Games", slug: "games" }) {
id
}
topic4: createTopic(data: { name: "Books", slug: "books" }) {
id
}
topic5: createTopic(data: { name: "Design Tools", slug: "design-tools" }) {
id
}
product1: createProduct(
data: {
name: "Caramella"
slug: "caramella"
imageUrl: "<https://ph-files.imgix.net/2363eea3-5840-4ff2-b419-01ecd59321bc?auto=format&auto=compress&codec=mozjpeg&cs=strip&w=80&h=80&fit=crop&dpr=2>"
description: "A clean, modern blogging platform without the fuss"
votesCount: 473
commentsCount: 28
topics: { connect: [{ slug: "productivity" }, { slug: "tech" }] }
}
) {
id
}
product2: createProduct(
data: {
name: "Cover Letter Generator"
slug: "cover-letter-generator"
imageUrl: "<https://ph-files.imgix.net/89662bd4-1011-44f7-871b-6f543e9d75f0?auto=format&auto=compress&codec=mozjpeg&cs=strip&w=80&h=80&fit=crop&dpr=2>"
description: "Quickly generate cover letters with minimum details"
votesCount: 313
commentsCount: 6
topics: { connect: { slug: "productivity" } }
}
) {
id
}
Luke
09/29/2018, 3:29 AMLuke
09/29/2018, 3:29 AMcococoder
09/29/2018, 8:08 AMcococoder
09/29/2018, 8:10 AMEntrepreneur3
09/29/2018, 8:33 AM"data": {
"groups": [
{
"id": "cjmn4jupo02qy0a41c1qswkaj",
"name": "Group1",
"user": {
"id": "cjmn4jups02qz0a41a0ukpm32",
"email": "<mailto:derboss@live.de|derboss@live.de>",
"group": {
"id": "cjmn4jupo02qy0a41c1qswkaj"
}
}
},
That works fine. But if I want to do in code something like this:
const user = await context.prisma.user({
email: args.email
})
console.log(`${user.group}`)
Then I get undefined returned. What is it that I can be doing wrong to reproduce this? Appreciate any hinttfiwm
09/29/2018, 1:57 PMtfiwm
09/29/2018, 1:58 PMsubscriptions:
extendFilters:
query: database/subscriptions/extendFilters.graphql
webhook:
url: <http://host.docker.internal:3000/on-get>
tfiwm
09/29/2018, 1:58 PMtfiwm
09/29/2018, 1:58 PMuyasarkocal
09/29/2018, 2:31 PMmichal.tomsia
09/29/2018, 3:25 PMyantakus
09/29/2018, 4:00 PMprisma-binding
to prisma-client
. In my schema.graphql
file I had the following import:
# import Video, Topic, Tag, Complexity, TopicCreateManyInput, TagCreateManyInput from "./generated/prisma.graphql"
But after migration to prisma-client
there’s no generated/prisma.graphql
file. How do I import these types now? I have index.ts
and prisma-schema.ts
in generated
directory. I’m not sure I can import ts types into .graphql
file.michal.tomsia
09/29/2018, 5:18 PMjackhallam
09/29/2018, 6:04 PMjackhallam
09/29/2018, 6:06 PM