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,59 @@
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 WorkshopSubscriptionSchema extends PothosSchema {
constructor(
@Inject(SchemaBuilderToken) private readonly builder: Builder,
private readonly prisma: PrismaService,
) {
super();
}
@PothosRef()
workshopSubscription() {
return this.builder.prismaObject('WorkshopSubscription', {
fields: (t) => ({
userId: t.exposeID('userId'),
workshopId: t.exposeID('workshopId'),
user: t.relation('user'),
workshop: t.relation('workshop'),
}),
});
}
@Pothos()
init(): void {
this.builder.queryFields((t) => ({
workshopSubscription: t.prismaField({
type: this.workshopSubscription(),
args: this.builder.generator.findUniqueArgs('WorkshopSubscription'),
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.workshopSubscription.findUnique({
...query,
where: args.where,
});
},
}),
workshopSubscriptions: t.prismaField({
type: [this.workshopSubscription()],
args: this.builder.generator.findManyArgs('WorkshopSubscription'),
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.workshopSubscription.findMany({
...query,
skip: args.skip ?? 0,
take: args.take ?? 10,
orderBy: args.orderBy ?? undefined,
where: args.filter ?? undefined,
});
},
}),
}));
}
}