@forgetman505/ttwashcar-order 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/order.js +18 -1
- package/package.json +1 -1
package/order.js
CHANGED
|
@@ -56,4 +56,21 @@ function formatOrders(orders = []) {
|
|
|
56
56
|
return orders.map(order => formatOrder(order))
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
// 字段映射:驼峰(数据库) -> 下划线(model)
|
|
60
|
+
function mapDbToModel(order) {
|
|
61
|
+
if (!order) return null
|
|
62
|
+
return {
|
|
63
|
+
car_number: order.carNumber || '',
|
|
64
|
+
car_type: order.carType || CarType.NONE,
|
|
65
|
+
address: order.address || '',
|
|
66
|
+
amount: order.amount || 0,
|
|
67
|
+
status: order.status || OrderStatus.PENDING,
|
|
68
|
+
employee_id: order.employee_id || '',
|
|
69
|
+
images: order.images || [],
|
|
70
|
+
create_time: order.create_time || order.createdAt || null,
|
|
71
|
+
request_time: order.request_time || order.requestTime || null,
|
|
72
|
+
wash_type: order.washType || ''
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
module.exports = { createOrder, formatOrder, formatOrders, OrderStatus, CarType, mapDbToModel }
|