refactor source code
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { ManagedServiceSchema } from './managedservice.schema';
|
||||
import { Module } from '@nestjs/common'
|
||||
import { ManagedServiceSchema } from './managedservice.schema'
|
||||
|
||||
@Module({
|
||||
providers: [ManagedServiceSchema],
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable } from '@nestjs/common'
|
||||
import {
|
||||
Pothos,
|
||||
PothosRef,
|
||||
PothosSchema,
|
||||
SchemaBuilderToken,
|
||||
} from '@smatch-corp/nestjs-pothos';
|
||||
import { Builder } from '../Graphql/graphql.builder';
|
||||
import { PrismaService } from '../Prisma/prisma.service';
|
||||
} from '@smatch-corp/nestjs-pothos'
|
||||
import { Builder } from '../Graphql/graphql.builder'
|
||||
import { PrismaService } from '../Prisma/prisma.service'
|
||||
|
||||
@Injectable()
|
||||
export class ManagedServiceSchema extends PothosSchema {
|
||||
@@ -14,7 +14,7 @@ export class ManagedServiceSchema extends PothosSchema {
|
||||
@Inject(SchemaBuilderToken) private readonly builder: Builder,
|
||||
private readonly prisma: PrismaService,
|
||||
) {
|
||||
super();
|
||||
super()
|
||||
}
|
||||
|
||||
@PothosRef()
|
||||
@@ -41,7 +41,7 @@ export class ManagedServiceSchema extends PothosSchema {
|
||||
description: 'The service.',
|
||||
}),
|
||||
}),
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
@Pothos()
|
||||
@@ -53,7 +53,7 @@ export class ManagedServiceSchema extends PothosSchema {
|
||||
resolve: async (parent, args, ctx) => {
|
||||
return this.prisma.managedService.findUnique({
|
||||
where: args.where,
|
||||
});
|
||||
})
|
||||
},
|
||||
}),
|
||||
|
||||
@@ -67,10 +67,10 @@ export class ManagedServiceSchema extends PothosSchema {
|
||||
cursor: args.cursor ?? undefined,
|
||||
take: args.take ?? undefined,
|
||||
skip: args.skip ?? undefined,
|
||||
});
|
||||
})
|
||||
},
|
||||
}),
|
||||
}));
|
||||
}))
|
||||
|
||||
this.builder.mutationFields((t) => ({
|
||||
createManagedService: t.prismaField({
|
||||
@@ -87,9 +87,9 @@ export class ManagedServiceSchema extends PothosSchema {
|
||||
return await this.prisma.managedService.create({
|
||||
...query,
|
||||
data: args.input,
|
||||
});
|
||||
})
|
||||
},
|
||||
}),
|
||||
}));
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user