forked from Yara724/api
Initial commit after migration to gitea
This commit is contained in:
35
src/sand-hub/entity/db-service/sand-hub.db.service.ts
Normal file
35
src/sand-hub/entity/db-service/sand-hub.db.service.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { InjectModel } from "@nestjs/mongoose";
|
||||
import { Model, Types, UpdateQuery } from "mongoose";
|
||||
import { SandHubInterface, SandHubModel } from "../schema/sand-hub.schema";
|
||||
|
||||
export class SandHubDbService {
|
||||
constructor(
|
||||
@InjectModel(SandHubModel.name)
|
||||
private readonly sandHubModel: Model<SandHubModel>,
|
||||
) {}
|
||||
|
||||
async create(sandHubData: any): Promise<SandHubModel> {
|
||||
return await this.sandHubModel.create(sandHubData);
|
||||
}
|
||||
|
||||
async findOneByRequestId(requestId: string, userId): Promise<SandHubModel> {
|
||||
return await this.sandHubModel.findOne({ requestId, userId });
|
||||
}
|
||||
|
||||
async findOneBySandHubId(requestId: string): Promise<SandHubModel> {
|
||||
return await this.sandHubModel.findOne({
|
||||
_id: new Types.ObjectId(requestId),
|
||||
});
|
||||
}
|
||||
|
||||
async findOneByRequestIdAndUpdate(
|
||||
requestId: string,
|
||||
userId: string,
|
||||
update: UpdateQuery<SandHubInterface>,
|
||||
): Promise<any> {
|
||||
return await this.sandHubModel.findOneAndUpdate(
|
||||
{ requestId, userId },
|
||||
update,
|
||||
);
|
||||
}
|
||||
}
|
||||
307
src/sand-hub/entity/schema/sand-hub.schema.ts
Normal file
307
src/sand-hub/entity/schema/sand-hub.schema.ts
Normal file
@@ -0,0 +1,307 @@
|
||||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
|
||||
import { Types } from "mongoose";
|
||||
import { AddPlateDto } from "src/profile/dto/user/AddPlateDto";
|
||||
|
||||
export interface SandHubInterface {
|
||||
requestId: string;
|
||||
userId: string;
|
||||
PrntPlcyCmpDocNo: string;
|
||||
MapTypNam: string;
|
||||
MtrNum: string;
|
||||
ShsNum: string;
|
||||
DisFnYrNum: string;
|
||||
DisLfYrNum: string;
|
||||
DisPrsnYrNum: string;
|
||||
DisPrsnYrPrcnt: string;
|
||||
DisFnYrPrcnt: string;
|
||||
DisLfYrPrcnt: string;
|
||||
vin: string;
|
||||
MapVehicleSystemName: string;
|
||||
LfCvrCptl: number;
|
||||
FnCvrCptl: number;
|
||||
PrsnCvrCptl: number;
|
||||
VehicleSystemCode: number;
|
||||
EdrsJson: string;
|
||||
PersonCvrCptl: number;
|
||||
LifeCvrCptl: number;
|
||||
FinancialCvrCptl: number;
|
||||
CarGroupCode: number;
|
||||
CylCnt: number;
|
||||
LastCompanyDocumentNumber: string;
|
||||
UsageCode: number;
|
||||
MapUsageCode: number;
|
||||
MapUsageName: string;
|
||||
Plk1: number;
|
||||
Plk2: number;
|
||||
Plk3: number;
|
||||
PlkSrl: number;
|
||||
PrintEndorsCompanyDocumentNumber: string;
|
||||
EndorseDate: Date;
|
||||
InsuranceFullName: string;
|
||||
SystemField: string;
|
||||
TypeField: string;
|
||||
UsageField: string;
|
||||
MainColorField: string;
|
||||
SecondColorField: string;
|
||||
ModelField: string;
|
||||
CapacityField: string;
|
||||
CylinderNumberField: string;
|
||||
EngineNumberField: string;
|
||||
ChassisNumberField: string;
|
||||
VinNumberField: string;
|
||||
InstallDateField: string;
|
||||
AxelNumberField: string;
|
||||
WheelNumberField: string;
|
||||
CompanyName: string;
|
||||
CompanyCode: string;
|
||||
IssueDate: string;
|
||||
SatrtDate: string;
|
||||
EndDate: string;
|
||||
Thrname: string;
|
||||
EndorseText: string;
|
||||
PolicyHealthLossCount: number;
|
||||
PolicyFinancialLossCount: number;
|
||||
PolicyPersonLossCount: number;
|
||||
Tonage: number;
|
||||
ThirdPolicyCode: number;
|
||||
DiscountPersonPercent: number;
|
||||
DiscountThirdPercent: number;
|
||||
SystemCodeCii: number;
|
||||
SystemNameCii: string;
|
||||
TypeCodeCii: number;
|
||||
TypeNameCii: string;
|
||||
UsageNameCii: string;
|
||||
UsageCodeCii: number;
|
||||
ModelCii: number;
|
||||
damageTypes: any[];
|
||||
StatusTypeCode: number;
|
||||
}
|
||||
|
||||
@Schema({ versionKey: false, collection: "sand-hub" })
|
||||
export class SandHubModel {
|
||||
@Prop()
|
||||
requestId: string;
|
||||
|
||||
@Prop()
|
||||
userId: string;
|
||||
|
||||
@Prop()
|
||||
PlateId: Types.ObjectId;
|
||||
|
||||
@Prop()
|
||||
PrntPlcyCmpDocNo: string;
|
||||
|
||||
@Prop()
|
||||
MapTypNam: string;
|
||||
|
||||
@Prop()
|
||||
MtrNum: string;
|
||||
|
||||
@Prop()
|
||||
ShsNum: string;
|
||||
|
||||
@Prop()
|
||||
DisFnYrNum: string;
|
||||
|
||||
@Prop()
|
||||
DisLfYrNum: string;
|
||||
|
||||
@Prop()
|
||||
DisPrsnYrNum: string;
|
||||
|
||||
@Prop()
|
||||
DisPrsnYrPrcnt: string;
|
||||
|
||||
@Prop()
|
||||
DisFnYrPrcnt: string;
|
||||
|
||||
@Prop()
|
||||
DisLfYrPrcnt: string;
|
||||
|
||||
@Prop({ unique: false })
|
||||
vin: string;
|
||||
|
||||
@Prop()
|
||||
MapVehicleSystemName: string;
|
||||
|
||||
@Prop()
|
||||
LfCvrCptl: number;
|
||||
|
||||
@Prop()
|
||||
FnCvrCptl: number;
|
||||
|
||||
@Prop()
|
||||
PrsnCvrCptl: number;
|
||||
|
||||
@Prop()
|
||||
VehicleSystemCode: number;
|
||||
|
||||
@Prop()
|
||||
EdrsJson: string;
|
||||
|
||||
@Prop()
|
||||
PersonCvrCptl: number;
|
||||
|
||||
@Prop()
|
||||
LifeCvrCptl: number;
|
||||
|
||||
@Prop()
|
||||
FinancialCvrCptl: number;
|
||||
|
||||
@Prop()
|
||||
CarGroupCode: number;
|
||||
|
||||
@Prop()
|
||||
CylCnt: number;
|
||||
|
||||
@Prop()
|
||||
LastCompanyDocumentNumber: string;
|
||||
|
||||
@Prop()
|
||||
UsageCode: number;
|
||||
|
||||
@Prop()
|
||||
MapUsageCode: number;
|
||||
|
||||
@Prop()
|
||||
MapUsageName: string;
|
||||
|
||||
@Prop()
|
||||
Plk1: number;
|
||||
|
||||
@Prop()
|
||||
Plk2: number;
|
||||
|
||||
@Prop()
|
||||
Plk3: number;
|
||||
|
||||
@Prop()
|
||||
PlkSrl: number;
|
||||
|
||||
@Prop()
|
||||
PrintEndorsCompanyDocumentNumber: string;
|
||||
|
||||
@Prop()
|
||||
EndorseDate: Date;
|
||||
|
||||
@Prop()
|
||||
InsuranceFullName: string;
|
||||
|
||||
@Prop()
|
||||
SystemField: string;
|
||||
|
||||
@Prop()
|
||||
TypeField: string;
|
||||
|
||||
@Prop()
|
||||
UsageField: string;
|
||||
|
||||
@Prop()
|
||||
MainColorField: string;
|
||||
|
||||
@Prop()
|
||||
SecondColorField: string;
|
||||
|
||||
@Prop()
|
||||
ModelField: string;
|
||||
|
||||
@Prop()
|
||||
CapacityField: string;
|
||||
|
||||
@Prop()
|
||||
CylinderNumberField: string;
|
||||
|
||||
@Prop()
|
||||
EngineNumberField: string;
|
||||
|
||||
@Prop()
|
||||
ChassisNumberField: string;
|
||||
|
||||
@Prop()
|
||||
VinNumberField: string;
|
||||
|
||||
@Prop()
|
||||
InstallDateField: string;
|
||||
|
||||
@Prop()
|
||||
AxelNumberField: string;
|
||||
|
||||
@Prop()
|
||||
WheelNumberField: string;
|
||||
|
||||
@Prop()
|
||||
CompanyName: string;
|
||||
|
||||
@Prop()
|
||||
CompanyCode: string;
|
||||
|
||||
@Prop()
|
||||
IssueDate: string;
|
||||
|
||||
@Prop()
|
||||
SatrtDate: string;
|
||||
|
||||
@Prop()
|
||||
EndDate: string;
|
||||
|
||||
@Prop()
|
||||
Thrname: string;
|
||||
|
||||
@Prop()
|
||||
EndorseText: string;
|
||||
|
||||
@Prop()
|
||||
PolicyHealthLossCount: number;
|
||||
|
||||
@Prop()
|
||||
PolicyFinancialLossCount: number;
|
||||
|
||||
@Prop()
|
||||
PolicyPersonLossCount: number;
|
||||
|
||||
@Prop()
|
||||
Tonage: number;
|
||||
|
||||
@Prop()
|
||||
ThirdPolicyCode: number;
|
||||
|
||||
@Prop()
|
||||
DiscountPersonPercent: number;
|
||||
|
||||
@Prop()
|
||||
DiscountThirdPercent: number;
|
||||
|
||||
@Prop()
|
||||
SystemCodeCii: number;
|
||||
|
||||
@Prop()
|
||||
SystemNameCii: string;
|
||||
|
||||
@Prop()
|
||||
TypeCodeCii: number;
|
||||
|
||||
@Prop()
|
||||
TypeNameCii: string;
|
||||
|
||||
@Prop()
|
||||
UsageNameCii: string;
|
||||
|
||||
@Prop()
|
||||
UsageCodeCii: number;
|
||||
|
||||
@Prop()
|
||||
ModelCii: number;
|
||||
|
||||
@Prop()
|
||||
damageTypes: any[];
|
||||
|
||||
@Prop()
|
||||
StatusTypeCode: number;
|
||||
|
||||
@Prop({ type: Object })
|
||||
plate: AddPlateDto["plate"];
|
||||
|
||||
@Prop()
|
||||
nationalCode: string;
|
||||
}
|
||||
export const SandHubSchema = SchemaFactory.createForClass(SandHubModel);
|
||||
Reference in New Issue
Block a user