允许userService进行or查询
This commit is contained in:
@@ -3,6 +3,8 @@ import { InjectRepository } from '@nestjs/typeorm';
|
|||||||
import { User } from './user.entity';
|
import { User } from './user.entity';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
|
|
||||||
|
type UserFindOptions = Partial<Pick<User, 'userId' | 'username' | 'phone' | 'email'>>;
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UserService {
|
export class UserService {
|
||||||
constructor(
|
constructor(
|
||||||
@@ -10,7 +12,7 @@ export class UserService {
|
|||||||
private readonly userRepository: Repository<User>,
|
private readonly userRepository: Repository<User>,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
async findOne(options: Partial<Pick<User, 'userId' | 'username' | 'phone' | 'email'>>): Promise<User | null> {
|
async findOne(options: UserFindOptions | UserFindOptions[]): Promise<User | null> {
|
||||||
if (Object.keys(options).length === 0) {
|
if (Object.keys(options).length === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user