forked from Yara724/api
Fixed users not being able to view their files
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { InjectModel } from "@nestjs/mongoose";
|
||||
import { FilterQuery, Model, UpdateQuery } from "mongoose";
|
||||
import { buildUserLookupByPhone } from "src/helpers/iran-mobile";
|
||||
import { UserDocument, UserModel } from "../schema/user.schema";
|
||||
|
||||
@Injectable()
|
||||
@@ -17,6 +18,12 @@ export class UserDbService {
|
||||
return await this.userModel.findOne(user);
|
||||
}
|
||||
|
||||
async findAllByPhone(phone: string): Promise<UserModel[]> {
|
||||
return (await this.userModel
|
||||
.find(buildUserLookupByPhone(phone))
|
||||
.lean()) as UserModel[];
|
||||
}
|
||||
|
||||
async findPlate(plate: number) {
|
||||
return await this.userModel.find({ "plates.leftDigits": { $in: plate } });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user