import { Injectable } from '@nestjs/common'; import { TrpcService } from '@server/trpc/trpc.service'; import { Prisma, UpdateOrderSchema } from '@nice/common'; import { EnrollmentService } from './enrollment.service'; import { z, ZodType } from 'zod'; import { EnrollSchema, UnenrollSchema } from './enroll.schema'; const EnrollmentCreateArgsSchema: ZodType = z.any() const EnrollmentCreateManyInputSchema: ZodType = z.any() const EnrollmentDeleteManyArgsSchema: ZodType = z.any() const EnrollmentFindManyArgsSchema: ZodType = z.any() const EnrollmentFindFirstArgsSchema: ZodType = z.any() const EnrollmentWhereInputSchema: ZodType = z.any() const EnrollmentSelectSchema: ZodType = z.any() @Injectable() export class EnrollmentRouter { constructor( private readonly trpc: TrpcService, private readonly enrollmentService: EnrollmentService, ) { } router = this.trpc.router({ findFirst: this.trpc.procedure .input(EnrollmentFindFirstArgsSchema) // Assuming StaffMethodSchema.findMany is the Zod schema for finding staffs by keyword .query(async ({ input }) => { return await this.enrollmentService.findFirst(input); }), findMany: this.trpc.procedure .input(EnrollmentFindManyArgsSchema) // Assuming StaffMethodSchema.findMany is the Zod schema for finding staffs by keyword .query(async ({ input }) => { return await this.enrollmentService.findMany(input); }), findManyWithCursor: this.trpc.protectProcedure .input(z.object({ cursor: z.any().nullish(), take: z.number().nullish(), where: EnrollmentWhereInputSchema.nullish(), select: EnrollmentSelectSchema.nullish() })) .query(async ({ ctx, input }) => { const { staff } = ctx; return await this.enrollmentService.findManyWithCursor(input); }), enroll: this.trpc.protectProcedure .input(EnrollSchema) .mutation(async ({ input }) => { return await this.enrollmentService.enroll(input); }), unenroll: this.trpc.protectProcedure .input(UnenrollSchema) .mutation(async ({ input }) => { return await this.enrollmentService.unenroll(input); }), }); }