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 });