update many graphql field

This commit is contained in:
2024-10-12 16:34:43 +07:00
parent 244a6f3015
commit ba77bd4e1c
29 changed files with 466 additions and 56 deletions

View 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 {}

View 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'),
}),
});
}
}