Fixing file name casing

This commit is contained in:
2024-10-12 23:15:06 +07:00
parent 5c40a2fd53
commit 0e3aa751ce
29 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
import { Global, Module } from '@nestjs/common';
import { CenterStaffSchema } from './centerstaff.schema';
@Global()
@Module({
providers: [CenterStaffSchema],
exports: [CenterStaffSchema],
})
export class CenterStaffModule {}

View File

@@ -0,0 +1,53 @@
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 CenterStaffSchema extends PothosSchema {
constructor(
@Inject(SchemaBuilderToken) private readonly builder: Builder,
private readonly prisma: PrismaService,
) {
super();
}
@PothosRef()
centerStaff() {
return this.builder.prismaObject('CenterStaff', {
fields: (t) => ({
staffId: t.exposeID('staffId'),
centerId: t.exposeID('centerId'),
serviceId: t.exposeID('serviceId'),
staff: t.relation('staff'),
center: t.relation('center'),
service: t.relation('service'),
createdWorkshop: t.relation('createdWorkshop'),
}),
});
}
@Pothos()
init(): void {
this.builder.queryFields((t) => ({
centerStaff: t.prismaField({
type: [this.centerStaff()],
args: this.builder.generator.findManyArgs('CenterStaff'),
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.centerStaff.findMany({
...query,
skip: args.skip ?? undefined,
take: args.take ?? 10,
orderBy: args.orderBy ?? undefined,
where: args.filter ?? undefined,
});
},
}),
}));
}
}