import { Injectable } from '@nestjs/common'; import { TrpcService } from '@server/trpc/trpc.service'; import { CommentService } from './comment.service'; import { Prisma } from '@nice/common'; import { z, ZodType } from 'zod'; const CommentUncheckedCreateInputSchema: ZodType = z.any(); const CommentWhereInputSchema: ZodType = z.any(); const CommentSelectSchema: ZodType = z.any(); const CommentUpdateArgsSchema: ZodType = z.any(); const CommentFindFirstArgsSchema: ZodType = z.any(); const CommentFindManyArgsSchema: ZodType = z.any(); @Injectable() export class CommentRouter { constructor( private readonly trpc: TrpcService, private readonly commentService: CommentService, ) {} router = this.trpc.router({ create: this.trpc.procedure .input(CommentUncheckedCreateInputSchema) .mutation(async ({ input }) => { console.log(input); return this.commentService.create({ data: input }); }), update: this.trpc.procedure .input(CommentUpdateArgsSchema) .mutation(async ({ input }) => { return this.commentService.update(input); }), findMany: this.trpc.procedure .input(CommentFindManyArgsSchema) .query(async ({ input }) => { return this.commentService.findMany(input); }), softDeleteByIds: this.trpc.procedure .input(z.object({ ids: z.array(z.string()) })) .mutation(async ({ input }) => { return this.commentService.softDeleteByIds(input.ids); }), findFirst: this.trpc.procedure .input(CommentFindFirstArgsSchema) .query(async ({ input }) => { return this.commentService.findFirst(input); }), }); }