Your IP : 216.73.216.220


Current Path : /home/deltalab/PMS/buy-button-generator/models/mongoose/
Upload File :
Current File : //home/deltalab/PMS/buy-button-generator/models/mongoose/warehouse-journal.js

const mongoose = require('mongoose');

// SCHEMA ============================================
const WarehouseJournalSchema = new mongoose.Schema(
  {
    date                : Date,
    warehouseId           : {
                            type: mongoose.Schema.Types.ObjectId,
                            required: true,
                            ref: 'Warehouse'
                        },
    partnerId           : {
                          type: mongoose.Schema.Types.ObjectId,
                          required: true,
                          ref: 'Partner'
                        },
    productId           : {
                          type: mongoose.Schema.Types.ObjectId,
                          required: true,
                          ref: 'Product'
                        },
    variation           : Number,
    totalQuantity       : Number,
    reason              : { 
                          type: String, 
                          enum: [
                            'INITIAL', 
                            'INCREASE', 
                            'DECREASE', 
                            'ORDER', 
                            'RETURN',
                          ]
                          },
                        },
  {
    timestamps: true,
    versionKey: false
  }
)

// MODELS ============================================
const warehouseJournalModel  = mongoose.model('WarehouseJournal', WarehouseJournalSchema);

// EXPORTS ===========================================
module.exports = {
  warehouseJournalModel,
  WarehouseJournalSchema
};