Enforce claim beneficiary access and retire unused legacy APIs

This commit is contained in:
SepehrYahyaee
2026-10-05 14:39:51 +03:30
parent 0735333467
commit a3f9aab8fb
104 changed files with 6864 additions and 13223 deletions
@@ -39,12 +39,4 @@ export class CallCenterAgentDbService {
}
return this.model.findOne({ $or: or });
}
async findAll(
filter: FilterQuery<CallCenterAgentModel>,
): Promise<(CallCenterAgentModel & { _id: Types.ObjectId })[]> {
return this.model.find(filter).lean() as Promise<
(CallCenterAgentModel & { _id: Types.ObjectId })[]
>;
}
}
@@ -40,12 +40,6 @@ export class DamageExpertDbService {
return await this.damageExpertModel.find(filter).lean();
}
async findAndUpdate(filter: any, update: any): Promise<DamageExpertModel> {
return this.damageExpertModel
.findOneAndUpdate(filter, update, { new: true })
.exec();
}
async updateOne(filter: any, update: any) {
return this.damageExpertModel.updateOne(filter, update);
}
@@ -46,31 +46,6 @@ export class ExpertFileActivityDbService {
await this.activityModel.create(payload);
}
async findByTenantAndExperts(
tenantId: string | Types.ObjectId,
expertIds: Array<string | Types.ObjectId>,
): Promise<
Array<{
expertId: Types.ObjectId;
fileId: Types.ObjectId;
eventType: ExpertFileActivityType;
occurredAt: Date;
}>
> {
if (expertIds.length === 0) return [];
const ids = expertIds.map((id) => new Types.ObjectId(String(id)));
return this.activityModel
.find(
{
tenantId: new Types.ObjectId(String(tenantId)),
expertId: { $in: ids },
},
{ expertId: 1, fileId: 1, eventType: 1, occurredAt: 1 },
)
.sort({ occurredAt: 1, _id: 1 })
.lean();
}
/** Activity rows for one expert and file kind (claim or blame panel). */
async findByExpert(
expertId: string | Types.ObjectId,
@@ -26,10 +26,7 @@ export class FileMakerDbService {
identifier: string,
): Promise<FileMakerModel | null> {
const id = identifier.trim();
const or: FilterQuery<FileMakerModel>[] = [
{ email: id },
{ username: id },
];
const or: FilterQuery<FileMakerModel>[] = [{ email: id }, { username: id }];
if (/^\d{10}$/.test(id)) {
or.push({ nationalCode: id });
}
@@ -50,14 +47,4 @@ export class FileMakerDbService {
new: true,
});
}
async findAll(
filter: FilterQuery<FileMakerModel>,
): Promise<(FileMakerModel & { _id: Types.ObjectId })[]> {
return await this.fileMakerModel.find(filter).lean();
}
async updateOne(filter: FilterQuery<FileMakerModel>, update: any) {
return this.fileMakerModel.updateOne(filter, update);
}
}
@@ -50,14 +50,4 @@ export class FileReviewerDbService {
new: true,
});
}
async findAll(
filter: FilterQuery<FileReviewerModel>,
): Promise<(FileReviewerModel & { _id: Types.ObjectId })[]> {
return await this.fileReviewerModel.find(filter).lean();
}
async updateOne(filter: FilterQuery<FileReviewerModel>, update: any) {
return this.fileReviewerModel.updateOne(filter, update);
}
}
@@ -29,12 +29,7 @@ export class RegistrarDbService {
return this.registrarModel.findOneAndUpdate(filter, update, { new: true });
}
async updateOne(filter: FilterQuery<RegistrarModel>, update: any) {
return this.registrarModel.updateOne(filter, update);
}
async findById(userId: string): Promise<RegistrarModel | null> {
return this.registrarModel.findOne({ _id: new Types.ObjectId(userId) });
}
}
@@ -24,10 +24,6 @@ export class UserDbService {
.lean()) as UserModel[];
}
async findPlate(plate: number) {
return await this.userModel.find({ "plates.leftDigits": { $in: plate } });
}
async findOneAndUpdate(
user: FilterQuery<UserModel>,
update: UpdateQuery<UserModel>,