REFACTOR: Belonging → Property system migration + utilities update
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
This commit is contained in:
@@ -34,10 +34,9 @@ const transactionSchema = new mongoose.Schema(
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
belongingId: {
|
||||
propertyId: {
|
||||
type: ObjectID,
|
||||
ref: 'Belonging',
|
||||
required: true,
|
||||
ref: 'Property',
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -47,14 +46,11 @@ const transactionSchema = new mongoose.Schema(
|
||||
}
|
||||
)
|
||||
|
||||
// Add individual indexes for frequently queried fields
|
||||
transactionSchema.index({ type: 1 })
|
||||
transactionSchema.index({ status: 1 })
|
||||
transactionSchema.index({ value: 1 })
|
||||
|
||||
// Add compound indexes for common query patterns in aggregation
|
||||
transactionSchema.index({ belongingId: 1, status: 1 })
|
||||
transactionSchema.index({ belongingId: 1, type: 1, status: 1 })
|
||||
transactionSchema.index({ propertyId: 1, status: 1 })
|
||||
transactionSchema.index({ propertyId: 1, type: 1, status: 1 })
|
||||
|
||||
const Transaction = mongoose.model('Transaction', transactionSchema)
|
||||
module.exports = Transaction
|
||||
|
||||
Reference in New Issue
Block a user