Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
inputType(
customArg: CustomInputArg,
):
| string
| Nexus.core.NexusInputObjectTypeDef
| Nexus.core.NexusEnumTypeDef
| Nexus.core.NexusScalarTypeDef
| Nexus.core.NexusArgDef {
const typeName = customArg.type.name
// If type is already published, just reference it
if (this.isPublished(typeName)) {
return Nexus.arg(
dmmfFieldToNexusFieldConfig({
...customArg.arg.inputType,
type: customArg.type.name,
}),
)
}
if (customArg.arg.inputType.kind === 'scalar') {
return this.publishScalar(customArg.type.name)
}
if (customArg.arg.inputType.kind === 'enum') {
return this.publishEnum(customArg.type.name)
}
const inputType = customArg.type as DMMF.Data.InputType
id: idArg({ required: true }),
},
resolve: deleteAttribute,
})
/*
* INPUT
*/
t.field('createInput', {
type: 'Input',
args: {
attributeId: idArg({ required: true }),
script: stringArg(),
static: stringArg(),
sql: arg({
type: 'ColumnInput',
}),
},
resolve: createInput,
})
t.field('deleteInput', {
type: 'Input',
args: {
id: idArg({ required: true }),
},
resolve: deleteInput,
})
/*
* COLUMN
type: "Event",
nullable: true,
description: 'Fetches a single event by id.',
args: {
where: arg({ type: "EventsWhereInput" }),
},
async resolve(_, args, ctx, info) {
return await ctx.eventsModel.getOne(args.where);
},
});
t.list.field("series", {
type: "Series",
nullable: true,
description: 'Fetches a list of series.',
args: {
where: arg({ type: "SeriesWhereInput" }),
orderBy: arg({ type: "SeriesOrderBy" }),
offset: intArg({ description: "Skips the specified number of resources in the result set." }),
limit: intArg({ description: "Limit the result set to the specified number of resources." }),
},
async resolve(_, args, ctx, info) {
return await ctx.seriesModel.getMany({
where: args.where,
orderBy: args.orderBy,
limit: args.limit,
offset: args.offset
});
},
});
t.field("getSeries", {
type: "Series",
nullable: true,
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 || ''),
});
args: {
columnId: idArg({ required: true }),
join: arg({ type: 'JoinInput' }),
},
resolve: addJoinToColumn,
})
/*
* JOIN
*/
t.field('updateJoin', {
type: 'Join',
args: {
joinId: idArg({ required: true }),
data: arg({ type: 'JoinInput', required: true }),
},
resolve: updateJoin,
})
t.field('deleteJoin', {
type: 'Join',
args: {
id: idArg({ required: true }),
},
resolve: deleteJoin,
})
},
})