full
This commit is contained in:
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user