module.exports = mongoose => { var routeCustomerListSchema = mongoose.Schema({ customer_id: String, customer_name: String, customer_address: String, customer_avatar: String, customer_group: String, customer_group_address: String, customer_type: String, customer_pickup_status: String, customer_note: String, customer_special_needs: String, customer_phone: String, customer_enter_center_time: Date, customer_leave_center_time: Date, customer_pickup_time: Date, customer_dropoff_time: Date, customer_route_status: String, customer_pickup_order: Number, customer_table_id: String, customer_estimated_pickup_time: String, customer_estimated_dropoff_time: String }); var schema = mongoose.Schema( { name: String, vehicle: String, driver: String, type: String, route_customer_list: [{ type: routeCustomerListSchema }], status: String, site: Number }, { collection: 'route_path_template', timestamps: true } ); schema.method("toJSON", function() { const { __v, _id, ...object } = this.toObject(); object.id = _id; return object; }); const RoutePathTemplate = mongoose.model("route_path_template", schema); return RoutePathTemplate; };