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!

prismaのnestについて

ユーザに結びついているpostsの、その中で結びついているchatsの中の値(senderIdとcomment)を更新したいです。
何が違いますか?

chatComment: async (parent: undefined, args: any, context: Context) => {
      const addComment = await context.prisma.user.create({
        where: {
          posts: {
            id: args.postId
          }
        },
        data: {
          posts: {
            create: {
              chats: {
                create: {
                  data: {
                    senderId: args.senderId,
                    comment: args.comment,
                  }
                }
              }
            }
          }
        },
        include: {
          posts: {
            include: {
              chats: true
            }
          }
        }
      }),

      return addComment
    },
0

No Answers yet.

Your answer might help someone💌