import { Injectable } from '@nestjs/common'; import { PrismaService } from '@/prisma.service'; import { User } from '@prisma/client'; @Injectable() export class UsersService { constructor(private prisma: PrismaService) {} async findAll(): Promise { return this.prisma.user.findMany(); } async findOne(id: number): Promise { return this.prisma.user.findUnique({ where: { id } }); } async create(data: { name: string; email: string }): Promise { return this.prisma.user.create({ data }); } async update( id: number, data: Partial<{ name: string; email: string }>, ): Promise { return this.prisma.user.update({ where: { id }, data }); } async remove(id: number): Promise { return this.prisma.user.delete({ where: { id } }); } }