mirror of
https://gitlab.com/little-lines/backend.git
synced 2024-11-25 06:06:51 +00:00
40 lines
1 KiB
JavaScript
40 lines
1 KiB
JavaScript
const { default: mongoose } = require("mongoose")
|
|
|
|
const favoriteSchema = new mongoose.Schema({
|
|
user_id: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
place_name: String,
|
|
location: {
|
|
type: {
|
|
type: String,
|
|
enum: ['Point'],
|
|
required: true
|
|
},
|
|
coordinates: {
|
|
type: [Number],
|
|
required: true
|
|
}
|
|
},
|
|
wheelchair_access: String,
|
|
highway_type: String,
|
|
updated_at: { type: Date, default: Date.now }
|
|
});
|
|
|
|
|
|
|
|
|
|
module.exports = mongoose.model('favorites',favoriteSchema)
|
|
|
|
//ตัวอย่างข้อมูล
|
|
// {
|
|
// "user_id": "651310bdb59abf1a593e2368",
|
|
// "place_name": "Nonthaburi",
|
|
// "location": {
|
|
// "type": "Point",
|
|
// "coordinates": [100.5212, 13.8593] // ลำดับตำแหน่งแรกเป็นลองจิจูดและตำแหน่งที่สองเป็นละติจูด
|
|
// },
|
|
// "wheelchair_access": "accessible",
|
|
// "highway_type": "expressway"
|
|
// }
|