mirror of
https://github.com/franjsco/umbrello-api
synced 2025-04-13 01:42:07 +02:00
Add city model
This commit is contained in:
parent
a422605344
commit
0dc4a2924f
32
src/db/city.model.js
Normal file
32
src/db/city.model.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import mongoose from 'mongoose';
|
||||||
|
|
||||||
|
const city = {
|
||||||
|
id: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
trim: true,
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
country: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
coord: {
|
||||||
|
lon: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
lat: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const citySchema = mongoose.Schema(city, {
|
||||||
|
collection: 'umbrello_cities',
|
||||||
|
});
|
||||||
|
|
||||||
|
const City = mongoose.model('city', citySchema);
|
||||||
|
|
||||||
|
export default City;
|
Loading…
x
Reference in New Issue
Block a user