forked from Yara724/api
Initial commit after migration to gitea
This commit is contained in:
110
src/users/entities/db-service/damage-expert.db.service.ts
Normal file
110
src/users/entities/db-service/damage-expert.db.service.ts
Normal file
@@ -0,0 +1,110 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { InjectModel } from "@nestjs/mongoose";
|
||||
import { FilterQuery, Model, Types } from "mongoose";
|
||||
import { RegisterDto } from "src/auth/dto/actor/register.actor.dto";
|
||||
import { ExpertModel } from "src/users/entities/schema/expert.schema";
|
||||
import { DamageExpertModel } from "../schema/damage-expert.schema";
|
||||
import { UserModel } from "../schema/user.schema";
|
||||
|
||||
@Injectable()
|
||||
export class DamageExpertDbService {
|
||||
constructor(
|
||||
@InjectModel(DamageExpertModel.name)
|
||||
private readonly damageExpertModel: Model<DamageExpertModel>,
|
||||
) {}
|
||||
|
||||
async create(user: RegisterDto): Promise<DamageExpertModel> {
|
||||
return await this.damageExpertModel.create(user);
|
||||
}
|
||||
|
||||
async findOne(user: FilterQuery<ExpertModel>): Promise<DamageExpertModel> {
|
||||
return await this.damageExpertModel.findOne(user);
|
||||
}
|
||||
|
||||
async findById(userId: string): Promise<DamageExpertModel> {
|
||||
return await this.damageExpertModel.findOne({
|
||||
_id: new Types.ObjectId(userId),
|
||||
});
|
||||
}
|
||||
|
||||
async findOneAndUpdate(
|
||||
user: FilterQuery<DamageExpertModel>,
|
||||
update: FilterQuery<DamageExpertModel>,
|
||||
): Promise<UserModel> {
|
||||
return await this.damageExpertModel.findOneAndUpdate(user, update);
|
||||
}
|
||||
|
||||
async findAll(
|
||||
filter: FilterQuery<DamageExpertModel>,
|
||||
): Promise<(DamageExpertModel & { _id: Types.ObjectId })[]> {
|
||||
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 updateStats(
|
||||
expertId: string,
|
||||
type: "checked" | "handled",
|
||||
requestId: string,
|
||||
) {
|
||||
if (!expertId || !requestId || !["checked", "handled"].includes(type)) {
|
||||
console.warn("Invalid expertId, requestId, or type");
|
||||
return;
|
||||
}
|
||||
|
||||
const expert = await this.damageExpertModel.findById(expertId);
|
||||
if (!expert) {
|
||||
console.warn("Expert not found:", expertId);
|
||||
return;
|
||||
}
|
||||
|
||||
const requestIdStr = new Types.ObjectId(requestId).toString();
|
||||
const countedRequests =
|
||||
expert.countedRequests?.map((r) => r.toString()) || [];
|
||||
|
||||
if (type === "checked" && countedRequests.includes(requestIdStr)) {
|
||||
console.log(
|
||||
`Request ${requestIdStr} already checked for expert ${expertId}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const update: any = { $inc: {}, $push: {} };
|
||||
|
||||
if (type === "checked") {
|
||||
update.$inc["requestStats.totalChecked"] = 1;
|
||||
update.$push["countedRequests"] = requestIdStr;
|
||||
} else if (type === "handled") {
|
||||
update.$inc["requestStats.totalHandled"] = 1;
|
||||
|
||||
if (countedRequests.includes(requestIdStr)) {
|
||||
update.$inc["requestStats.totalChecked"] = -1;
|
||||
}
|
||||
|
||||
if (!countedRequests.includes(requestIdStr)) {
|
||||
update.$push["countedRequests"] = requestIdStr;
|
||||
} else {
|
||||
delete update.$push;
|
||||
}
|
||||
}
|
||||
|
||||
const result = await this.damageExpertModel.findByIdAndUpdate(
|
||||
expertId,
|
||||
update,
|
||||
);
|
||||
|
||||
if (!result) {
|
||||
console.warn("Failed to update stats for expert:", expertId);
|
||||
} else {
|
||||
console.log(`Stats updated (${type}) for expert:`, expertId);
|
||||
}
|
||||
}
|
||||
|
||||
async updateOne(filter: any, update: any) {
|
||||
return this.damageExpertModel.updateOne(filter, update);
|
||||
}
|
||||
}
|
||||
83
src/users/entities/db-service/expert.db.service.ts
Normal file
83
src/users/entities/db-service/expert.db.service.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { InjectModel } from "@nestjs/mongoose";
|
||||
import { FilterQuery, Model, Types } from "mongoose";
|
||||
import { RegisterDto } from "src/auth/dto/actor/register.actor.dto";
|
||||
import { ExpertModel } from "src/users/entities/schema/expert.schema";
|
||||
import { UserModel } from "../schema/user.schema";
|
||||
|
||||
@Injectable()
|
||||
export class ExpertDbService {
|
||||
constructor(
|
||||
@InjectModel(ExpertModel.name)
|
||||
private readonly expertModel: Model<ExpertModel>,
|
||||
) {}
|
||||
|
||||
async create(user: RegisterDto): Promise<ExpertModel> {
|
||||
return await this.expertModel.create(user);
|
||||
}
|
||||
|
||||
async findOne(user: FilterQuery<ExpertModel>): Promise<ExpertModel> {
|
||||
return await this.expertModel.findOne(user).lean();
|
||||
}
|
||||
|
||||
async findOneAndUpdate(
|
||||
user: FilterQuery<ExpertModel>,
|
||||
update: FilterQuery<ExpertModel>,
|
||||
): Promise<UserModel> {
|
||||
return await this.expertModel.findOneAndUpdate(user, update);
|
||||
}
|
||||
|
||||
async findAll(
|
||||
filter: FilterQuery<ExpertModel>,
|
||||
): Promise<(ExpertModel & { _id: Types.ObjectId })[]> {
|
||||
return await this.expertModel.find(filter).lean();
|
||||
}
|
||||
|
||||
async updateStats(
|
||||
expertId: string,
|
||||
type: "checked" | "handled",
|
||||
requestId: string,
|
||||
) {
|
||||
if (!expertId || !requestId || !["checked", "handled"].includes(type)) {
|
||||
console.warn("Invalid expertId, requestId, or type");
|
||||
return;
|
||||
}
|
||||
|
||||
const expert = await this.expertModel.findById(expertId);
|
||||
if (!expert) {
|
||||
console.warn("Expert not found:", expertId);
|
||||
return;
|
||||
}
|
||||
|
||||
const requestIdStr = new Types.ObjectId(requestId).toString();
|
||||
const counted = (expert.countedRequests || []).map((r) => r.toString());
|
||||
|
||||
if (counted.includes(requestIdStr)) {
|
||||
console.log("Request already counted for expert:", requestIdStr);
|
||||
return;
|
||||
}
|
||||
|
||||
const updateField =
|
||||
type === "handled"
|
||||
? {
|
||||
"requestStats.totalHandled": 1,
|
||||
"requestStats.totalChecked": -1,
|
||||
}
|
||||
: { "requestStats.totalChecked": 1 };
|
||||
|
||||
const result = await this.expertModel.findByIdAndUpdate(expertId, {
|
||||
$inc: updateField,
|
||||
$push: { countedRequests: requestIdStr },
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
console.warn("Failed to update expert stats for:", expertId);
|
||||
} else {
|
||||
console.log("Updated stats for expert:", expertId);
|
||||
}
|
||||
}
|
||||
|
||||
async updateOne(filter: any, update: any) {
|
||||
return this.expertModel.updateOne(filter, update);
|
||||
}
|
||||
}
|
||||
20
src/users/entities/db-service/insurer-expert.db.service.ts
Normal file
20
src/users/entities/db-service/insurer-expert.db.service.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { InjectModel } from "@nestjs/mongoose";
|
||||
import { FilterQuery, Model } from "mongoose";
|
||||
import { InsurerExpertModel } from "../schema/insurer-expert.schema";
|
||||
|
||||
@Injectable()
|
||||
export class InsurerExpertDbService {
|
||||
constructor(
|
||||
@InjectModel(InsurerExpertModel.name)
|
||||
private readonly insurerExpert: Model<InsurerExpertModel>,
|
||||
) {}
|
||||
|
||||
async create(insurerExpert: any) {
|
||||
return await this.insurerExpert.create(insurerExpert);
|
||||
}
|
||||
|
||||
async findOne(filter: FilterQuery<InsurerExpertModel>) {
|
||||
return await this.insurerExpert.findOne(filter);
|
||||
}
|
||||
}
|
||||
30
src/users/entities/db-service/user.db.service.ts
Normal file
30
src/users/entities/db-service/user.db.service.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { InjectModel } from "@nestjs/mongoose";
|
||||
import { FilterQuery, Model, UpdateQuery } from "mongoose";
|
||||
import { UserDocument, UserModel } from "../schema/user.schema";
|
||||
|
||||
@Injectable()
|
||||
export class UserDbService {
|
||||
constructor(
|
||||
@InjectModel(UserModel.name) private readonly userModel: Model<UserModel>,
|
||||
) {}
|
||||
|
||||
async createUser(user: UserModel): Promise<UserModel> {
|
||||
return await this.userModel.create(user);
|
||||
}
|
||||
|
||||
async findOne(user: FilterQuery<UserModel>): Promise<UserDocument> {
|
||||
return await this.userModel.findOne(user);
|
||||
}
|
||||
|
||||
async findPlate(plate: number) {
|
||||
return await this.userModel.find({ "plates.leftDigits": { $in: plate } });
|
||||
}
|
||||
|
||||
async findOneAndUpdate(
|
||||
user: FilterQuery<UserModel>,
|
||||
update: UpdateQuery<UserModel>,
|
||||
): Promise<any> {
|
||||
return await this.userModel.findOneAndUpdate(user, update);
|
||||
}
|
||||
}
|
||||
197
src/users/entities/schema/damage-expert.schema.ts
Normal file
197
src/users/entities/schema/damage-expert.schema.ts
Normal file
@@ -0,0 +1,197 @@
|
||||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
|
||||
import { Types } from "mongoose";
|
||||
import {
|
||||
ExpertizedAtEnum,
|
||||
PreviousWorkEnum,
|
||||
SkillEnum,
|
||||
} from "src/Types&Enums/damage-expert.enum";
|
||||
import { RoleEnum } from "src/Types&Enums/role.enum";
|
||||
import { UserType } from "src/Types&Enums/userType.enum";
|
||||
|
||||
@Schema({ _id: false })
|
||||
export class RequestStats {
|
||||
@Prop({ default: 0 })
|
||||
totalHandled: number;
|
||||
|
||||
@Prop({ default: 0 })
|
||||
totalChecked: number;
|
||||
}
|
||||
|
||||
const RequestStatsSchema = SchemaFactory.createForClass(RequestStats);
|
||||
|
||||
@Schema({ _id: false })
|
||||
export class PersonalInfo {
|
||||
@Prop({ type: "string" })
|
||||
fullName: string;
|
||||
|
||||
@Prop({ type: "string" })
|
||||
nationalCode: string;
|
||||
|
||||
@Prop({ type: "string" })
|
||||
dob: string;
|
||||
|
||||
@Prop({ type: "string" })
|
||||
mobile: string;
|
||||
}
|
||||
|
||||
const PersonalInfoSchema = SchemaFactory.createForClass(PersonalInfo);
|
||||
|
||||
@Schema({ _id: false })
|
||||
export class PersonalDocs {
|
||||
@Prop({ type: "string" })
|
||||
nationalCard?: string;
|
||||
|
||||
@Prop({ type: "string" })
|
||||
selfie?: string;
|
||||
|
||||
@Prop({ type: "string" })
|
||||
activityCert?: string;
|
||||
}
|
||||
|
||||
const PersonalDocsSchema = SchemaFactory.createForClass(PersonalDocs);
|
||||
|
||||
@Schema({ _id: false })
|
||||
export class WorkExperience {
|
||||
@Prop({ type: Number })
|
||||
state: number;
|
||||
|
||||
@Prop({ type: Number })
|
||||
city: number;
|
||||
|
||||
@Prop({
|
||||
type: [{ type: String, enum: ExpertizedAtEnum }],
|
||||
default: [],
|
||||
})
|
||||
expertizedAt: ExpertizedAtEnum[];
|
||||
}
|
||||
|
||||
const WorkExperienceSchema = SchemaFactory.createForClass(WorkExperience);
|
||||
|
||||
@Schema({ _id: false })
|
||||
export class WorkRecords {
|
||||
@Prop({ type: Number })
|
||||
workingYears: number;
|
||||
|
||||
@Prop({ type: Number })
|
||||
casesCount: number;
|
||||
|
||||
@Prop({ type: String, enum: PreviousWorkEnum })
|
||||
previousWork: PreviousWorkEnum;
|
||||
}
|
||||
|
||||
const WorkRecordsSchema = SchemaFactory.createForClass(WorkRecords);
|
||||
|
||||
@Schema({ _id: false })
|
||||
export class FinancialInfo {
|
||||
@Prop({ type: "string" })
|
||||
IBAN: string;
|
||||
|
||||
@Prop({ type: "string" })
|
||||
cardNum: string;
|
||||
|
||||
@Prop({ type: "string" })
|
||||
accountNum: string;
|
||||
}
|
||||
|
||||
const FinancialInfoSchema = SchemaFactory.createForClass(FinancialInfo);
|
||||
|
||||
@Schema({ collection: "damage-expert", versionKey: false, timestamps: true })
|
||||
export class DamageExpertModel {
|
||||
@Prop({ required: true })
|
||||
userType: UserType;
|
||||
|
||||
@Prop({ required: true })
|
||||
firstName: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
role: RoleEnum;
|
||||
|
||||
@Prop({ required: true })
|
||||
lastName: string;
|
||||
|
||||
@Prop({ unique: true })
|
||||
nationalCode: string;
|
||||
|
||||
@Prop({ type: "string", unique: true })
|
||||
email: string;
|
||||
|
||||
@Prop({ type: "string" })
|
||||
username: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
password: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
mobile: string;
|
||||
|
||||
@Prop({ required: false })
|
||||
insuActivityCo?: string | null;
|
||||
|
||||
@Prop({ type: Types.ObjectId })
|
||||
clientKey?: Types.ObjectId;
|
||||
|
||||
@Prop({ type: PersonalInfoSchema })
|
||||
personalInfo?: PersonalInfo;
|
||||
|
||||
@Prop({ type: PersonalDocsSchema })
|
||||
personalDocs?: PersonalDocs;
|
||||
|
||||
@Prop({ type: WorkExperienceSchema })
|
||||
workExperience?: WorkExperience;
|
||||
|
||||
@Prop({ type: WorkRecordsSchema })
|
||||
workRecords?: WorkRecords;
|
||||
|
||||
@Prop({
|
||||
type: [{ type: String, enum: SkillEnum }],
|
||||
default: [],
|
||||
})
|
||||
skills?: SkillEnum[];
|
||||
|
||||
@Prop({ type: FinancialInfoSchema })
|
||||
financialInfo?: FinancialInfo;
|
||||
|
||||
@Prop({ type: "string" })
|
||||
otp: string;
|
||||
|
||||
@Prop({ type: "string" })
|
||||
address: string;
|
||||
|
||||
@Prop({ type: "string" })
|
||||
state: string;
|
||||
|
||||
@Prop({ type: "string" })
|
||||
city: string;
|
||||
|
||||
@Prop({ type: RequestStatsSchema, default: () => ({}) })
|
||||
requestStats: RequestStats;
|
||||
|
||||
@Prop({
|
||||
type: [{ type: String }],
|
||||
default: [],
|
||||
validate: {
|
||||
validator: (arr: any[]) => arr.every((val) => typeof val === "string"),
|
||||
message: "All countedRequests must be strings",
|
||||
},
|
||||
})
|
||||
countedRequests?: string[];
|
||||
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
export const DamageExpertDbSchema =
|
||||
SchemaFactory.createForClass(DamageExpertModel);
|
||||
|
||||
DamageExpertDbSchema.pre("save", function (next) {
|
||||
if (!this.username) {
|
||||
this.username = this.email;
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
||||
DamageExpertDbSchema.pre("save", function (next) {
|
||||
if (!this.requestStats) {
|
||||
this.requestStats = { totalChecked: 0, totalHandled: 0 };
|
||||
}
|
||||
next();
|
||||
});
|
||||
105
src/users/entities/schema/expert.schema.ts
Normal file
105
src/users/entities/schema/expert.schema.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
|
||||
import { Degrees } from "src/Types&Enums/degrees.enum";
|
||||
import { RoleEnum } from "src/Types&Enums/role.enum";
|
||||
import { UserType } from "src/Types&Enums/userType.enum";
|
||||
|
||||
@Schema({ _id: false })
|
||||
export class RequestStats {
|
||||
@Prop({ default: 0 })
|
||||
totalHandled: number;
|
||||
|
||||
@Prop({ default: 0 })
|
||||
totalChecked: number;
|
||||
}
|
||||
|
||||
const RequestStatsSchema = SchemaFactory.createForClass(RequestStats);
|
||||
|
||||
@Schema({ collection: "expert", versionKey: false, timestamps: true })
|
||||
export class ExpertModel {
|
||||
@Prop({})
|
||||
firstName: string;
|
||||
|
||||
@Prop({})
|
||||
role: RoleEnum;
|
||||
|
||||
@Prop({})
|
||||
userType: UserType;
|
||||
|
||||
@Prop({})
|
||||
lastName: string;
|
||||
|
||||
@Prop({ unique: true })
|
||||
nationalCode: string;
|
||||
|
||||
@Prop({ type: "string", unique: true })
|
||||
email: string;
|
||||
|
||||
@Prop({})
|
||||
password: string;
|
||||
|
||||
@Prop({})
|
||||
sheba: string;
|
||||
|
||||
@Prop({})
|
||||
phone: string;
|
||||
|
||||
@Prop({})
|
||||
mobile: string;
|
||||
|
||||
@Prop({})
|
||||
city: string;
|
||||
|
||||
@Prop({})
|
||||
state: string;
|
||||
|
||||
@Prop({})
|
||||
address: string;
|
||||
|
||||
@Prop({ type: String })
|
||||
expDegree: Degrees;
|
||||
|
||||
@Prop({})
|
||||
insuActivityTime?: number;
|
||||
|
||||
@Prop({})
|
||||
insuActivityCo?: string;
|
||||
|
||||
@Prop({})
|
||||
policeActivityTime?: number;
|
||||
|
||||
@Prop({})
|
||||
policeActivityKind?: string;
|
||||
|
||||
@Prop({})
|
||||
policeServicePlace?: string;
|
||||
|
||||
@Prop({})
|
||||
clientKey?: string;
|
||||
|
||||
@Prop({ type: "string" })
|
||||
otp: string;
|
||||
|
||||
@Prop({ type: RequestStatsSchema, default: () => ({}) })
|
||||
requestStats: RequestStats;
|
||||
|
||||
@Prop({
|
||||
type: [{ type: String }],
|
||||
default: [],
|
||||
validate: {
|
||||
validator: (arr: any[]) => arr.every((val) => typeof val === "string"),
|
||||
message: "All countedRequests must be strings",
|
||||
},
|
||||
})
|
||||
countedRequests?: string[];
|
||||
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
export const ExpertDbSchema = SchemaFactory.createForClass(ExpertModel);
|
||||
|
||||
ExpertDbSchema.pre("save", function (next) {
|
||||
if (!this.requestStats) {
|
||||
this.requestStats = { totalChecked: 0, totalHandled: 0 };
|
||||
}
|
||||
next();
|
||||
});
|
||||
32
src/users/entities/schema/insurer-expert.schema.ts
Normal file
32
src/users/entities/schema/insurer-expert.schema.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
|
||||
import { Types } from "mongoose";
|
||||
import { RoleEnum } from "src/Types&Enums/role.enum";
|
||||
|
||||
@Schema({
|
||||
collection: "insurer-expert",
|
||||
versionKey: false,
|
||||
timestamps: true,
|
||||
})
|
||||
export class InsurerExpertModel {
|
||||
@Prop()
|
||||
firstName: string;
|
||||
|
||||
@Prop()
|
||||
lastName: string;
|
||||
|
||||
@Prop({ unique: true, required: true })
|
||||
email: string;
|
||||
|
||||
@Prop()
|
||||
password: string;
|
||||
|
||||
@Prop()
|
||||
role: RoleEnum;
|
||||
|
||||
@Prop()
|
||||
clientKey: Types.ObjectId;
|
||||
|
||||
createdAt: Date;
|
||||
}
|
||||
export const InsurerExpertDbSchema =
|
||||
SchemaFactory.createForClass(InsurerExpertModel);
|
||||
57
src/users/entities/schema/user.schema.ts
Normal file
57
src/users/entities/schema/user.schema.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
|
||||
import { Types } from "mongoose";
|
||||
import { Plates } from "src/Types&Enums/plate.interface";
|
||||
|
||||
export type UserDocument = UserModel & Document;
|
||||
|
||||
@Schema({ collection: "user", versionKey: false })
|
||||
export class UserModel {
|
||||
@Prop({ type: String, unique: true })
|
||||
username: string;
|
||||
|
||||
@Prop({})
|
||||
otp: string;
|
||||
|
||||
@Prop({ default: 0 })
|
||||
otpExpire: number | null;
|
||||
|
||||
@Prop({ type: Object })
|
||||
tokens: {
|
||||
token: string;
|
||||
rfToken: string;
|
||||
};
|
||||
|
||||
@Prop()
|
||||
fullName: string;
|
||||
|
||||
@Prop({ type: String })
|
||||
mobile: string;
|
||||
|
||||
@Prop({ unique: false })
|
||||
nationalCode: string;
|
||||
|
||||
@Prop({ type: Array })
|
||||
plates?: Plates[];
|
||||
|
||||
@Prop()
|
||||
lastLogin: Date;
|
||||
|
||||
@Prop()
|
||||
clientKey: Types.ObjectId;
|
||||
|
||||
@Prop()
|
||||
birthDay: string;
|
||||
|
||||
@Prop()
|
||||
gender?: "male" | "female";
|
||||
|
||||
@Prop()
|
||||
city: string;
|
||||
|
||||
@Prop()
|
||||
address: string;
|
||||
|
||||
@Prop()
|
||||
state: string;
|
||||
}
|
||||
export const UserDbSchema = SchemaFactory.createForClass(UserModel);
|
||||
46
src/users/users.module.ts
Normal file
46
src/users/users.module.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { Module } from "@nestjs/common";
|
||||
import { MongooseModule } from "@nestjs/mongoose";
|
||||
import { DamageExpertDbService } from "src/users/entities/db-service/damage-expert.db.service";
|
||||
import { ExpertModel } from "src/users/entities/schema/expert.schema";
|
||||
import { HashModule } from "src/utils/hash/hash.module";
|
||||
import { OtpModule } from "src/utils/otp/otp.module";
|
||||
import { ExpertDbService } from "./entities/db-service/expert.db.service";
|
||||
import { InsurerExpertDbService } from "./entities/db-service/insurer-expert.db.service";
|
||||
import { UserDbService } from "./entities/db-service/user.db.service";
|
||||
import {
|
||||
DamageExpertDbSchema,
|
||||
DamageExpertModel,
|
||||
} from "./entities/schema/damage-expert.schema";
|
||||
import { ExpertDbSchema } from "./entities/schema/expert.schema";
|
||||
import {
|
||||
InsurerExpertDbSchema,
|
||||
InsurerExpertModel,
|
||||
} from "./entities/schema/insurer-expert.schema";
|
||||
import { UserModel, UserDbSchema } from "./entities/schema/user.schema";
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
MongooseModule.forFeature([
|
||||
{ name: UserModel.name, schema: UserDbSchema },
|
||||
{ name: DamageExpertModel.name, schema: DamageExpertDbSchema },
|
||||
{ name: ExpertModel.name, schema: ExpertDbSchema },
|
||||
{ name: InsurerExpertModel.name, schema: InsurerExpertDbSchema },
|
||||
]),
|
||||
OtpModule,
|
||||
HashModule,
|
||||
],
|
||||
controllers: [],
|
||||
providers: [
|
||||
UserDbService,
|
||||
ExpertDbService,
|
||||
DamageExpertDbService,
|
||||
InsurerExpertDbService,
|
||||
],
|
||||
exports: [
|
||||
UserDbService,
|
||||
ExpertDbService,
|
||||
DamageExpertDbService,
|
||||
InsurerExpertDbService,
|
||||
],
|
||||
})
|
||||
export class UsersModule {}
|
||||
Reference in New Issue
Block a user