/var/www/greso.tech/server/nsm/responseModels/order
Edit: /var/www/greso.tech/server/nsm/responseModels/order/order.model.js (4391B)
const UserShortModel = require('../user/userShort.model')
const BranchShortModel = require('../branch/branchShort.model')
const RateAreaShortModel = require('../rate_area/rateAreaShort.model')
const { isSet } = require('../../utils/validator.util')
module.exports = class OrderModel {
constructor({
id,
companyId,
updateUserId,
userId,
number,
reference_number,
app,
salesRep,
qa,
salesRepId,
qaId,
status,
company,
pay_status_order,
user,
destinationUser,
destinationUserId,
pickupAddressId,
deliveryAddressId,
pickupArea,
deliveryArea,
pickupAreaId,
deliveryAreaId,
pickupAddress,
deliveryAddress,
hold,
orderType,
followUpDate,
pickupDateFrom,
pickupDateTo,
deliveryDateFrom,
deliveryDateTo,
loadingDate,
deliveryDate,
createdAt,
updatedAt,
estimateAt,
bookedAt,
confirmedAt,
onsiteAt,
pickedUpAt,
pickupAt,
warehouseUnloadingAt,
warehouseAt,
storageAt,
loadingAt,
enrouteAt,
arrivedAt,
qaAt,
payAt,
unloadingAt,
completeAt,
cancelAt,
orderInventories,
orderDocuments,
warehouseId,
warehouse,
providerId,
provider,
orderInventoryId,
orderEstimateChargesId,
orderReviceChargesId,
orderDeliveryChargesId,
inventory,
inventories,
payments,
movements,
movementId,
}) {
this.id = id || ''
this.qaId = qaId || ''
this.salesRepId = salesRepId || ''
this.pay_status_order = pay_status_order || 'no_pay'
this.orderType = orderType || ''
this.number = number || ''
this.reference_number = reference_number || ''
this.app = app || 'crm'
this.salesRep = salesRep
this.qa = qa
this.status = status || ORDER_STATUS.NEW
this.companyId = companyId || ''
this.company = company
this.userId = userId || ''
this.updateUserId = updateUserId || ''
this.destinationUserId = destinationUserId || ''
this.orderDocuments = orderDocuments || []
this.orderInventories = orderInventories || []
this.payments = payments || []
this.movements = movements || []
this.movementId = movementId || ''
this.providerId = providerId || ''
this.provider = provider
this.warehouseId = warehouseId || ''
this.warehouse = warehouse
this.inventoryId = orderInventoryId || ''
this.estimateChargesId = orderEstimateChargesId || ''
this.reviceChargesId = orderReviceChargesId || ''
this.deliveryChargesId = orderDeliveryChargesId || ''
this.inventory = inventory
this.inventories = inventories
this.user = user != null ? new UserShortModel(user) : null
this.destinationUser = destinationUser != null ? new UserShortModel(destinationUser) : null
this.pickupArea = pickupArea != null ? new RateAreaShortModel(pickupArea) : null
this.deliveryArea = deliveryArea != null ? new RateAreaShortModel(deliveryArea) : null
this.pickupAddress = pickupAddress
this.deliveryAddress = deliveryAddress
this.pickupAreaId = pickupAreaId
this.deliveryAreaId = deliveryAreaId
this.pickupAddressId = pickupAddressId
this.deliveryAddressId = deliveryAddressId
this.hold = hold || false
this.followUpDate = followUpDate || ''
this.pickupDateFrom = pickupDateFrom || ''
this.pickupDateTo = pickupDateTo || ''
this.deliveryDateFrom = deliveryDateFrom || ''
this.deliveryDateTo = deliveryDateTo || ''
this.loadingDate = loadingDate || ''
this.deliveryDate = deliveryDate || ''
this.createdAt = isSet(createdAt) ? createdAt : ''
this.updatedAt = isSet(updatedAt) ? updatedAt : ''
this.estimateAt = isSet(estimateAt) ? estimateAt : ''
this.bookedAt = isSet(bookedAt) ? bookedAt : ''
this.confirmedAt = isSet(confirmedAt) ? confirmedAt : ''
this.onsiteAt = isSet(onsiteAt) ? onsiteAt : ''
this.pickupAt = isSet(pickupAt) ? pickupAt : ''
this.pickedUpAt = isSet(pickedUpAt) ? pickedUpAt : ''
this.warehouseUnloadingAt = isSet(warehouseUnloadingAt) ? warehouseUnloadingAt : ''
this.warehouseAt = isSet(warehouseAt) ? warehouseAt : ''
this.storageAt = isSet(storageAt) ? storageAt : ''
this.loadingAt = isSet(loadingAt) ? loadingAt : ''
this.enrouteAt = isSet(enrouteAt) ? enrouteAt : ''
this.arrivedAt = isSet(arrivedAt) ? arrivedAt : ''
this.payAt = isSet(payAt) ? payAt : ''
this.qaAt = isSet(qaAt) ? qaAt : ''
this.unloadingAt = isSet(unloadingAt) ? unloadingAt : ''
this.completeAt = isSet(completeAt) ? completeAt : ''
this.cancelAt = isSet(cancelAt) ? cancelAt : ''
}
}