lookup vehicle-kinds added

This commit is contained in:
2026-09-28 17:09:45 +03:30
parent efef48d824
commit 7a8d96ab52
10 changed files with 614 additions and 10 deletions

View File

@@ -0,0 +1,63 @@
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
import { Document } from "mongoose";
export type VehicleKindDocument = VehicleKindModel & Document;
/**
* One Fanavaran vehicle-kind row per document.
* Collection: `vehicle-kinds`
*/
@Schema({ versionKey: false, collection: "vehicle-kinds", timestamps: true })
export class VehicleKindModel {
@Prop({ required: true, unique: true })
Id: number;
@Prop({ required: true })
Caption: string;
/**
* Normalized Caption for case-/yeh-insensitive substring search.
* Indexed for active dropdown queries.
*/
@Prop({ required: true, index: true })
captionSearch: string;
@Prop({ required: true, index: true })
IsActive: number;
@Prop()
CylinderCount?: number | null;
@Prop()
PassengerCount?: number | null;
@Prop()
Tonnage?: number | null;
@Prop()
VehicleCategoryCaption?: string | null;
@Prop()
VehicleGroupId?: number | null;
@Prop()
VehicleSystemCaption?: string | null;
@Prop()
VehicleSystemId?: number | null;
/** When this row was last written from Fanavaran / cache sync. */
@Prop({ required: true, index: true })
syncedAt: Date;
@Prop()
createdAt?: Date;
@Prop()
updatedAt?: Date;
}
export const VehicleKindSchema = SchemaFactory.createForClass(VehicleKindModel);
VehicleKindSchema.index({ IsActive: 1, captionSearch: 1 });
VehicleKindSchema.index({ IsActive: 1, Caption: 1 });