forked from Yara724/api
112 lines
3.0 KiB
TypeScript
112 lines
3.0 KiB
TypeScript
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
|
|
import { HydratedDocument } from "mongoose";
|
|
import type { FanavaranClientKey } from "src/core/config/fanavaran-client.config";
|
|
|
|
@Schema({ _id: false })
|
|
export class FanavaranAuthConfigEmbed {
|
|
@Prop({ type: String, required: true })
|
|
appName: string;
|
|
|
|
@Prop({ type: String, required: true })
|
|
secret: string;
|
|
|
|
@Prop({ type: String, required: true })
|
|
username: string;
|
|
|
|
@Prop({ type: String, required: true })
|
|
password: string;
|
|
|
|
@Prop({ type: String, required: true })
|
|
corpId: string;
|
|
|
|
@Prop({ type: String, required: true })
|
|
contractId: string;
|
|
|
|
@Prop({ type: String, required: true })
|
|
location: string;
|
|
}
|
|
export const FanavaranAuthConfigEmbedSchema = SchemaFactory.createForClass(
|
|
FanavaranAuthConfigEmbed,
|
|
);
|
|
|
|
@Schema({ _id: false })
|
|
export class FanavaranPayloadDefaultsEmbed {
|
|
@Prop({ type: Number, required: true })
|
|
AccidentCityId: number;
|
|
|
|
@Prop({ type: Number, required: true })
|
|
AccidentReportTypeId: number;
|
|
|
|
@Prop({ type: Number, required: true })
|
|
AccidentVehicleUsedId: number;
|
|
|
|
/**
|
|
* GEN.03 base claim — کارشناس مسئول پرونده مالی
|
|
* (Parsian example: 154 / 4662 — NOT the assessor role).
|
|
*/
|
|
@Prop({ type: Number, required: true })
|
|
ClaimExpertId: number;
|
|
|
|
/**
|
|
* GEN.08 expertise — کارشناس ارزیاب خسارت ثالث مالی (or وکیل/تحقیق).
|
|
* (Parsian example: 29; Tejaratno proven send: 2709).
|
|
*/
|
|
@Prop({ type: Number, required: true })
|
|
ExpertiseClaimExpertId: number;
|
|
|
|
@Prop({ type: Number, required: true })
|
|
CompensationReferenceId: number;
|
|
|
|
@Prop({ type: Number, required: true })
|
|
CulpritLicenceTypeId: number;
|
|
|
|
@Prop({ type: Number, required: true })
|
|
CulpritTypeId: number;
|
|
|
|
@Prop({ type: Number, required: true })
|
|
DmgCaseTypeId: number;
|
|
|
|
@Prop({ type: Number, required: true })
|
|
DmgHistoryStatus: number;
|
|
|
|
@Prop({ type: Number, required: true })
|
|
PlaqueKindId: number;
|
|
|
|
@Prop({ type: Number, required: true })
|
|
PlaqueSampleId: number;
|
|
|
|
@Prop({ type: Number, required: true })
|
|
DriverIsOwner: number;
|
|
|
|
@Prop({ type: Number, required: true })
|
|
FaultPercent: number;
|
|
|
|
@Prop({ type: Number, required: true })
|
|
ClaimFileTypeId: number;
|
|
}
|
|
export const FanavaranPayloadDefaultsEmbedSchema = SchemaFactory.createForClass(
|
|
FanavaranPayloadDefaultsEmbed,
|
|
);
|
|
|
|
/**
|
|
* Per-tenant Fanavaran auth + payload defaults.
|
|
* Seeded on boot when missing; edit in Mongo without redeploying code.
|
|
*/
|
|
@Schema({ collection: "fanavaranClientConfigs", timestamps: true })
|
|
export class FanavaranClientConfig {
|
|
@Prop({ type: String, required: true, unique: true, index: true })
|
|
key: FanavaranClientKey;
|
|
|
|
@Prop({ type: FanavaranAuthConfigEmbedSchema, required: true })
|
|
auth: FanavaranAuthConfigEmbed;
|
|
|
|
@Prop({ type: FanavaranPayloadDefaultsEmbedSchema, required: true })
|
|
defaults: FanavaranPayloadDefaultsEmbed;
|
|
}
|
|
|
|
export type FanavaranClientConfigDocument =
|
|
HydratedDocument<FanavaranClientConfig>;
|
|
export const FanavaranClientConfigSchema = SchemaFactory.createForClass(
|
|
FanavaranClientConfig,
|
|
);
|