How to use the nexus.mutationField 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 este / este / packages / api / schema / web.ts View on Github external
export const DeleteWebInput = inputObjectType({
  name: 'DeleteWebInput',
  definition(t) {
    t.id('id');
  },
});

export const DeleteWebPayload = objectType({
  nonNullDefaults: { output: false },
  name: 'DeleteWebPayload',
  definition(t) {
    t.field('web', { type: Web });
  },
});

export const deleteWeb = mutationField('deleteWeb', {
  type: DeleteWebPayload,
  args: { input: arg({ type: DeleteWebInput }) },
  resolve: (_root, { input }, context) => context.models.web.deleteWeb(input),
});
github este / este / packages / api / schema / user.ts View on Github external
definition(t) {
    t.field('email', { type: 'EmailError' });
    t.field('password', { type: 'PasswordError' });
  },
});

export const SignInPayload = objectType({
  nonNullDefaults: { output: false },
  name: 'SignInPayload',
  definition(t) {
    t.field('errors', { type: SignInErrors });
    t.string('token');
  },
});

export const signIn = mutationField('signIn', {
  type: SignInPayload,
  args: { input: arg({ type: SignInInput }) },
  resolve: (_root, { input }, context) => context.models.user.signIn(input),
});

export const SetUserThemeInput = inputObjectType({
  name: 'SetUserThemeInput',
  definition(t) {
    t.string('name');
  },
});

export const SetUserThemePayload = objectType({
  nonNullDefaults: { output: false },
  name: 'SetUserThemePayload',
  definition(t) {
github este / este / packages / api / schema / user.ts View on Github external
export const SetUserThemeInput = inputObjectType({
  name: 'SetUserThemeInput',
  definition(t) {
    t.string('name');
  },
});

export const SetUserThemePayload = objectType({
  nonNullDefaults: { output: false },
  name: 'SetUserThemePayload',
  definition(t) {
    t.field('user', { type: User });
  },
});

export const setUserTheme = mutationField('setUserTheme', {
  type: SetUserThemePayload,
  args: { input: arg({ type: SetUserThemeInput }) },
  resolve: (_root, { input }, context) =>
    context.models.user.setTheme(input.name || ''),
});
github este / este / packages / api / schema / web.ts View on Github external
name: 'CreateWebErrors',
  definition(t) {
    t.field('name', { type: 'Max140CharsError' });
  },
});

export const CreateWebPayload = objectType({
  nonNullDefaults: { output: false },
  name: 'CreateWebPayload',
  definition(t) {
    t.field('errors', { type: CreateWebErrors });
    t.field('web', { type: Web });
  },
});

export const createWeb = mutationField('createWeb', {
  type: CreateWebPayload,
  args: { input: arg({ type: CreateWebInput }) },
  resolve: (_root, { input }, context) => context.models.web.createWeb(input),
});

export const UpdateWebInput = inputObjectType({
  name: 'UpdateWebInput',
  definition(t) {
    t.id('id');
    t.string('name');
  },
});

export const UpdateWebErrors = objectType({
  nonNullDefaults: { output: false },
  name: 'UpdateWebErrors',
github este / este / packages / api / schema / web.ts View on Github external
name: 'UpdateWebErrors',
  definition(t) {
    t.field('name', { type: 'Max140CharsError' });
  },
});

export const UpdateWebPayload = objectType({
  nonNullDefaults: { output: false },
  name: 'UpdateWebPayload',
  definition(t) {
    t.field('errors', { type: UpdateWebErrors });
    t.field('web', { type: Web });
  },
});

export const updateWeb = mutationField('updateWeb', {
  type: UpdateWebPayload,
  args: { input: arg({ type: UpdateWebInput }) },
  resolve: (_root, { input }, context) => context.models.web.updateWeb(input),
});

export const DeleteWebInput = inputObjectType({
  name: 'DeleteWebInput',
  definition(t) {
    t.id('id');
  },
});

export const DeleteWebPayload = objectType({
  nonNullDefaults: { output: false },
  name: 'DeleteWebPayload',
  definition(t) {