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:
@@ -0,0 +1,48 @@
|
||||
const mongoose = require('mongoose')
|
||||
const ObjectID = mongoose.Schema.Types.ObjectId
|
||||
|
||||
const commodityTransactionSchema = new mongoose.Schema(
|
||||
{
|
||||
commodity: {
|
||||
type: ObjectID,
|
||||
ref: 'Commodity',
|
||||
required: true,
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
enum: ['IN', 'OUT', 'TRANSFER'], // ورود، خروج، انتقال بین انبارها
|
||||
required: true,
|
||||
},
|
||||
count: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
unit: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
sourceWarehouse: {
|
||||
type: ObjectID,
|
||||
ref: 'Warehouse',
|
||||
},
|
||||
destinationWarehouse: {
|
||||
type: ObjectID,
|
||||
ref: 'Warehouse',
|
||||
},
|
||||
user: {
|
||||
type: ObjectID,
|
||||
ref: 'User',
|
||||
},
|
||||
date: {
|
||||
type: Date,
|
||||
default: Date.now,
|
||||
},
|
||||
description: String,
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
}
|
||||
)
|
||||
|
||||
const CommodityTransaction = mongoose.model('CommodityTransaction', commodityTransactionSchema)
|
||||
module.exports = CommodityTransaction
|
||||
Reference in New Issue
Block a user