Example #1
0
File: user.ts Project: este/este
    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) {
    t.field('user', { type: User });
Example #2
0
File: web.ts Project: este/este
    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',
  definition(t) {