updated and runned and tested

This commit is contained in:
2025-07-25 09:57:16 +03:00
parent 5a47a06c0e
commit 8ca2d34dc6
35 changed files with 12456 additions and 2 deletions

View File

@@ -0,0 +1,31 @@
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<User[]> {
return this.prisma.user.findMany();
}
async findOne(id: number): Promise<User | null> {
return this.prisma.user.findUnique({ where: { id } });
}
async create(data: { name: string; email: string }): Promise<User> {
return this.prisma.user.create({ data });
}
async update(
id: number,
data: Partial<{ name: string; email: string }>,
): Promise<User> {
return this.prisma.user.update({ where: { id }, data });
}
async remove(id: number): Promise<User> {
return this.prisma.user.delete({ where: { id } });
}
}