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

    Adam Gajzlerowicz

    10/21/2017, 10:10 AM
    can you not have more like a Key->Value types?
  • j

    joar

    10/21/2017, 11:48 AM
    @Adam Gajzlerowicz what makes you think everything needs to be a list?
  • a

    Adam Gajzlerowicz

    10/21/2017, 12:55 PM
  • a

    Adam Gajzlerowicz

    10/21/2017, 12:55 PM
    all of those are lists
  • a

    Adam Gajzlerowicz

    10/21/2017, 12:56 PM
    I am trying to find in the documentation how to describe just one key-value element
  • a

    Adam Gajzlerowicz

    10/21/2017, 12:56 PM
    but it doesn't seem to be there
  • a

    Adam Gajzlerowicz

    10/21/2017, 12:56 PM
    @joar
  • j

    joar

    10/21/2017, 1:01 PM
    No, none of those are lists
  • j

    joar

    10/21/2017, 1:02 PM
    Lists are marked as [Type]
  • j

    joar

    10/21/2017, 1:04 PM
    Or do you mean that you have a List of Users/Lunches/Posts in your DB?
  • j

    joar

    10/21/2017, 1:05 PM
    If you need to store a single singleton value I would create a "Settings" type or something like that, and have one instance of that (btw sorry for responding in all chat, should've been a thread)
  • z

    zebapy

    10/21/2017, 1:52 PM
    is one better than the other approach / can you even do the 2nd approach?
    types_graphql.txt
  • m

    matic

    10/21/2017, 5:09 PM
    Hey guys! I am trying to create a nested mutation, which connects existing
    File
    object with newly created
    DocumentFile
    object, which is included in newly created
    Document
    , but every time I try to call create mutation it returns an error even though the
    Document
    and
    DocumentFiles
    are created properly. Does anyone know why this might be happening? I would really appreciate help!
  • m

    matic

    10/21/2017, 5:10 PM
    + my Schema looks like this:
    Copy code
    type User @model {
      id: ID! @isUnique
    
      facebookUserId: String! @isUnique
    
      name: String!
      email: String! @isUnique
      photo: String
      school: School! @relation(name: "SchoolOnUser")
    
      documents: [Document!]! @relation(name: "UserOnDocument")
      requests: [Request!]! @relation(name: "UserOnRequest")
    
      createdAt: DateTime!
      updatedAt: DateTime!
    }
    
    type School @model {
      id: ID! @isUnique
      name: String!
      users: [User!]! @relation(name: "SchoolOnUser")
      createdAt: DateTime!
      updatedAt: DateTime!
    }
    
    type Request @model {
      id: ID! @isUnique
      description: String!
      author: User! @relation(name: "UserOnRequest")
      closed: Boolean @defaultValue(value: false)
      createdAt: DateTime!
      updatedAt: DateTime!
      documents: [Document!]! @relation(name: "RequestOnDocument")
    }
    
    type Document @model {
      id: ID! @isUnique
      description: String!
      author: User! @relation(name: "UserOnDocument")
      documentFiles: [DocumentFile!]! @relation(name: "DocumentOnDocumentFile")
      createdAt: DateTime!
      updatedAt: DateTime!
      request: Request! @relation(name: "RequestOnDocument")
    }
    
    type DocumentFile @model {
      id: ID! @isUnique
      order: Int!
      file: File! @relation(name: "DocumentFileOnFile")
      document: Document @relation(name: "DocumentOnDocumentFile")
    }
    
    type File @model {
      id: ID! @isUnique
      name: String!
      size: Int!
      secret: String! @isUnique
      contentType: String!
      createdAt: DateTime!
      updatedAt: DateTime!
      url: String! @isUnique
      documentFile: DocumentFile @relation(name: "DocumentFileOnFile")
    }
    n
    • 2
    • 2
  • m

    Maslov

    10/21/2017, 6:32 PM
    Hello, can you help me figure out how to sort by the count of likedUsers?
    type Post @model { likedUsers: [User!]! @relation(name: "UserLikes") }
    šŸ˜ž 1
  • m

    Maslov

    10/21/2017, 6:34 PM
    I have to sort by the count of likes
  • m

    Maslov

    10/21/2017, 6:35 PM
    Does it possible or better to have an extra index like ā€œlikesCountā€
    j
    • 2
    • 6
  • m

    mxmzb

    10/21/2017, 6:50 PM
    hey guys, how do you handle errors from the api? like violating a unique constraint?
  • m

    mxmzb

    10/21/2017, 6:52 PM
    i am using apollo with react and i am running into the issue that the error in case the constraint is violated is a full string which describes what happened, but i’d actually like to tell the user the email he typed in is already signed up (that’s an example)
  • m

    Maslov

    10/21/2017, 10:03 PM
    Can I use event trigger on relation?
  • m

    Maslov

    10/21/2017, 10:05 PM
    I want to write calculated field - count of relations if it possible
  • m

    Maslov

    10/21/2017, 10:14 PM
    For example how I can hack this
    Copy code
    mutation {
      addToUserLikes(
        likedUsersUserId: "cj8spuhk693ge01551a310nh2"
        likesStyleId: "cj8ydb3tn07fe0176oc4yeg32"
      ) {
        likesStyle {
          id
          likesCount
          _likedUsersMeta {
            count
          }
        }
      }
    }
  • m

    Maslov

    10/21/2017, 10:15 PM
    it’s a user mutation or style mutation or who
  • m

    Maslov

    10/21/2017, 10:16 PM
    functions doesn’t work for both - style and user
  • a

    amim

    10/22/2017, 1:08 AM
    hey, is there any library or better way to integrate a form serialization with parameters of a graphql query?
    a
    • 2
    • 1
  • m

    Manfred Neustifter

    10/22/2017, 8:14 AM
    😬 i just want it to work… $ graphcool init --schema https://graphqlbin.com/chat.graphql āœ–ļø Error: Unexpected token c in JSON at position 0
  • m

    Manfred Neustifter

    10/22/2017, 8:17 AM
    😭
  • m

    Manfred Neustifter

    10/22/2017, 8:24 AM
    why why whyyyyy
    fresh_clone_and_install____just_cant_make_it_work____.txt
  • u

    user

    10/22/2017, 8:44 AM
    @melv commented on @Manfred Neustifter’s file https://prisma.slack.com/files/U7LTP6M45/F7P2P0SRM/fresh_clone_and_install____just_cant_make_it_work____.txt: look at your
    .graphcoolrc
    if you ever tried
    graphcool@next
    it will overwite this file , the format is different than the legacy
    graphcool
    fresh_clone_and_install____just_cant_make_it_work____.txt
  • u

    user

    10/22/2017, 8:46 AM
    @Manfred Neustifter commented on @Manfred Neustifter’s file https://prisma.slack.com/files/U7LTP6M45/F7P2P0SRM/fresh_clone_and_install____just_cant_make_it_work____.txt: how to i look at .graphcoolrc and what do i need to do to change it to work?
    fresh_clone_and_install____just_cant_make_it_work____.txt
1...384385386...637Latest