How to use the nexus.idArg function in nexus

To help you get started, we’ve selected a few nexus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github prisma / prisma-examples / typescript / graphql-apollo-server / src / schema.ts View on Github external
title,
            content,
            published: false,
            author: {
              connect: { email: authorEmail },
            },
          },
        })
      },
    })

    t.field('publish', {
      type: 'Post',
      nullable: true,
      args: {
        id: idArg(),
      },
      resolve: (_, { id }, ctx) => {
        return ctx.photon.posts.update({
          where: { id },
          data: { published: true },
        })
      },
    })
  },
})
github prisma / photonjs / examples / typescript / graphql-auth / src / resolvers / Query.ts View on Github external
},
              {
                content: {
                  contains: searchString,
                },
              },
            ],
          },
        })
      },
    })

    t.field('post', {
      type: 'Post',
      nullable: true,
      args: { id: idArg() },
      resolve: (parent, { id }, ctx) => {
        return ctx.photon.posts.findOne({
          where: {
            id,
          },
        })
      },
    })
  },
})
github keepforever / a-prisma2 / src / resolvers / Query.ts View on Github external
}
                    })
                    .decks();

                return ctx.photon.users.findOne({
                    where: {
                        email: whoAmI.email
                    }
                });
            }
        });

        t.field('singleDeck', {
            type: 'Deck',
            nullable: true,
            args: { id: idArg() },
            resolve: (_parent, { id }, ctx) => {
                return ctx.photon.decks.findOne({
                    where: {
                        id
                    }
                });
            }
        });

        t.list.field('feedUsers', {
            type: 'User',
            resolve: (_parent, _args, ctx) => {
                return ctx.photon.users.findMany();
            }
        });
github prisma / prisma-examples / typescript / graphql-auth / src / types / Mutation.ts View on Github external
const userId = getUserId(ctx)
        return ctx.photon.posts.create({
          data: {
            title,
            content,
            published: false,
            author: { connect: { id: userId } },
          },
        })
      },
    })

    t.field('deletePost', {
      type: 'Post',
      nullable: true,
      args: { id: idArg() },
      resolve: (parent, { id }, ctx) => {
        return ctx.photon.posts.delete({
          where: {
            id,
          },
        })
      },
    })

    t.field('publish', {
      type: 'Post',
      nullable: true,
      args: { id: idArg() },
      resolve: (parent, { id }, ctx) => {
        return ctx.photon.posts.update({
          where: { id },
github prisma / prisma-examples / javascript / graphql-auth / src / types / Mutation.js View on Github external
const userId = getUserId(ctx)
        return ctx.photon.posts.create({
          data: {
            title,
            content,
            published: false,
            author: { connect: { id: userId } },
          },
        })
      },
    })

    t.field('deletePost', {
      type: 'Post',
      nullable: true,
      args: { id: idArg() },
      resolve: (parent, { id }, ctx) => {
        return ctx.photon.posts.delete({
          where: {
            id,
          },
        })
      },
    })

    t.field('publish', {
      type: 'Post',
      nullable: true,
      args: { id: idArg() },
      resolve: (parent, { id }, ctx) => {
        return ctx.photon.posts.update({
          where: { id },
github arkhn / pyrog / server-v2 / src / types / Mutation.ts View on Github external
type: 'Resource',
      args: {
        resourceId: idArg({ required: true }),
        data: arg({ type: 'UpdateResourceInput', required: true }),
      },
      resolve: updateResource,
    })

    /*
     * ATTRIBUTE
     */

    t.field('createAttribute', {
      type: 'Attribute',
      args: {
        parentId: idArg({ required: true }),
      },
      resolve: createAttribute,
    })

    t.field('updateAttribute', {
      type: 'Attribute',
      args: {
        attributeId: idArg({ required: true }),
        data: arg({ type: 'UpdateAttributeInput', required: true }),
      },
      resolve: updateAttribute,
    })

    t.field('deleteAttribute', {
      type: 'Attribute',
      args: {