This commit is contained in:
mahyargdz
2025-09-14 15:15:03 +03:30
commit be82059172
534 changed files with 51310 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import mongoose, { Schema, model } from "mongoose";
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
const AutoIncrement = require("mongoose-sequence")(mongoose);
export interface ICity {
_id: number;
name: string;
province: number;
}
const citySchema = new Schema<ICity>(
{
_id: Number,
name: { type: String, required: true, index: true },
province: { type: Number, ref: "Province", required: true },
},
{ timestamps: true, toJSON: { versionKey: false, virtuals: true }, _id: false, id: false },
);
citySchema.plugin(AutoIncrement, { id: "city_id", inc_field: "_id" });
const CityModel = model<ICity>("City", citySchema);
export { CityModel };