Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
name: 'User',
definition(t) {
t.id('id');
t.dateTime('createdAt');
t.dateTime('updatedAt');
t.string('email');
t.string('themeName');
t.list.field('webs', {
type: 'Web',
resolve: (root, _args, context) => context.models.user.webs(root.id),
});
},
});
// https://medium.com/workflowgen/graphql-schema-design-the-viewer-field-aeabfacffe72
export const viewer = queryField('viewer', {
type: User,
nullable: true,
resolve: (_root, _args, context) => context.models.user.viewer(),
});
// requiredViewer throws, so the app can redirect.
export const requiredViewer = queryField('requiredViewer', {
type: User,
resolve: (_root, _args, context) => context.models.user.requiredViewer(),
});
export const SignInInput = inputObjectType({
name: 'SignInInput',
definition(t) {
t.string('email');
t.string('password');
t.list.field('webs', {
type: 'Web',
resolve: (root, _args, context) => context.models.user.webs(root.id),
});
},
});
// https://medium.com/workflowgen/graphql-schema-design-the-viewer-field-aeabfacffe72
export const viewer = queryField('viewer', {
type: User,
nullable: true,
resolve: (_root, _args, context) => context.models.user.viewer(),
});
// requiredViewer throws, so the app can redirect.
export const requiredViewer = queryField('requiredViewer', {
type: User,
resolve: (_root, _args, context) => context.models.user.requiredViewer(),
});
export const SignInInput = inputObjectType({
name: 'SignInInput',
definition(t) {
t.string('email');
t.string('password');
t.boolean('createAccount');
},
});
export const SignInErrors = objectType({
nonNullDefaults: { output: false },
name: 'SignInErrors',
import { queryField, idArg } from "nexus";
export const productQueryField = queryField("product", {
type: "Product",
nullable: true,
args: {
id: idArg({ required: true })
},
async resolve(root, { id }, context, info) {
return await context.stripe.products.retrieve(id);
}
});
import { stringArg, queryField } from "nexus";
export const countrySpecsQueryField = queryField("countrySpecs", {
type: "CountrySpec",
nullable: true,
args: {
country: stringArg({ required: true })
},
async resolve(root, { country }, context, info) {
return await context.stripe.countrySpecs.retrieve(country);
}
});
import { queryField } from "nexus";
export const productsQueryField = queryField("products", {
type: "Product",
list: true,
async resolve(root, args, context, info) {
const { data } = await context.stripe.products.list();
return data;
}
});
import { queryField, idArg } from "nexus";
export const planQueryField = queryField("plan", {
type: "Plan",
nullable: true,
args: {
id: idArg({ required: true })
},
async resolve(root, { id }, context, info) {
return await context.stripe.plans.retrieve(id);
}
});
queryField,
idArg,
} from 'nexus';
export const Web = objectType({
name: 'Web',
definition(t) {
t.id('id');
t.dateTime('createdAt');
t.dateTime('updatedAt');
t.string('name');
t.field('creator', { type: 'User' });
},
});
export const web = queryField('web', {
type: Web,
args: { id: idArg() },
resolve: (_root, { id }, context) => context.models.web.byId(id),
});
export const CreateWebInput = inputObjectType({
name: 'CreateWebInput',
definition(t) {
t.string('name');
},
});
export const CreateWebErrors = objectType({
nonNullDefaults: { output: false },
name: 'CreateWebErrors',
definition(t) {