From da780d249cd0eaf48573eddcaae4d893735c4d0f Mon Sep 17 00:00:00 2001 From: TemuulenBM Date: Fri, 10 Nov 2023 11:41:06 +0800 Subject: [PATCH 1/5] added internal_id in driver model --- addon/models/driver.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addon/models/driver.js b/addon/models/driver.js index ab9f47f..24ceeb2 100644 --- a/addon/models/driver.js +++ b/addon/models/driver.js @@ -21,6 +21,7 @@ export default class DriverModel extends Model { @attr('string') vehicle_id; @attr('string') vendor_id; @attr('string') current_job_id; + @attr('string') internal_id; /** @relationships */ @belongsTo('user', { async: true }) user; From d88f3cb34ba48847d2cec3d35df65eeaa7961ba2 Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Fri, 10 Nov 2023 11:50:46 +0800 Subject: [PATCH 2/5] fix model computed date properties for `OrderModel` --- addon/models/order.js | 68 ++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/addon/models/order.js b/addon/models/order.js index eddb93c..f629569 100644 --- a/addon/models/order.js +++ b/addon/models/order.js @@ -146,7 +146,7 @@ export default class OrderModel extends Model { } @computed('updated_at') get updatedAgo() { - if (!this.updated_at) { + if (!isValidDate(this.updated_at)) { return null; } @@ -154,7 +154,7 @@ export default class OrderModel extends Model { } @computed('updated_at') get updatedAt() { - if (!this.updated_at) { + if (!isValidDate(this.updated_at)) { return null; } @@ -162,7 +162,7 @@ export default class OrderModel extends Model { } @computed('updated_at') get updatedAtShort() { - if (!this.updated_at) { + if (!isValidDate(this.updated_at)) { return null; } @@ -170,7 +170,7 @@ export default class OrderModel extends Model { } @computed('created_at') get createdAgo() { - if (!this.created_at) { + if (!isValidDate(this.created_at)) { return null; } @@ -178,7 +178,7 @@ export default class OrderModel extends Model { } @computed('created_at') get createdAt() { - if (!this.created_at) { + if (!isValidDate(this.created_at)) { return null; } @@ -186,85 +186,93 @@ export default class OrderModel extends Model { } @computed('created_at') get createdAtShort() { - if (!this.created_at) { + if (!isValidDate(this.created_at)) { return null; } return formatDate(this.created_at, 'PP'); } + @computed('created_at') get createdAtWithTime() { + if (!isValidDate(this.created_at)) { + return null; + } + + return formatDate(this.created_at, 'PP HH:mm'); + } + + @computed('created_at') get createdAtDetailed() { + if (!isValidDate(this.created_at)) { + return null; + } + + return formatDate(this.created_at, 'PP HH:mm'); + } + @computed('dispatched_at') get dispatchedAgo() { - if (!this.dispatched_at) { - return 'N/A'; + if (!isValidDate(this.dispatched_at)) { + return null; } return formatDistanceToNow(this.dispatched_at); } @computed('dispatched_at') get dispatchedAt() { - if (!this.dispatched_at) { - return 'N/A'; + if (!isValidDate(this.dispatched_at)) { + return null; } return formatDate(this.dispatched_at, 'PP HH:mm'); } @computed('dispatched_at') get dispatchedAtShort() { - if (!this.dispatched_at) { - return 'N/A'; + if (!isValidDate(this.dispatched_at)) { + return null; } return formatDate(this.dispatched_at, 'PP'); } @computed('started_at') get startedAgo() { - if (!this.started_at) { - return 'N/A'; + if (!isValidDate(this.started_at)) { + return null; } return formatDistanceToNow(this.started_at); } @computed('started_at') get startedAt() { - if (!this.started_at) { - return 'N/A'; + if (!isValidDate(this.started_at)) { + return null; } return formatDate(this.started_at, 'PP HH:mm'); } @computed('started_at') get startedAtShort() { - if (!this.started_at) { - return 'N/A'; + if (!isValidDate(this.started_at)) { + return null; } return formatDate(this.started_at, 'PP'); } @computed('scheduled_at') get scheduledAt() { - if (!this.scheduled_at || !isValidDate(this.scheduled_at)) { - return 'N/A'; + if (!isValidDate(this.scheduled_at)) { + return null; } return formatDate(this.scheduled_at, 'PP HH:mm'); } @computed('scheduled_at') get scheduledAtTime() { - if (!this.scheduled_at || !isValidDate(this.scheduled_at)) { - return 'N/A'; + if (!isValidDate(this.scheduled_at)) { + return null; } return formatDate(this.scheduled_at, 'HH:mm'); } - @computed('created_at') get createdAtWithTime() { - return formatDate(this.created_at, 'PP HH:mm'); - } - - @computed('created_at') get createdAtDetailed() { - return formatDate(this.created_at, 'PP HH:mm'); - } - // eslint-disable-next-line ember/use-brace-expansion @computed('payload.isMultiDrop', 'payload.waypoints.[]', 'payload.pickup_uuid', 'payload.dropoff_uuid') get isMultipleDropoffOrder() { From 928822da2eff43c48c316f20e5fe49e160cfef68 Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Fri, 10 Nov 2023 12:49:29 +0800 Subject: [PATCH 3/5] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a5da2c8..5c8dfb8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fleetbase/fleetops-data", - "version": "0.1.3", + "version": "0.1.4", "description": "Fleetbase Fleet-Ops based models, serializers, transforms, adapters and GeoJson utility functions.", "keywords": [ "fleetbase-data", From 1ddf6d3d727ae9d6d493766bfe2c081a602d8d4c Mon Sep 17 00:00:00 2001 From: TemuulenBM Date: Fri, 10 Nov 2023 14:44:38 +0800 Subject: [PATCH 4/5] added internal_id on contact model --- addon/models/contact.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addon/models/contact.js b/addon/models/contact.js index b4a374f..f41e39f 100644 --- a/addon/models/contact.js +++ b/addon/models/contact.js @@ -7,6 +7,7 @@ export default class ContactModel extends Model { @attr('string') public_id; @attr('string') company_uuid; @attr('string') photo_uuid; + @attr('string') internal_id; /** @relationships */ @belongsTo('file') photo; From c5e344de3468fdbefe801d20aa44d6f57964e44e Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Thu, 16 Nov 2023 18:06:50 +0800 Subject: [PATCH 5/5] make correction to `VehicleModel` --- addon/models/vehicle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon/models/vehicle.js b/addon/models/vehicle.js index 999eff5..eacc9f5 100644 --- a/addon/models/vehicle.js +++ b/addon/models/vehicle.js @@ -40,7 +40,7 @@ export default class VehicleModel extends Model { @attr('string') plate_number; @attr('string') vin; @attr('raw') vin_data; - @attr('raw') model; + @attr('raw') model_data; @attr('raw') telematics; @attr('raw') meta; @attr('string') status;