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

    james.hatfield

    04/25/2017, 9:44 PM
    hey @artyom thanks. will be lurking for a while. don’t mind me, will speak up later.
    a
    • 2
    • 1
  • m

    mannigan

    04/25/2017, 10:55 PM
    quick question, is there a limit on the number of "* to many" relationships? for example if i have a user tied to crazy amounts of files
    n
    h
    • 3
    • 12
  • m

    mannigan

    04/26/2017, 12:18 AM
    i havent started playing around with mutation callbacks yet, but... (deep breath) i think im ready. First question: is there a way to extract the logged in user from the payload?
    n
    • 2
    • 7
  • j

    jeffo

    04/26/2017, 4:14 AM
    After having setup Algolia to index child objects, i tried to re-create my search index, all all of a sudden my child object is always going over to Algolia as 'null'. When i look at the Algolia logs it says it's coming in null. Are there any tricks to indexing a related object in Algolia? I have a simple 'product' with related 'brand' and although this works fine in graph.cool playground it doesn't work in Algolia (the Brand object is always just 'null' with no child id/name). I have tried variations on aliasing, but can't seem to get this to work - any hints anyone can give me? thanks! { node { id name category price brand { id name } } }
    w
    n
    • 3
    • 7
  • i

    ilja

    04/26/2017, 5:27 AM
    Is it possible to achieve game item purchase validation solely using permission queries? i.e. User submits payload containing
    gameItemID
    ,
    userID
    ,
    userBalanceAfterPurchase
    . Can query based on this data perform checks like: 1) Item that is being purchased exists 2)
    userBalanceAfterPurchase
    is result of subtracting game item price from current user balance
    userBalanceAfterPurchase
    this bit is my idea of updating users balance without the need of server less function. At the moment I can’t imagine how such query would look and even if it is possible to do something like this?
    s
    • 2
    • 1
  • s

    sdubois

    04/26/2017, 5:35 AM
    FYI I copy-pasted the permission example from the blog post "Only the author or admins can delete a Post" but there seems to be some invalid GraphQL in there, e.g
    someUserExists
    should be
    SomeUserExists
    , and also the combination of
    AND
    and
    OR
    isn't recognized (maybe a misplacing of brackets?)
  • s

    sdubois

    04/26/2017, 5:37 AM
    also the error message gets truncated and can't be read entirely
  • s

    sdubois

    04/26/2017, 5:38 AM
    but anyway thanks for the new permissions, looking forward to use it 🙂
    🙌 1
    s
    • 2
    • 1
  • a

    artyom

    04/26/2017, 8:17 AM
    @gunterh @mdc.life @oter hello, happy Wednesday! welcome to graphcool 👋
  • p

    picosam

    04/26/2017, 9:45 AM
    Hello folks! I should post this here for everyone to potentially benefit I guess. Currently I have 2 projects on 2 accounts: dev and prod — one had permissions “early access” granted, and the other not. Currently, when I click on permissions I see the following different views (screenshots attached). So which is the correct one and how do I move to the “released” permissions mode?
  • p

    picosam

    04/26/2017, 9:45 AM
  • s

    sorenbs

    04/26/2017, 10:18 AM
    @picosam Can you try to force-reload the website?
  • n

    nick.kozhukharenko

    04/26/2017, 10:50 AM
    Hi! can somebody suggest how to define models in order to have possibility set/change order of the items in collection? First option is to have an
    order
    filed which will container a sequence number of the item.
    Copy code
    // options 1
    type Course {
      id: ID!
      lessons: [Lesson!]! @relation(name: "CourseLessons")
    }
    type Lesson {
      id: ID!
      order: Int! // location in the list on UI
      course: Course
    }
    But in this case if the order in UI is changed (e.g. last lesson was moved to first position) - we have to update each Lesson separatly (a lot of mutation). And I dont know how to determine the ‘order’ property when a Lesson is creating… Second option is to store a
    lessonsOrder
    filed (which is an array of lessons ids) in the Course and change it every time the order is change/lessons created or delete.
    Copy code
    type Course {
      id: ID!
      lessonsOrder: [String!]! // store here lessons IDs in correct order
      lessons: [Lesson!]! @relation(name: "CourseLessons")
    }
    type Lesson {
      id: ID!
      course: Course @relation(name: "CourseLessons")
    }
    Perhaps there are other options that I do not know about?
  • s

    sorenbs

    04/26/2017, 12:03 PM
    @nick.kozhukharenko I have used your second approach before with success. The nice thing about this approach is that you separate the actual data (the lesson) form the ordering. If you want to go with option 1 you could consider using a Float type. Then, instead of updating the order field in all Lesson nodes you can simply move the one lesson you care about in between two others. ie, to move the third element to position 2:
    Copy code
    [1, 2, 3, 4]
    becomes
    Copy code
    [1, 1.5, 2, 4]
  • n

    nick.kozhukharenko

    04/26/2017, 12:12 PM
    thanks for advice @sorenbs ! clever move with floats 👍. I’d never have thought of this
  • a

    artyom

    04/26/2017, 12:35 PM
    🎉 @rtowarek @shanecav hi there, welcome! 🙂 👋
    👋 1
  • p

    picosam

    04/26/2017, 2:55 PM
    LOL Thank’s @sorenbs! Force-reloading the website simply did it ☺️
    👍 1
  • a

    artyom

    04/26/2017, 4:13 PM
    @didstopia @adamveld12 🖖 be welcome to graphcool on this day!
    ❤️ 1
  • a

    adamveld12

    04/26/2017, 4:13 PM
    thanks @artyom! 👋
    👋 1
  • r

    rtowarek

    04/26/2017, 4:19 PM
    Hello folks! I wonder how should I implement 'reset password' feature for those users that have forgotten their passwords? I'm using email/password-based authentication. Thank you for developing graphcool . I really enjoy it 🙂
    v
    • 2
    • 1
  • g

    gustav

    04/26/2017, 8:49 PM
    Is it possible to create a custom oauth solution with a graphcool backend? I'd like to login with Github, possibly using something like Passport.js, but not use Auth0
    a
    s
    s
    • 4
    • 5
  • a

    artyom

    04/26/2017, 9:36 PM
    Hi there @gustav and @ryand 👋 welcome to our slack!
  • h

    hvillain

    04/26/2017, 9:57 PM
  • u

    user

    04/26/2017, 10:00 PM
    @artyom commented on @hvillain’s file

    https://prisma.slack.com/files/U4KES2J7P/F55618C0L/image_uploaded_from_ios.jpg▾

    : Thanks, @hvillain ! Pinging @tim2 on this
  • u

    user

    04/26/2017, 10:28 PM
    @nilan commented on @hvillain’s file

    https://prisma.slack.com/files/U4KES2J7P/F55618C0L/image_uploaded_from_ios.jpg▾

    : @hvillain could you please create an issue here github.com/graphcool/console/issues?
  • m

    mannigan

    04/27/2017, 12:04 AM
    is there a way default a [String] field to an empty array? I tried setting it up in the ui but it didnt seem to like it so i dont know if im doing it wrong
    n
    • 2
    • 11
  • s

    sebastien

    04/27/2017, 3:40 AM
    Wondering what’s the best way to add an item into a list. Get the whole list, add the item, then mutate the field with the new list? Or is there a better way to push an item into a list?
    s
    • 2
    • 2
  • r

    rtowarek

    04/27/2017, 7:58 AM
    Hey guys, I found a bug in data interface. When a type has a DateTime field, datepicker automatically opens. When you switch to another type without making any changes, "unsaved changes" dialog shows up.
  • t

    theom

    04/27/2017, 8:13 AM
    So, and as can be seen from the attached image, no websocket activity is happening when a mutation is fired, although the mutation is successful, which of course means that no 'real-time' updates happen. I manually need to reload the browser, as another user, to see any updated data. My subscription code is as follows
    Copy code
    const Comments = React.createClass({
      
      componentDidMount () {
        if (this.props.data.loading === false){
          this.subscription = this.subscribe();
        }
      },
      componentWillUnmount() {
        if (this.subscriptionObserver) {
          this.subscriptionObserver.unsubscribe();
        }
      },
      isDuplicateComment(newComment, existingComments) {
        let duplicateComment = false;
        existingComments.forEach((comment) => {
          if (newComment.id !== null && newComment.id === comment.id) {
            duplicateComment = true;
          }
        });
        console.log('duplicateComment = ', duplicateComment);
        return duplicateComment;
      },
      subscribe() {
        const postIndexID = this.props.postIndexID;
    
        this.subscriptionObserver = this.props.data.subscribeToMore({
          document: Subscription_Add_Delete_Comment_Query,
          updateQuery: (previousState, {subscriptionData}) => {
            // The mutations allways update the Root_Tree, so the new comment already exists in previousState.
            // So you just need to return the previousState as is
            console.log('previousState = ', previousState);
            console.log('subscriptionData = ', subscriptionData);
            return previousState;
          },
          onError: (err) => console.error(err),
        });
      },
      ....
    })
    and my websocket connection code is as follows:
    Copy code
    import ApolloClient, {
      createNetworkInterface,
      addTypeName,
    } from 'apollo-client';
    
    import { 
        SubscriptionClient, 
        addGraphQLSubscriptions,
    } from 'subscriptions-transport-ws';
    
    // Create WebSocket client
    const wsClient = new SubscriptionClient('<wss://subscriptions.graph.cool/v1/cj0ogobvm96du01021v9ajeg1>', {
      reconnect: true,
      connectionParams: {
        // Pass any arguments you want for initialization
      }
    })
    const networkInterface = createNetworkInterface({ 
      uri: '<https://api.graph.cool/simple/v1/cj0ogobvm96du01021v9ajeg1>',
      opts: {
        // Additional fetch options like `credentials` or `headers`
        credentials: 'same-origin',
      }
    })
    
    // Extend the network interface with the WebSocket
    const networkInterfaceWithSubscriptions = addGraphQLSubscriptions(
      networkInterface,
      wsClient
    )
    
    const client = new ApolloClient({
      networkInterface: networkInterfaceWithSubscriptions,
      dataIdFromObject: (o) => o.id,
       addTypeName: true
    })
    
    export default client;
    What am I overlooking here?
  • u

    user

    04/27/2017, 8:25 AM
    @sorenbs commented on @rtowarek’s file

    https://prisma.slack.com/files/U54PXSN04/F557HPF1R/graph.gif▾

    : Thanks @rtowarek Can you open an issue in https://github.com/graphcool/console 🙂
1...166167168...637Latest