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

    John O'Sullivan

    11/16/2018, 8:39 PM
    Hi all -- I'm trying to write my own JWTs for Prisma auth. The docs say where they get the encoding secret from, but they don't say what the actual encoded body is. Does anybody know?
  • j

    John O'Sullivan

    11/16/2018, 8:59 PM
    Just in case anyone else comes across this, I dug through the source and found that the body just describes the expiration timing: https://github.com/prisma/prisma/blob/master/server/libs/auth/src/main/scala/com/prisma/auth/Auth.scala#L46 It's a JSON w/ keys
    exp
    and
    nbf
    , which correspond to the expiration time in seconds and the current time ("not before") in seconds.
  • r

    rwatts3

    11/16/2018, 10:03 PM
    how to avoid inserting duplicates based on an existing field match
  • r

    rwatts3

    11/16/2018, 10:04 PM
    for example, I need to bulk insert a list of items where the item.title may already exist, I want to omit inserting an item if that title is found
  • t

    tsdexter

    11/16/2018, 10:06 PM
    Can I host a prisma backed app simpler than this? App has different subdomains for each customer, the same app server responds to them all but switches out the
    prisma-client
    (yoga server) that
    apollo-client
    connects to depending on the subdomain, each yoga server is a separate running instantiation of the same
    yoga
    codebase but points to a different
    prisma-service
    on the one
    prisma-server
    (is there a way to have one yoga server point to different endpoints like graphcool used to do via
    /api/serviceId
    ?)… The
    public
    app engine service uses
    nginx
    and
    s6
    to manage running the front end app and many yoga servers on the same app engine… This diagram doesn’t even include the google cloud functions used for subscriptions or the google cloud storage used for the File API - what is the simpler way? I’m a front end developer, hence why I chose graph.cool originally… I’m totally open to suggestions for a proper, more scalable set up… most of the tutorials tell you how to get your prisma and yoga servers up but then leave it at that and don’t explain dealing with multiple endpoints, multiple apps, etc..
    a
    • 2
    • 1
  • v

    vdiaz1130

    11/16/2018, 11:46 PM
    hi! Anyone familiar with apollo mailgun integration? Would like to handle auth (email/pass, email verify, social logins). Any resources I can leverage that I can be directed to?
  • k

    kyle.james

    11/17/2018, 12:12 AM
    hello! is there a way to configure the apollo graphql playground such that all of its requests are GET requests with the query/variables serialized into the URL query params?
  • k

    kyle.james

    11/17/2018, 12:13 AM
    (it appears to default to POST requests with a request body)
  • t

    tsdexter

    11/17/2018, 12:52 AM
    is there a way to connect two required fields in a nested mutation, for example,
    Role
    requires a list of
    [User!]!
    and a single `Customer`… When I signup a user I want to create the new
    Customer
    , it’s first
    User
    and an admin
    Role
    for that
    Customer
    and
    User
    - how would I do this?
    Copy code
    const user = await ctx.db.createUser({
          firstname: firstname || undefined,
          lastname: lastname || undefined,
          email,
          password: hashedPassword,
          emailConfirmToken,
          emailConfirmed: false,
          inviteAccepted: true,
          customer: {
            create: {
              name: customerName
            }
          },
          role: {
            create: {
              name: "Admin",
              permissions: {
                connect: {
                  allow: "SUDO"
                }
              }
            }
          }
        });
    this creates the role on the user, but I also want the
    Role
    to be associated to the
    Customer
    created above it…? Do I have to create the
    Role
    in a separate request and then just connect it in the
    customer
    and
    role
    fields?
    h
    • 2
    • 3
  • h

    hinsxd

    11/17/2018, 9:58 AM
    Hi everyone. If I want to perform raw SQL query via prisma client, should I use
    prisma.request
    (or
    $request
    ) and
    Copy code
    mutation {
      executeRaw(
        query: "..."
      )
    }
    ?
    👍 1
  • d

    Dennis

    11/17/2018, 9:58 AM
    Is there any Chance to get access to Prisma Admin before it's official launch 🤓🤓?
    r
    • 2
    • 1
  • h

    hinsxd

    11/17/2018, 10:37 AM
    However I cant find the mentioned
    request
    or
    $request
    exposed in prisma client. Any clue?
  • h

    hinsxd

    11/17/2018, 10:54 AM
    I found out that the Graphql prisma access changes to
    prisma.$graphql
    , yet there are some problems in reading query string.
  • h

    hinsxd

    11/17/2018, 11:01 AM
    Updates: the following seems to be working
    Copy code
    await prisma.$graphql(`
        mutation {
            executeRaw(query: "SELECT * FROM default$default.\\"User\\" LIMIT 10")
        }
    `)
    I must not add
    /* GraphQL */
    in front of the query string, otherwise prettier will eliminate the double backslashes, because the prisma server needs a single backslash to identify quotes inside
    executeRaw
  • h

    hinsxd

    11/17/2018, 11:02 AM
    Thats kinda troublesome when you need to pass a string with escape characters through two layers of server 🤣
  • h

    hinsxd

    11/17/2018, 11:09 AM
    AND, after all the searchings on google, I found out that the effective way to perform case insensitive search is to create a lower-case slug when creating an object. Then I could easily use prisma-client’s
    contains
    to do what I want! Just for you guys’ reference if anyone is trying something like me.
  • a

    Alex

    11/17/2018, 3:40 PM
    is it possible to update the datamodel as a hot deployment?
  • b

    bjulia

    11/17/2018, 5:12 PM
    Hi everyone, I’m a beginner on graphcool and i would like to know if there is a way to use a nodejs dependency which required nodejs >= 8 ?
    t
    • 2
    • 1
  • m

    michal.tomsia

    11/17/2018, 5:41 PM
    Hello everyone. I saw that some of you have faced such issue
    Variable '$data' cannot be non input type
    but did someone find out what's going on and how to fix it? I see the error when running the following mutation:
    Copy code
    return ctx.prisma.updateManyProductVariants({
          where: { product: { id: productId } },
          data: { deletedAt: new Date().toISOString() }
        });
    It's working fine in playground e.g.
    Copy code
    mutation {
      updateManyProductVariants(where:{
        product:{
          id:"cjolpj9ez01zq0a926dvb0v2t"
        }
      }, data: {
        deletedAt: "2018-11-17T17:20:13.998Z",
      }) {
        count
      }
    }
    • 1
    • 1
  • c

    cfree

    11/17/2018, 6:09 PM
    Hello, new to the channel and Prisma - wondering how to do filtering with Enums. (I don't see a lot of documentation on using Enums for roles and permissions, so if there's a better way, I'd love to hear about it). Basically I'm trying to write a query that pulls all users that have two different enum statuses. My schema:
    Copy code
    type Query {
      candidates(role: Role!, accountStatus: AccountStatus!): [User]!
    }
    
    type User {
      id: ID!
      firstName: String!
      lastName: String!
      roles: [Role!]!
      accountStatus: AccountStatus!
    }
    My resolver:
    Copy code
    candidates(parent, args, ctx, info) {
        return ctx.db.query.users({
          where: {
            role: args.role,
            accountStatus: args.accountStatus,
          },
        }, info);
      },
    My query:
    Copy code
    query CANDIDATES_QUERY {
      candidates(role: FULL_MEMBER, accountStatus: ACTIVE) {
        id
        firstName
        lastName
      }
    }
    h
    • 2
    • 18
  • v

    vdiaz1130

    11/17/2018, 7:24 PM
    Hello. When using
    graphqlgen
    with prisma do we still run
    prisma generate
    ?
    r
    • 2
    • 2
  • v

    vdiaz1130

    11/17/2018, 8:09 PM
    Seems like Prisma generated is incompatible with graphqlgen generated...
    Copy code
    Type 'import(".../src/generated/graphqlgen").MutationResolvers.UserUpdateInput' is not assignable to 
    Type 'import(".../src/generated/prisma-client/index").UserUpdateInput'.
    Types of property 'name' are incompatible.
    Type 'string | null' is not assignable to type 'string | undefined'.
    Type 'null' is not assignable to type 'string | undefined'. [2322]
    Any ideas?
    w
    • 2
    • 2
  • v

    vdiaz1130

    11/17/2018, 8:31 PM
    This is causing the above error. I think I'm doing something wrong but cant pin-point it.
  • v

    vdiaz1130

    11/17/2018, 8:31 PM
    any help is greatly appreciated
  • a

    Andres Montoya

    11/17/2018, 10:32 PM
    Hola a todos! Hoy les traigo una herramienta la cual permite crear una noticia falsa que se hace pasar como una aplicación de Facebook y capturar los datos ingresados por el usuario. Esta tiene como intención generar consciencia de lo fácil que es engañar mediante el uso de un tipo de ingeniería social, caracterizado por intentar adquirir información confidencial de forma fraudulenta (como puede ser una contraseña, información detallada sobre tarjetas de crédito u otra información bancaria). El cibercriminal, conocido como phisher, se hace pasar por una persona o empresa de confianza en una aparente comunicación oficial electrónica, por lo común un correo electrónico, o algún sistema de mensajería instantánea o incluso utilizando también llamadas telefónicas. Proyecto: https://github.com/MontoyaAndres/FacebookNews Vídeo:

    https://www.youtube.com/watch?v=Ep-AofXdyT0▾

  • r

    Ramin B

    11/18/2018, 12:04 AM
    Say I have a User model mapped to an actual DB table. But I want "extend" that user by pulling some extra meta data from an external API. Are there any examples of this online to look at? I tried adding my custom/extra fields to my graphql.schema file and got some resolver functions auto generated to process those fields, but not sure how to write the code in an optimized way so that I am not hitting the API for each and every field. Is there a better pattern to do this?
    • 1
    • 1
  • j

    jess

    11/18/2018, 6:07 AM
    how to connect existing database from mysql
    👍 1
  • r

    Raeesaa

    11/18/2018, 8:12 AM
    Hi, does anyone have idea whether
    executeRaw
    mutations support transactions?
    s
    • 2
    • 5
  • b

    BaniNaveen

    11/18/2018, 11:56 AM
    Hello Guys recently I encounter some bug which is effect my project. I have initialize prisma@1.20.7. Which is latest version. After i update my datamodel and deploy with prisma deploy It does not update prisma.graphql with my latest datamodel. Which is very disappointing. But When ever I use prisma@1.14.2 It working perfect. Please go through my concern and fix this.
    m
    s
    n
    • 4
    • 5
  • s

    samba

    11/18/2018, 5:58 PM
    is anyone really using this prisma setup(https://www.prisma.io/docs/1.20/get-started/01-setting-up-prisma-existing-database-TYPESCRIPT-t003/) … its full of bugs. and is incomplete documentation.
    Copy code
    TSError: ⨯ Unable to compile TypeScript:
    generated/prisma-client/index.ts(348,72): error TS2345: Argument of type '{ typeDefs: string; endpoint: string; }' is not assignable to parameter of type '{ typeDefs: string; endpoint: string; secret?: string; models: Model[]; }'.
      Property 'models' is missing in type '{ typeDefs: string; endpoint: string; }'.
1...159160161...637Latest