https://www.prisma.io/ logo
Join Slack
Powered by
# orm-help
  • e

    Entrepreneur3

    09/28/2018, 10:19 AM
    Guys, am I doing something wrong if I have to create my own Input types?(Serverside) in my schema.graphql?
    n
    • 2
    • 4
  • v

    Vinnie

    09/28/2018, 11:04 AM
    So, what’s the easiest way (if any) to integrate the whole schema of a prisma service into one’s own graphql server as is
  • v

    Vinnie

    09/28/2018, 11:05 AM
    some sort of “I plug it in and it’s exposed through my graphql server without requiring me to write wrapper resolvers for each of the things I want to expose”
    f
    h
    u
    • 4
    • 13
  • t

    tadejstanic

    09/28/2018, 11:52 AM
    Hey guys, just testing Prisma with postgres connector. I was curious how many SQL queries are executed and found that even for simple query like query getPost { post(postId: “cjmln88vt000z0a17d5vha3wq”){ title } } ‘’postgres’' DB logs two executed queries: postgres_1 | 2018-09-28 114541.804 GMT [34] LOG: execute <unnamed>: select postgres_1 | “default$default”.“Post”.“id”, postgres_1 | “default$default”.“Post”.“title”, postgres_1 | “default$default”.“Post”.“published” postgres_1 | from “default$default”.“Post” postgres_1 | where “default$default”.“Post”.“id” = $1 postgres_1 | 2018-09-28 114541.804 GMT [34] DETAIL: parameters: $1 = ‘cjmln88vt000z0a17d5vha3wq’ postgres_1 | 2018-09-28 114541.804 GMT [33] LOG: execute <unnamed>: select postgres_1 | “default$default”.“Post”.“id”, postgres_1 | “default$default”.“Post”.“title”, postgres_1 | “default$default”.“Post”.“published” postgres_1 | from “default$default”.“Post” postgres_1 | where “default$default”.“Post”.“id” = $1 postgres_1 | 2018-09-28 114541.804 GMT [33] DETAIL: parameters: $1 = ‘cjmln88vt000z0a17d5vha3wq’ Is this somehow expected or not?
    n
    • 2
    • 4
  • v

    Vinnie

    09/28/2018, 3:33 PM
    Shouldn’t prisma deploy tell me that the seeding has failed when it does indeed fail?
    n
    • 2
    • 5
  • v

    Vinnie

    09/28/2018, 5:06 PM
    Anyone knows if there’s a node module for parsing GraphQL SDL files?
  • z

    zonofthor

    09/28/2018, 5:33 PM
    Hi, I am trying to query by two conditions, is there something wrong with this syntax?
    Copy code
    return await ctx.db.query.entries(
        {
          where: {
            title_contains: searchText,
            stationOwner: {
              id: stationId
            }
          }
        },
        info
      )
  • y

    yantakus

    09/28/2018, 7:03 PM
    Hi guys. I’ve migrated from
    prisma-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.
  • w

    woz

    09/28/2018, 9:03 PM
    Anyone know if you get TLS/https with prisma cloud?
  • l

    Luke

    09/29/2018, 3:09 AM
    Hello
  • l

    Luke

    09/29/2018, 3:09 AM
    I am really struggling with querying nested relations and writing a resolver
    w
    • 2
    • 3
  • l

    Luke

    09/29/2018, 3:13 AM
    Copy code
    DATA 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"
          ]
        }
      ]
    }
    n
    • 2
    • 3
  • l

    Luke

    09/29/2018, 3:13 AM
    @w0wka91 ^
  • l

    Luke

    09/29/2018, 3:13 AM
    I’m not sure how to do what you suggested
  • l

    Luke

    09/29/2018, 3:14 AM
    The seed data looks like
    Copy code
    topic1: 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
      }
    h
    • 2
    • 1
  • l

    Luke

    09/29/2018, 3:29 AM
    products <--> topics is supposed to be many to many
  • l

    Luke

    09/29/2018, 3:29 AM
    maybe I modeled it wrong?
  • c

    cococoder

    09/29/2018, 8:08 AM
    Hi all
  • c

    cococoder

    09/29/2018, 8:10 AM
    I am new to .prisma.io, and graphql, I have previously used ROR and .net , my question is where do you put your business logic when using Graphql to replace a rest api?
    e
    • 2
    • 8
  • e

    Entrepreneur3

    09/29/2018, 8:33 AM
    What can I be doing wrong when using the Playground everything works fine but when using the same thing in code it doesn't More precise: Inside the GraphQL Playground I am able to Query a Group which has many user, I can query the users through the group so I get a response like so:
    Copy code
    "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:
    Copy code
    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 hint
  • t

    tfiwm

    09/29/2018, 1:57 PM
    Can someone help me with webhooks in prisma?
  • t

    tfiwm

    09/29/2018, 1:58 PM
    i have following setup:
    Copy code
    subscriptions:
      extendFilters:
        query: database/subscriptions/extendFilters.graphql
        webhook:
          url: <http://host.docker.internal:3000/on-get>
  • t

    tfiwm

    09/29/2018, 1:58 PM
    i have this url to test the webhook internally but it doesn’t get triggert…
  • t

    tfiwm

    09/29/2018, 1:58 PM
    i connected to the docker container of prisma and from there it works
  • u

    uyasarkocal

    09/29/2018, 2:31 PM
    Anyone working on a multi-database (multi-tenant) prisma server?
    l
    • 2
    • 1
  • m

    michal.tomsia

    09/29/2018, 3:25 PM
    Is it possible to order by computed field value?
  • y

    yantakus

    09/29/2018, 4:00 PM
    Hi guys. A question regarding migration from
    prisma-binding
    to
    prisma-client
    . In my
    schema.graphql
    file I had the following import:
    Copy code
    # 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.
  • m

    michal.tomsia

    09/29/2018, 5:18 PM
    Is it possible to test resolvers against real db?
  • j

    jackhallam

    09/29/2018, 6:04 PM
    Does anyone have any resources on production use of prisma (dev vs staging vs prod)? Can I use a managed database for staging and prod and a local database for the dev env?
  • j

    jackhallam

    09/29/2018, 6:06 PM
    Also I'm weary of commiting generated code to a repo, is there a best practice on how to gitignore the generated code and have the code get generated on checkout/compile time
1...126127128...637Latest