Fixed VIN placement for when the users use vin-based inquiry

This commit is contained in:
SepehrYahyaee
2026-08-10 12:14:51 +03:30
parent 210e96fcf1
commit ca7200e17d
3 changed files with 9 additions and 3 deletions

View File

@@ -53,6 +53,8 @@ export const PersonSchema = SchemaFactory.createForClass(Person);
@Schema({ _id: false })
export class Vehicle {
@Prop() plateId?: string;
/** VIN / chassis number — populated only when the inquiry was performed via VIN lookup. */
@Prop() vin?: string;
@Prop() name?: string;
@Prop() model?: string;
@Prop() type?: string;

View File

@@ -501,6 +501,9 @@ export class InquiryRefreshService {
if (memParty.vehicle?.plateId !== undefined) {
party.vehicle.plateId = memParty.vehicle.plateId;
}
if (memParty.vehicle?.vin !== undefined) {
party.vehicle.vin = memParty.vehicle.vin;
}
blameDoc.markModified(`parties.${docIdx}.vehicle`);
if (memParty.insurance) {

View File

@@ -1842,8 +1842,8 @@ export class RequestManagementService {
if (!party.vehicle) party.vehicle = {} as any;
party.vehicle.isNew = body.isNewCar;
// Store VIN as the vehicle identifier instead of plate
party.vehicle.plateId = body.vin;
// Store VIN in vehicle.vin; leave plateId empty for VIN-based inquiries
party.vehicle.vin = body.vin;
party.vehicle.name = inquiryMapped?.MapTypNam;
party.vehicle.type = `${inquiryMapped?.UsageField} / ${inquiryMapped?.MapUsageName || "-"}`;
party.vehicle.inquiry = {
@@ -9508,7 +9508,8 @@ export class RequestManagementService {
(party.person as any).licenseType = (partyData as any).licenseType;
if (!party.vehicle) party.vehicle = {} as any;
party.vehicle.plateId = partyData.vin; // store VIN as vehicle identifier
// Store VIN in vehicle.vin; leave plateId empty for VIN-based inquiries
party.vehicle.vin = partyData.vin;
party.vehicle.name = inquiryMapped?.MapTypNam;
party.vehicle.type = `${inquiryMapped?.UsageField ?? ""} / ${inquiryMapped?.UsageName ?? inquiryMapped?.MapUsageName ?? "-"}`;
party.vehicle.inquiry = {