ryu110
@ryu110

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

Graphqlでデータを取得したい

GraphQLで単一のデータが取れません。
リストで全てのデータは取れますが1つのデータだけを取ることができません。
どこを改善すればよいでしょうか?

type Post {
    id: Int
    title: String!
    content:String!
  }
  type Query {
    allPosts: [Post!]!
    singleDetail(id:Int!): [Post!]!
  }

Query: {
    allPosts: () => {
      return prisma.post.findMany();
    },
    singleDetail: (args:any) => {
      return prisma.post.findUnique({
        where:{
          id:args.post.id
        },
        select:{
          id:true,
          title:true,
          content:true,
        }
      })
    },
  },

0

No Answers yet.

Your answer might help someone💌