Init commit

This commit is contained in:
2024-12-22 16:52:30 +03:30
parent 28ab698dfc
commit aeb38982ca
28 changed files with 1532 additions and 68 deletions
+40
View File
@@ -0,0 +1,40 @@
const mongoose = require('mongoose')
const ObjectID = mongoose.Schema.Types.ObjectId
const belongingSchema = new mongoose.Schema(
{
belongingCode: {
type: String,
required: true,
unique: true,
},
belongingCategory: {
type: ObjectID,
ref: 'Category'
},
projectCode: {
type: String,
required: true,
default: false,
},
relatedProjects : [String],
location: {
type: {
type: String,
enum: ['Point'], // GeoJSON type
required: true,
},
coordinates: {
type: [Number], // Array of numbers: [longitude, latitude]
required: true,
},
},
documents: [String]
},
{ timestamps: true }
)
belongingSchema.index({ location: '2dsphere' }); // Enable geospatial queries
const Belonging = mongoose.model('Belonging', belongingSchema)
module.exports = Belonging