Fixing file name casing
This commit is contained in:
9
src/WorkshopSubscription/workshopsubscription.module.ts
Normal file
9
src/WorkshopSubscription/workshopsubscription.module.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Global, Module } from '@nestjs/common';
|
||||
import { WorkshopSubscriptionSchema } from './workshopsubscription.schema';
|
||||
|
||||
@Global()
|
||||
@Module({
|
||||
providers: [WorkshopSubscriptionSchema],
|
||||
exports: [WorkshopSubscriptionSchema],
|
||||
})
|
||||
export class WorkshopSubscriptionModule {}
|
||||
59
src/WorkshopSubscription/workshopsubscription.schema.ts
Normal file
59
src/WorkshopSubscription/workshopsubscription.schema.ts
Normal 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,
|
||||
});
|
||||
},
|
||||
}),
|
||||
}));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user