auth services implmented
This commit is contained in:
@@ -1,31 +1,28 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { PrismaService } from '@/prisma.service';
|
||||
import { User } from '@prisma/client';
|
||||
import { PrismaService } from '@/src/prisma.service';
|
||||
import { users } from '@prisma/client';
|
||||
|
||||
@Injectable()
|
||||
export class UsersService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
async findAll(): Promise<User[]> {
|
||||
return this.prisma.user.findMany();
|
||||
async findAll(): Promise<users[]> {
|
||||
return this.prisma.users.findMany();
|
||||
}
|
||||
|
||||
async findOne(id: number): Promise<User | null> {
|
||||
return this.prisma.user.findUnique({ where: { id } });
|
||||
async findOne(id: number): Promise<users | null> {
|
||||
return this.prisma.users.findUnique({ where: { id } });
|
||||
}
|
||||
|
||||
async create(data: { name: string; email: string }): Promise<User> {
|
||||
return this.prisma.user.create({ data });
|
||||
async create(data: any): Promise<users> {
|
||||
return this.prisma.users.create({ data });
|
||||
}
|
||||
|
||||
async update(
|
||||
id: number,
|
||||
data: Partial<{ name: string; email: string }>,
|
||||
): Promise<User> {
|
||||
return this.prisma.user.update({ where: { id }, data });
|
||||
async update(id: number, data: any): Promise<users> {
|
||||
return this.prisma.users.update({ where: { id }, data });
|
||||
}
|
||||
|
||||
async remove(id: number): Promise<User> {
|
||||
return this.prisma.user.delete({ where: { id } });
|
||||
async remove(id: number): Promise<users> {
|
||||
return this.prisma.users.delete({ where: { id } });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user