This commit is contained in:
payacom
2026-08-31 20:45:41 +03:30
parent fa9f23c61d
commit 3f416a7a60
367 changed files with 621895 additions and 6443 deletions

View File

@@ -1,19 +1,35 @@
const mongoose = require('mongoose')
const countriesSchema = new mongoose.Schema({
id: Number,
iso2: String,
name: String,
name_fa: String,
slug: String
})
const provincesSchema = new mongoose.Schema({
id: Number,
name: String,
slug: String
// نام به زبان خودِ کشور (فعلاً فقط برای ایران پر شده) — برای نمایش مستقل از زبان رابط کاربری
name_fa: String,
slug: String,
// Iran (source_id 103 in data/geo/countries.json) for every pre-existing province, so
// callers that don't pass a country filter keep seeing exactly the old Iran-only list.
country_id: { type: Number, default: null }
})
const citiesSchema = new mongoose.Schema({
id: Number,
name: String,
name_fa: String,
slug: String,
province_id: Number
province_id: Number,
country_id: { type: Number, default: null }
})
const CountryModel = mongoose.model('Country', countriesSchema)
const ProvinceModel = mongoose.model('Province', provincesSchema)
const CityModel = mongoose.model('City', citiesSchema)
module.exports = { ProvinceModel, CityModel }
module.exports = { CountryModel, ProvinceModel, CityModel }