https://www.prisma.io/ logo
Join Slack
Powered by
# prisma-whats-new
  • j

    johhansantana

    07/11/2017, 11:45 PM
    and does the authentication token has an expiration?
    i
    n
    • 3
    • 5
  • b

    bntzio

    07/12/2017, 12:26 AM
    Hello everyone! 👋 first time here, just exploring the graphql/graphcool world 😄
    n
    • 2
    • 1
  • a

    auser

    07/12/2017, 12:35 AM
    hey @bntzio
  • a

    auser

    07/12/2017, 12:35 AM
    they are usually pretty responsive, at least within a day (I guess it depends on your TZ, though)
  • b

    bntzio

    07/12/2017, 12:36 AM
    @auser thx! yeah i'm looking forward to play with graphcool and graphql on my next projects 🙂
    n
    • 2
    • 1
  • a

    auser

    07/12/2017, 12:37 AM
    I can attest to graphql (and graphcool). They will change your life
  • b

    bntzio

    07/12/2017, 12:38 AM
    yeah i've heard really good things, the thing is i don't really know what's the power behind this haha
  • b

    bntzio

    07/12/2017, 12:39 AM
    i'm creating a vuejs app but i want to store some data, i was thinking to go with rails or a mongodb db or firebase, then i remembered graphql and graphcool and i said: i'm going to give it a try
    👍🏻 1
  • b

    be4r

    07/12/2017, 4:35 AM
    I have a type of Card with a uniqueId, and a type Deck that has cards: [Cards]. However, when I try to add the same cards to the Deck, it only shows 1 card per id. How can I make it so I can have a list of the same ID's?
    a
    n
    j
    • 4
    • 22
  • m

    m.gu

    07/12/2017, 4:36 AM
    Hey guys! I'm wondering how to pipe the result of one mutation into the input of a second mutation, all in one query
    a
    d
    • 3
    • 3
  • m

    mika

    07/12/2017, 6:06 AM
    HI! Welcome! 🙂
  • m

    marcusstenbeck

    07/12/2017, 6:51 AM
    I have three models
    Student
    ,
    Enrollment
    and
    Class
    .
    Enrollment
    needs a
    Class
    and a
    Student
    . Assume that
    Class
    will always exist before both others. What’s the best approach to create a new
    Enrollment
    and attach it to a
    Student
    (and create that
    Student
    if it does not exist)?
    a
    d
    • 3
    • 12
  • f

    frankspin

    07/12/2017, 8:14 AM
    Hi Guys. How do I use subscriptions and respect the ordering of my GraphQL query?
    d
    m
    a
    • 4
    • 25
  • e

    eraldo

    07/12/2017, 10:25 AM
    Can I create local keys for offline operation with graph.cool? (Like firebase push keys)
    d
    • 2
    • 3
  • a

    auser

    07/12/2017, 11:03 AM
    So umm… how do we get logs for a request mutation function? It’s kinda difficult to debug the issue when I can’t see the logs of my function despite the error message telling me to check the logs
    d
    • 2
    • 3
  • l

    lewisblackwood

    07/12/2017, 11:16 AM
    hey 👋 could someone advise on a better way to write this permission query? I have a schema with models for a
    User
    ,
    Organisation
    and
    Team
    . An organisation has many users, and many teams. I want to verify that a user can only list the teams that relate to the organisation it is a member of. I've got the following:
    Copy code
    query ($user_id: ID!, $node_id: ID!) {
      SomeUserExists(filter: {
       id: $user_id
       organisation: {
         teams_some: {
          id: $node_id
        }
       }
      })
    }
    This works when trying to view another organisation's teams, with
    Insufficient permissions
    returned. However, if the other organisation doesn't have any teams yet, the query will return
    { allTeams: [] }
    . What's the best way to guard against this case? I'd still like to return
    Insufficient permissions
    even if the other organisation doesn't have any teams.
    n
    • 2
    • 4
  • l

    lewisblackwood

    07/12/2017, 11:16 AM
    The above has the same behaviour if I flip the query and look at
    SomeTeamExists
  • s

    samjbmason

    07/12/2017, 12:43 PM
    Does it make sense to create a relationship between
    User -> Files
    or just store the relevant data in the User model
    n
    • 2
    • 4
  • f

    frankspin

    07/12/2017, 5:09 PM
    Hi Guys. Did some digging in subscriptions today and came up with following code. Any thoughts?
    Copy code
    // Query runs to start the subscription
        const subQuery = gql`
          subscription {
            Client(filter: {
              mutation_in: [CREATED, UPDATED, DELETED]
            }) {
              mutation
              previousValues {
                id
              }
              node {
                id,
                name,
                createdAt
              }
            }
          }`;
        this.clientsSubscription = this.$apollo.queries.allClients.subscribeToMore({
          document: subQuery,
          // Mutate the previous result
          updateQuery: (previousResult, { subscriptionData }) => {
            const type = subscriptionData.data.Client.mutation;
            const node = subscriptionData.data.Client.node || subscriptionData.data.Client.previousValues;
            const state = previousResult.allClients;
            
            switch(type) {
              case 'CREATED':
                // add new node to current state
                this.allClients = [
                  ...state,
                  node,
                ]
                break;
              case 'UPDATED':
                // filter current state and update the selected item
                this.allClients = state.map( (item) => {
                  if(item.id !== node.id) {
                    return item;
                  }
                  return {
                    ...item,
                    ...node
                  }
                })
                break;
              case 'DELETED':
                // filter delete node from current state
                this.allClients = state.filter((item,) => item.id !== node.id );
                break;
              default:
                return state;
            }
    
          },
        });
      },
    n
    • 2
    • 1
  • m

    mike.johnson

    07/12/2017, 5:39 PM
    If a user node has relationships to other nodes (User -> Purchases) and the user actually has made purchases, can they be deleted as normal or do we have to remove the related data first?
  • m

    mike.johnson

    07/12/2017, 5:40 PM
    I'm having trouble deleting a user node in the dashboard, it says "are you sure?" I say yes, user disappears and then reappers a few seconds later
    a
    • 2
    • 8
  • a

    agartha

    07/12/2017, 7:28 PM
    Q: Does anyone have experience in using GraphQL with .NET (c#)?
    • 1
    • 1
  • k

    kmarquardsen

    07/12/2017, 7:39 PM
    Hey everyone, I submitted an issue to work on graphql-go support for howtographql here https://github.com/howtographql/howtographql/issues/91. I was hoping to get started looking at it this week. Would someone be able to assign the issue or is there a particular format you'd like to follow for contributing that I missed?
    🎉 2
    n
    • 2
    • 5
  • n

    nikolasburk

    07/12/2017, 7:44 PM
    invites are sent
    😀 2
  • m

    martin

    07/12/2017, 8:16 PM
    Might anyone know why using the File API works in the browser on the computer, but when used in Chrome or Safari on a mobile device results in an error:
    InvalidStateError (DOM Exception 11): The object is in an invalid state.
    https://github.com/graphcool-examples/react-graphql/blob/master/files-with-apollo/src/components/CreatePage.js#L48-L65
    • 1
    • 3
  • m

    martin

    07/12/2017, 10:30 PM
    Might anyone have an idea how to upload an image instead of a file? Per graphcool example: https://github.com/graphcool-examples/react-graphql/blob/master/files-with-apollo/src/components/CreatePage.js#L48-L65, this works on mobile and desktop/laptop:
    Copy code
    handleDrop(files) {
      let data = new FormData()
      data.append('data', person.avatar)
      fetch('<https://api.graph.cool/file/v1/___PROJECTID___>', {
        method: 'POST',
        body: data
      })
      [...]
    The following works on a desktop/laptop, but not on mobile. For mobile, an empty image is produced, with the error `InvalidStateError (DOM Exception 11): The object is in an invalid state.`:
    Copy code
    handleDrop(files) {
      this.setState({ file: file[0] })
    }
    
    // Image is then cropped, upon which handleCrop() is called
    
    handleCrop() {
      // This returns a HTMLCanvasElement, it can be made into a data URL or a blob, drawn on another canvas, or added to the DOM.
      const image = this.refs.avatar.getImageScaledToCanvas().toDataURL()
      // Custom DataURLtoBlob() function
      const blob = DataURLtoBlob(image)
      let file = new File([blob], 'avatar.png', {
        lastModified: new Date(),
        type: "image/png"
      })
      let data = new FormData()
      data.append('data', file)
      fetch('<https://api.graph.cool/file/v1/___PROJECTID___>', {
        method: 'POST',
        body: data
      })
      [...]
    }
    • 1
    • 1
  • p

    pcooney10

    07/12/2017, 11:25 PM
    Hi, does anyone have a solution for dynamically changing a query name in
    react-apollo
    ?
    graphcool 1
    m
    m
    • 3
    • 7
  • p

    pcooney10

    07/12/2017, 11:26 PM
    They have an example in their [docs](http://dev.apollodata.com/react/queries.html#graphql-options) for dynamically changing variables, but I am wondering if anyone has a solution for changing the query (
    CurrentUserForLayout
    in this instance):
    Copy code
    // The caller could do something like:
    <ProfileWithData avatarSize={300} />
    
    // And our HOC could look like:
    const ProfileWithData = graphql(CurrentUserForLayout, {
      options: ({ avatarSize }) => ({ variables: { avatarSize } }),
    })(Profile);
  • p

    pksunkara

    07/12/2017, 11:57 PM
    @nikolasburk Hey, Why is graph cool using long directive names like
    @defaultValue
    instead of shorter ones?
    @default
  • j

    jt9001

    07/13/2017, 1:38 AM
    Is there a good way to do something if a mutation request (via graphql-request) was successful - ie, no error found. Change a boolean in .err()?
    d
    • 2
    • 1
1...265266267...637Latest