This repository has been archived on 2024-07-10. You can view files and clone it, but cannot push or open issues or pull requests.
backend/models/favorites.js

41 lines
1 KiB
JavaScript
Raw Normal View History

2023-11-18 16:59:43 +00:00
const { default: mongoose } = require("mongoose")
2023-11-22 09:45:06 +00:00
const favoriteSchema = new mongoose.Schema({
user_id: {
type: String,
required: true
},
place_name: String,
2023-11-18 16:59:43 +00:00
location: {
type: {
type: String,
enum: ['Point'],
2023-11-22 09:45:06 +00:00
required: true
2023-11-18 16:59:43 +00:00
},
coordinates: {
type: [Number],
required: true
}
},
2023-11-22 09:45:06 +00:00
wheelchair_access: String,
highway_type: String,
updated_at: { type: Date, default: Date.now }
});
2023-11-18 16:59:43 +00:00
2023-11-22 09:45:06 +00:00
module.exports = mongoose.model('favorites',favoriteSchema)
2023-11-18 16:59:43 +00:00
//ตัวอย่างข้อมูล
// {
// "user_id": "651310bdb59abf1a593e2368",
// "place_name": "Nonthaburi",
// "location": {
// "type": "Point",
// "coordinates": [100.5212, 13.8593] // ลำดับตำแหน่งแรกเป็นลองจิจูดและตำแหน่งที่สองเป็นละติจูด
// },
// "wheelchair_access": "accessible",
// "highway_type": "expressway"
// }