Property system: - Rename belonging → property throughout (model, controller, routes, service) - Add property sub-models: buildingModel, landModel, belongingModel - Add property lifecycle events: createProperty, deleteProperty - Add propertyStatus component (model, controller, routes, service, seeder) - Add commodity and commodityTransaction model stubs Infrastructure: - Update transactionModel and transactionService - Update events/index.js for new property events - Update seeder (seederDBConnection, seederRunner) - Update typesense client configuration - Update upload utilities (bucket, minio) - Update featureModel and featureSeeder - Update categorySeeder - Update TsApiFeatures utility - Remove docker-compose.yml (moved to root) - Remove legacy belonging component files
47 lines
1.0 KiB
JavaScript
47 lines
1.0 KiB
JavaScript
const mongoose = require('mongoose')
|
|
const ObjectID = mongoose.Schema.Types.ObjectId
|
|
|
|
const featureSchema = new mongoose.Schema({
|
|
nativeName: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
englishName: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
category: {
|
|
type: ObjectID,
|
|
ref: 'Category',
|
|
required: true,
|
|
},
|
|
predefinedValues: [String],
|
|
unit: String,
|
|
isFilterable: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
featureType: {
|
|
type: String,
|
|
enum: ['string', 'textarea', 'boolean', 'number', 'date'],
|
|
default: 'string',
|
|
},
|
|
filterType: {
|
|
type: String,
|
|
enum: ['exact', 'range', 'multi', 'bool'],
|
|
default: 'exact',
|
|
},
|
|
tag: String,
|
|
priority: Number,
|
|
}, {
|
|
toJSON: { virtuals: true },
|
|
toObject: { virtuals: true },
|
|
timestamps: true,
|
|
})
|
|
|
|
featureSchema.index({ englishName: 1, category: 1 }, { unique: true })
|
|
|
|
const Feature = mongoose.model('Feature', featureSchema)
|
|
|
|
module.exports = Feature
|