How to use the gqliteral.arg function in gqliteral

To help you get started, we’ve selected a few gqliteral 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-labs / nexus-prisma / example / ecommerce / src / resolvers / roots / Mutation.ts View on Github external
create: data.variants.map(
            variant =>
              ({
                optionValues: {
                  connect: variant.optionsValueIds,
                },
              } as VariantCreateInput),
          ),
        },
      })
    },
  })

  t.field('updateProduct', 'Product', {
    args: {
      data: arg('UpdateProductInput', { required: true }),
    },
    resolve: async (parent, { data }, ctx) => {
      throw new Error('updateProduct resolve not implemented yet')
    },
  })
})
github prisma-labs / nexus-prisma / example / ecommerce / src / resolvers / roots / Mutation.ts View on Github external
productIds: idArg({ required: true, list: true }),
      collectionId: idArg({ required: true }),
    },
    resolve: async (_, args, ctx) => {
      const collection = await ctx.prisma.updateCollection({
        where: { id: args.collectionId },
        data: { products: { disconnect: args.productIds.map(id => ({ id })) } },
      })

      return collection
    },
  })

  t.field('createProduct', 'Product', {
    args: {
      data: arg('CreateProductInput', { required: true }),
    },
    resolve: async (parent, { data }, ctx) => {
      return ctx.prisma.createProduct({
        name: data.name,
        brand: { connect: { id: data.brand.id } },
        attributes: {
          connect: data.attributesIds,
        },
        variants: {
          create: data.variants.map(
            variant =>
              ({
                optionValues: {
                  connect: variant.optionsValueIds,
                },
              } as VariantCreateInput),
github prisma-labs / nexus-prisma / plugin / prisma.ts View on Github external
return acc
      }

      if (fieldArg.type.isInput) {
        typesToExport.push(
          ...exportInputObjectType(
            typesMap.types[fieldArg.type.name],
            typesMap,
            {},
          ),
        )
      } else if (fieldArg.type.isEnum) {
        typesToExport.push(exportEnumType(typesMap.enums[fieldArg.type.name]))
      }

      acc[fieldArg.name] = arg(
        fieldArg.type.name as any,
        typeToFieldOpts(fieldArg.type),
      )

      return acc
    },
    {},
github prisma-labs / nexus-prisma / plugin / prisma.ts View on Github external
(acc, fieldArg) => {
            acc[fieldArg.name] = arg(fieldArg.type.name as any, {
              ...typeToFieldOpts(fieldArg.type),
            })
            return acc
          },
          {},

gqliteral

Scalable, strongly typed GraphQL schema development

MIT
Latest version published 6 years ago

Package Health Score

59 / 100
Full package analysis

Similar packages