add centerstaff mutation
This commit is contained in:
@@ -49,5 +49,61 @@ export class CenterStaffSchema extends PothosSchema {
|
||||
},
|
||||
}),
|
||||
}));
|
||||
|
||||
// mutations
|
||||
this.builder.mutationFields((t) => ({
|
||||
createCenterStaff: t.prismaField({
|
||||
type: this.centerStaff(),
|
||||
args: {
|
||||
data: t.arg({
|
||||
type: this.builder.generator.getCreateInput('CenterStaff'),
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
resolve: async (query, root, args, ctx, info) => {
|
||||
return await this.prisma.centerStaff.create({
|
||||
...query,
|
||||
data: args.data,
|
||||
});
|
||||
},
|
||||
}),
|
||||
|
||||
updateCenterStaff: t.prismaField({
|
||||
type: this.centerStaff(),
|
||||
args: {
|
||||
where: t.arg({
|
||||
type: this.builder.generator.getWhereUnique('CenterStaff'),
|
||||
required: true,
|
||||
}),
|
||||
data: t.arg({
|
||||
type: this.builder.generator.getUpdateInput('CenterStaff'),
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
resolve: async (query, root, args, ctx, info) => {
|
||||
return await this.prisma.centerStaff.update({
|
||||
...query,
|
||||
where: args.where,
|
||||
data: args.data,
|
||||
});
|
||||
},
|
||||
}),
|
||||
|
||||
deleteCenterStaff: t.prismaField({
|
||||
type: this.centerStaff(),
|
||||
args: {
|
||||
where: t.arg({
|
||||
type: this.builder.generator.getWhereUnique('CenterStaff'),
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
resolve: async (query, root, args, ctx, info) => {
|
||||
return await this.prisma.centerStaff.delete({
|
||||
...query,
|
||||
where: args.where,
|
||||
});
|
||||
},
|
||||
}),
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user