1
0
forked from Yara724/api

Fixed users not being able to view their files

This commit is contained in:
2026-06-19 09:50:42 +03:30
parent 0c5756d325
commit 3c863bb90c
12 changed files with 745 additions and 222 deletions

View File

@@ -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 } });
}