/var/www/verywell.gr/server/delivery/api/responseModels/order
Edit: /var/www/verywell.gr/server/delivery/api/responseModels/order/orderHeaderDrivers.model.js (2065B)
const { isSet } = require('../../utils/validator.util')
module.exports = class OrderHeaderDrivers {
constructor({
branchId,
companyId,
driverId,
userId,
uid,
status,
total,
branch,
company,
payType,
payTypeId,
deliveryPayType,
deliveryPayTypeId,
deliveryType,
deliveryTypeId,
pay_status_order,
pay_status_delivery,
user,
orderCancelCauseId,
orderCancelCause,
orderAddress,
table,
orderItems
}) {
this.uid = uid || 0
this.driverId = driverId || 0
this.status = status || ORDER_STATUS.NEW
this.total = parseFloat(total).toFixed(2) || 0
this.phone = isSet(user) && isSet(user.userPhones) ? '+'+user.userPhones[0].phone || '' : ''
this.orderCancelCauseId = orderCancelCauseId || 0
this.orderCancelCause = orderCancelCause ? orderCancelCause.name : ''
this.payTypeId = payTypeId ? payTypeId : 0
this.payTypeName = payType ? payType.name : ''
this.deliveryPayTypeId = deliveryPayTypeId ? deliveryPayTypeId : 0
this.deliveryPayTypeName = deliveryPayType ? deliveryPayType.name : ''
this.deliveryPayTypeKey = deliveryPayType ? deliveryPayType.key : ''
this.deliveryTypeId = deliveryTypeId ? deliveryTypeId : 0
this.deliveryTypeName = deliveryType ? deliveryType.name : ''
this.deliveryTypeKey = deliveryType ? deliveryType.key : ''
this.pay_status_order = pay_status_order || ORDER_PAY_STATUS.NOT_PAID
this.pay_status_delivery = pay_status_delivery || ORDER_PAY_STATUS_DELIVERY.NOT_PAID
this.address = isSet(orderAddress) ? orderAddress.adres : ''
this.latitude = isSet(orderAddress) ? parseFloat(orderAddress.latitude) : 0
this.longtitude = isSet(orderAddress) ? parseFloat(orderAddress.longtitude) : 0
this.branchId = branchId || 0
this.branchUid = isSet(branch) ? branch.uid : ''
this.branchName = isSet(branch) ? branch.name : ''
this.companyId = companyId || 0
this.companyName = isSet(company) ? company.name : ''
this.userId = userId || 0
this.userName = isSet(user) ? user.name : ''
this.table = table || {}
this.orderItems = orderItems || {}
}
}