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
@@ -1,7 +1,7 @@
import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { FilterQuery, Model, UpdateQuery } from 'mongoose';
import { BlameDocumentModel } from '../schema/blame-document.schema';
import { Injectable } from "@nestjs/common";
import { InjectModel } from "@nestjs/mongoose";
import { Model } from "mongoose";
import { BlameDocumentModel } from "../schema/blame-document.schema";
@Injectable()
export class BlameDocumentDbService {
@@ -10,27 +10,14 @@ export class BlameDocumentDbService {
private readonly blameDocumentModel: Model<BlameDocumentModel>,
) {}
async create(createDto: Partial<BlameDocumentModel>): Promise<BlameDocumentModel> {
async create(
createDto: Partial<BlameDocumentModel>,
): Promise<BlameDocumentModel> {
const newDocument = new this.blameDocumentModel(createDto);
return newDocument.save();
}
async findOne(filter: FilterQuery<BlameDocumentModel>): Promise<BlameDocumentModel | null> {
return this.blameDocumentModel.findOne(filter).lean();
}
async findAll(filter: FilterQuery<BlameDocumentModel>): Promise<BlameDocumentModel[]> {
return this.blameDocumentModel.find(filter).lean();
}
async findById(id: string): Promise<BlameDocumentModel | null> {
return this.blameDocumentModel.findById(id).lean();
}
async findByIdAndUpdate(
id: string,
updateDto: UpdateQuery<BlameDocumentModel>,
): Promise<BlameDocumentModel | null> {
return this.blameDocumentModel.findByIdAndUpdate(id, updateDto, { new: true }).lean();
}
}
}
@@ -17,12 +17,6 @@ export class BlameRequestDbService {
return this.blameRequestModel.create(payload);
}
async findOne(
filter: FilterQuery<BlameRequest>,
): Promise<BlameRequestDocument | null> {
return this.blameRequestModel.findOne(filter);
}
async findById(
id: string | Types.ObjectId,
): Promise<BlameRequestDocument | null> {
@@ -16,10 +16,6 @@ export class BlameVideoDbService {
return await this.blameVideoModel.findOne(new Types.ObjectId(id));
}
async findOneByRequestId(id: string): Promise<BlameVideosModel> {
return await this.blameVideoModel.findById(id);
}
async findById(id: string): Promise<BlameVideosModel | null> {
return this.blameVideoModel.findById(id).lean();
}
@@ -8,12 +8,6 @@ export class RequestManagementDbService {
private readonly requestModel: Model<RequestManagementModel>,
) {}
async create(
request: RequestManagementModel,
): Promise<RequestManagementModel> {
return await this.requestModel.create(request);
}
async findOne(id: string) {
return await this.requestModel.findOne(new Types.ObjectId(id));
}
@@ -22,21 +16,6 @@ export class RequestManagementDbService {
return await this.requestModel.find({ ...filter });
}
async findAllAndPagination(query, currentPage, resPerPage?) {
const responsePerPage = resPerPage | 1;
const skipPge = responsePerPage * (Number(currentPage) - 1);
return await this.requestModel
.find(query)
.limit(responsePerPage)
.skip(skipPge);
}
async countByFilter(
filter: FilterQuery<RequestManagementModel>,
): Promise<number> {
return await this.requestModel.countDocuments(filter);
}
async findAndUpdate(
filter: FilterQuery<RequestManagementModel>,
update: UpdateQuery<RequestManagementModel>,
@@ -83,12 +62,4 @@ export class RequestManagementDbService {
update,
);
}
async aggregate(filter?) {
return await this.requestModel.aggregate(filter);
}
async updateMany(filter?, update?) {
return await this.requestModel.updateMany(filter, update);
}
}
@@ -1,5 +1,5 @@
import { InjectModel } from "@nestjs/mongoose";
import { Model, Types } from "mongoose";
import { Model } from "mongoose";
import { UserSignModel } from "../schema/sign.schema";
export class UserSignDbService {
@@ -12,10 +12,6 @@ export class UserSignDbService {
return await this.blameVoiceModel.create(sign);
}
async findOne(id: string): Promise<UserSignModel> {
return await this.blameVoiceModel.findOne(new Types.ObjectId(id));
}
async findById(id: string): Promise<UserSignModel | null> {
// Use your correct Model type
return this.blameVoiceModel.findById(id).lean();