Refactor code structure and dependencies
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { builder, prisma } from './graphql.builder';
|
||||
import type PrismaTypes from '@pothos/plugin-prisma/generated';
|
||||
|
||||
builder.prismaObject('User', {
|
||||
fields: (t) => ({
|
||||
@@ -9,9 +10,11 @@ builder.prismaObject('User', {
|
||||
role: t.exposeString('role'),
|
||||
createdAt: t.expose('createdAt', {
|
||||
type: 'DateTime',
|
||||
nullable: true,
|
||||
}),
|
||||
updatedAt: t.expose('updatedAt', {
|
||||
type: 'DateTime',
|
||||
nullable: true,
|
||||
}),
|
||||
order: t.relation('orders'),
|
||||
serviceFeedbacks: t.relation('serviceFeedbacks'),
|
||||
@@ -114,4 +117,40 @@ builder.queryType({
|
||||
}),
|
||||
});
|
||||
|
||||
// // Mutation section
|
||||
// builder.mutationType({
|
||||
// fields: (t) => ({
|
||||
// createUser: t.prismaField({
|
||||
// type: 'User',
|
||||
// args: {
|
||||
// data: t.arg({
|
||||
// type: 'PrismaTypes.UserCreateInput',
|
||||
// }),
|
||||
// },
|
||||
// resolve: (query, root, args, ctx, info) => {
|
||||
// return prisma.user.create({
|
||||
// data: args.data,
|
||||
// });
|
||||
// },
|
||||
// }),
|
||||
// }),
|
||||
// });
|
||||
|
||||
// // Subscription section
|
||||
// builder.subscriptionType({
|
||||
// fields: (t) => ({
|
||||
// userCreated: t.prismaField({
|
||||
// type: 'User',
|
||||
// subscribe: (query, root, args, ctx, info) => {
|
||||
// return prisma.$subscribe.user({
|
||||
// mutation_in: ['CREATED'],
|
||||
// });
|
||||
// },
|
||||
// resolve: (payload) => {
|
||||
// return payload;
|
||||
// },
|
||||
// }),
|
||||
// }),
|
||||
// });
|
||||
|
||||
export const schema = builder.toSchema();
|
||||
|
||||
Reference in New Issue
Block a user