Spaces:
Runtime error
Runtime error
| import { Injectable } from '@nestjs/common'; | |
| import { User, Prisma } from '@prisma/client'; | |
| import { PrismaService } from 'src/shared/modules/prisma/prisma.service'; | |
| import { UserCorePaginateDto } from './dto/user-core.dto'; | |
| import { PrismaBaseRepository } from 'src/shared/libs/prisma-base.repository'; | |
| import { UserMessages } from 'src/shared/keys/user.keys'; | |
| () | |
| export class UserCoreService extends PrismaBaseRepository< | |
| User, | |
| UserCorePaginateDto, | |
| Prisma.UserCreateArgs, | |
| Prisma.UserUpdateArgs, | |
| Prisma.UserUpdateManyArgs, | |
| Prisma.UserFindUniqueArgs, | |
| Prisma.UserFindFirstArgs, | |
| Prisma.UserFindManyArgs, | |
| Prisma.UserDeleteArgs, | |
| Prisma.UserDeleteManyArgs, | |
| Prisma.UserCountArgs, | |
| Prisma.UserUpsertArgs | |
| > { | |
| constructor(private prismaService: PrismaService) { | |
| super(prismaService.prisma.user, { | |
| NOT_FOUND: UserMessages.NOT_FOUND, | |
| DELETED: UserMessages.DELETED, | |
| }); | |
| } | |
| async findByEmail(email: string): Promise<User | null> { | |
| return this.findFirst({ | |
| where: { email, isDeleted: false }, | |
| }); | |
| } | |
| async findByPhone(phone: string, code?: string): Promise<User | null> { | |
| return this.findFirst({ | |
| where: { phone, code, isDeleted: false }, | |
| }); | |
| } | |
| async findByUniqueId(uniqueId: string): Promise<User | null> { | |
| return this.findFirst({ | |
| where: { uniqueId, isDeleted: false }, | |
| }); | |
| } | |
| } | |