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

    ppatidar

    06/01/2017, 11:14 AM
    @nilan Can i update two models at once Like I have models Post and Comment At the time of updatePost i also want to update some commnets of post Please let me know How we can update two models with relation ship?
  • y

    yus

    06/01/2017, 11:38 AM
    @ppatidar one possible way is to use server side subscriptions
    p
    • 2
    • 1
  • y

    yus

    06/01/2017, 11:38 AM
    create a subscription on Post updates, which triggers a function which updates associated comments
  • a

    artyom

    06/01/2017, 11:41 AM
    @cdock @douxsey @zeroproduct @dubcanada @alberto @rhino @rahees @casoetan @kpendic @droidwater 👋 hello all, welcome to graphcool ! glad you’re joining us today 😄
  • y

    yus

    06/01/2017, 11:42 AM
    @ppatidar so i used this example to get started myself. for me i was trying to create a stripe customer whenever a new Customer rowis created
  • y

    yus

    06/01/2017, 11:42 AM
    https://www.graph.cool/docs/tutorials/welcome-email-with-sss-dee0aethoo/
  • y

    yus

    06/01/2017, 11:43 AM
    @ppatidar for you, create a new server side subscription function on your Post table
  • y

    yus

    06/01/2017, 11:44 AM
    then the subscription query should look like this
  • y

    yus

    06/01/2017, 11:44 AM
    -.js
  • p

    ppatidar

    06/01/2017, 11:46 AM
    @yus Yes but i want to call my mutaion from client side with all the updated post and comments data How can I call mutaion with all the updated commenst data with uopdated post data ?
    🔴 1
    n
    n
    • 3
    • 8
  • p

    picosam

    06/01/2017, 12:17 PM
    Hello! Using a
    Function
    , is it possible to update a different
    Type
    than the one the function has been triggered on? Say for instance, There's a relation between a
    User
    and a
    File
    , I create the mutation trigger
    Function
    when I update the
    File
    , but I need to then update a value on a field within
    User
    !
  • y

    yus

    06/01/2017, 12:18 PM
    @picosam yes u can
  • p

    picosam

    06/01/2017, 12:18 PM
    YES WE CAN!
  • p

    picosam

    06/01/2017, 12:19 PM
    Sorry... great! How? 😄
  • y

    yus

    06/01/2017, 12:19 PM
    in your function you can write an arbitrary graphcool mutation on any types
  • p

    picosam

    06/01/2017, 12:20 PM
    Well, that's simple. I'll try that then!
  • y

    yus

    06/01/2017, 12:20 PM
    for example, here's what i did in my function
  • p

    picosam

    06/01/2017, 12:23 PM
    Where?
  • p

    picosam

    06/01/2017, 12:23 PM
    Sorry, I mean, did I miss something you sent?
  • y

    yus

    06/01/2017, 12:23 PM
    -.js
  • y

    yus

    06/01/2017, 12:24 PM
    line 5: you can modify this to execute any mutation you like
  • p

    picosam

    06/01/2017, 12:25 PM
    Hmm... may I ask why you're using
    fetch
    here though?
  • y

    yus

    06/01/2017, 12:25 PM
    how else would u execute a mutation from a function?
  • p

    picosam

    06/01/2017, 12:26 PM
    Oh boy, I forget that we still can't use lokka here...
  • y

    yus

    06/01/2017, 12:26 PM
    righto. if u are using webhooks, i believe u can use whatever u want. looka, apollo
  • y

    yus

    06/01/2017, 12:26 PM
    inline is more limited.
  • p

    picosam

    06/01/2017, 12:27 PM
    Nope, I'm using Graph.cool's
    Functions
  • p

    picosam

    06/01/2017, 12:27 PM
    But in all cases, does this induce a performance hit on each mutation?
  • p

    picosam

    06/01/2017, 12:27 PM
    I mean, does fetch actually "leave" the network and come back to execute the mutation using HTTP?
  • y

    yus

    06/01/2017, 12:28 PM
    thats a good point
1...211212213...637Latest