update many graphql field
This commit is contained in:
9
src/ServiceAndCategory/serviceandcategory.module.ts
Normal file
9
src/ServiceAndCategory/serviceandcategory.module.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Global, Module } from '@nestjs/common';
|
||||
import { ServiceAndCategorySchema } from './serviceandcategory.schema';
|
||||
|
||||
@Global()
|
||||
@Module({
|
||||
providers: [ServiceAndCategorySchema],
|
||||
exports: [ServiceAndCategorySchema],
|
||||
})
|
||||
export class ServiceAndCategoryModule {}
|
||||
31
src/ServiceAndCategory/serviceandcategory.schema.ts
Normal file
31
src/ServiceAndCategory/serviceandcategory.schema.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
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';
|
||||
|
||||
@Injectable()
|
||||
export class ServiceAndCategorySchema extends PothosSchema {
|
||||
constructor(
|
||||
@Inject(SchemaBuilderToken) private readonly builder: Builder,
|
||||
private readonly prisma: PrismaService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
@PothosRef()
|
||||
serviceAndCategory() {
|
||||
return this.builder.prismaObject('ServiceAndCategory', {
|
||||
fields: (t) => ({
|
||||
serviceId: t.exposeID('serviceId'),
|
||||
categoryId: t.exposeID('categoryId'),
|
||||
service: t.relation('service'),
|
||||
category: t.relation('category'),
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user