@tmscloud/tbt-knex 0.0.2 → 0.0.4
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/dist/dao/driver-tracking/driver-tracking.dao.d.ts +17 -12
- package/dist/dao/driver-tracking/driver-tracking.dao.js +107 -123
- package/dist/dao/driver-tracking/driver-tracking.dao.js.map +1 -1
- package/dist/dao/event/event.dao.js +3 -9
- package/dist/dao/event/event.dao.js.map +1 -1
- package/dist/dao/trip/trip.dao.d.ts +5 -0
- package/dist/dao/trip/trip.dao.js +10 -0
- package/dist/dao/trip/trip.dao.js.map +1 -1
- package/dist/dao/trip-track/trip-track.dao.d.ts +49 -0
- package/dist/dao/trip-track/trip-track.dao.js +252 -0
- package/dist/dao/trip-track/trip-track.dao.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/interfaces/driver-tracking/driver-tracking.interfaces.d.ts +23 -44
- package/dist/interfaces/trip/trip.interfaces.d.ts +2 -0
- package/dist/interfaces/trip-track/trip-track.interfaces.d.ts +82 -0
- package/dist/interfaces/{gps-location/gps-location.interfaces.js → trip-track/trip-track.interfaces.js} +1 -1
- package/dist/interfaces/trip-track/trip-track.interfaces.js.map +1 -0
- package/package.json +1 -1
- package/dist/dao/gps-location/gps-location.dao.d.ts +0 -76
- package/dist/dao/gps-location/gps-location.dao.js +0 -364
- package/dist/dao/gps-location/gps-location.dao.js.map +0 -1
- package/dist/interfaces/gps-location/gps-location.interfaces.d.ts +0 -30
- package/dist/interfaces/gps-location/gps-location.interfaces.js.map +0 -1
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { IGPSLocation, IGPSLocationWithDistance, ITripLocationSummary } from "../../interfaces/gps-location/gps-location.interfaces";
|
|
2
|
-
import { IBaseDAO, IDataPaginator } from "../../d.types";
|
|
3
|
-
export declare class GPSLocationDAO implements IBaseDAO<IGPSLocation> {
|
|
4
|
-
private _knex?;
|
|
5
|
-
private get knex();
|
|
6
|
-
/**
|
|
7
|
-
* Parse JSON fields from database
|
|
8
|
-
*/
|
|
9
|
-
private parseLocationJson;
|
|
10
|
-
/**
|
|
11
|
-
* Base query with joins
|
|
12
|
-
*/
|
|
13
|
-
private baseQuery;
|
|
14
|
-
/**
|
|
15
|
-
* Get all GPS locations with pagination
|
|
16
|
-
*/
|
|
17
|
-
getAll(page?: number, limit?: number): Promise<IDataPaginator<IGPSLocation>>;
|
|
18
|
-
/**
|
|
19
|
-
* Get GPS location by ID
|
|
20
|
-
*/
|
|
21
|
-
getById(id: number): Promise<IGPSLocation | null>;
|
|
22
|
-
/**
|
|
23
|
-
* Get GPS location by UUID
|
|
24
|
-
*/
|
|
25
|
-
getByUuid(uuid: string): Promise<IGPSLocation | null>;
|
|
26
|
-
/**
|
|
27
|
-
* Get current location for a trip
|
|
28
|
-
*/
|
|
29
|
-
getCurrentLocationByTripId(tripId: number): Promise<IGPSLocation | null>;
|
|
30
|
-
/**
|
|
31
|
-
* Get location history for a trip
|
|
32
|
-
*/
|
|
33
|
-
getLocationHistoryByTripId(tripId: number, page?: number, limit?: number): Promise<IDataPaginator<IGPSLocation>>;
|
|
34
|
-
/**
|
|
35
|
-
* Get recent locations for a trip (last N locations)
|
|
36
|
-
*/
|
|
37
|
-
getRecentLocationsByTripId(tripId: number, limit?: number): Promise<IGPSLocation[]>;
|
|
38
|
-
/**
|
|
39
|
-
* Get locations by user ID
|
|
40
|
-
*/
|
|
41
|
-
getLocationsByUserId(userId: number, page?: number, limit?: number): Promise<IDataPaginator<IGPSLocation>>;
|
|
42
|
-
/**
|
|
43
|
-
* Get trip location summary
|
|
44
|
-
*/
|
|
45
|
-
getTripLocationSummary(tripId: number): Promise<ITripLocationSummary | null>;
|
|
46
|
-
/**
|
|
47
|
-
* Create a new GPS location
|
|
48
|
-
*/
|
|
49
|
-
create(data: IGPSLocation): Promise<IGPSLocation>;
|
|
50
|
-
/**
|
|
51
|
-
* Update a GPS location by ID
|
|
52
|
-
*/
|
|
53
|
-
update(id: number, data: Partial<IGPSLocation>): Promise<IGPSLocation | null>;
|
|
54
|
-
/**
|
|
55
|
-
* Delete a GPS location by ID
|
|
56
|
-
*/
|
|
57
|
-
delete(id: number): Promise<boolean>;
|
|
58
|
-
/**
|
|
59
|
-
* Delete old GPS locations (older than specified hours)
|
|
60
|
-
*/
|
|
61
|
-
deleteOldLocations(hoursOld?: number): Promise<number>;
|
|
62
|
-
/**
|
|
63
|
-
* Calculate distance between two GPS coordinates using Haversine formula
|
|
64
|
-
* Returns distance in kilometers
|
|
65
|
-
*/
|
|
66
|
-
private calculateDistance;
|
|
67
|
-
private toRad;
|
|
68
|
-
/**
|
|
69
|
-
* Calculate total distance traveled for a trip
|
|
70
|
-
*/
|
|
71
|
-
calculateTripDistance(tripId: number): Promise<number>;
|
|
72
|
-
/**
|
|
73
|
-
* Get location history with distances
|
|
74
|
-
*/
|
|
75
|
-
getLocationHistoryWithDistances(tripId: number): Promise<IGPSLocationWithDistance[]>;
|
|
76
|
-
}
|
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.GPSLocationDAO = void 0;
|
|
16
|
-
const KnexConnection_1 = __importDefault(require("../../KnexConnection"));
|
|
17
|
-
class GPSLocationDAO {
|
|
18
|
-
get knex() {
|
|
19
|
-
if (!this._knex) {
|
|
20
|
-
this._knex = KnexConnection_1.default.getConnection();
|
|
21
|
-
}
|
|
22
|
-
return this._knex;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Parse JSON fields from database
|
|
26
|
-
*/
|
|
27
|
-
parseLocationJson(location) {
|
|
28
|
-
var _a;
|
|
29
|
-
// Parse user JSON if present
|
|
30
|
-
if (location.user && typeof location.user === "string") {
|
|
31
|
-
location.user = JSON.parse(location.user);
|
|
32
|
-
}
|
|
33
|
-
if (((_a = location.user) === null || _a === void 0 ? void 0 : _a.role) && typeof location.user.role === "string") {
|
|
34
|
-
location.user.role = JSON.parse(location.user.role);
|
|
35
|
-
}
|
|
36
|
-
// Parse trip JSON if present
|
|
37
|
-
if (location.trip && typeof location.trip === "string") {
|
|
38
|
-
location.trip = JSON.parse(location.trip);
|
|
39
|
-
}
|
|
40
|
-
// Parse metadata if present
|
|
41
|
-
if (location.metadata && typeof location.metadata === "string") {
|
|
42
|
-
location.metadata = JSON.parse(location.metadata);
|
|
43
|
-
}
|
|
44
|
-
return location;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Base query with joins
|
|
48
|
-
*/
|
|
49
|
-
baseQuery() {
|
|
50
|
-
return this.knex("gps_locations as gl")
|
|
51
|
-
.leftJoin("users as u", "gl.user_id", "u.id")
|
|
52
|
-
.leftJoin("roles as ur", "u.role_id", "ur.id")
|
|
53
|
-
.leftJoin("trips as t", "gl.trip_id", "t.id")
|
|
54
|
-
.select("gl.*", this.knex.raw(`jsonb_build_object(
|
|
55
|
-
'id', u.id,
|
|
56
|
-
'uuid', u.uuid,
|
|
57
|
-
'email', u.email,
|
|
58
|
-
'username', u.username,
|
|
59
|
-
'first_name', u.first_name,
|
|
60
|
-
'last_name', u.last_name,
|
|
61
|
-
'role', to_jsonb(ur.*)
|
|
62
|
-
) as user`), this.knex.raw("to_jsonb(t.*) as trip"));
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Get all GPS locations with pagination
|
|
66
|
-
*/
|
|
67
|
-
getAll() {
|
|
68
|
-
return __awaiter(this, arguments, void 0, function* (page = 1, limit = 10) {
|
|
69
|
-
const offset = (page - 1) * limit;
|
|
70
|
-
// Get paginated data
|
|
71
|
-
const rawData = yield this.baseQuery()
|
|
72
|
-
.limit(limit)
|
|
73
|
-
.offset(offset)
|
|
74
|
-
.orderBy("gl.recorded_at", "desc");
|
|
75
|
-
// Parse JSON fields
|
|
76
|
-
const data = rawData.map((location) => this.parseLocationJson(location));
|
|
77
|
-
// Get total count
|
|
78
|
-
const totalCountResult = yield this.knex("gps_locations")
|
|
79
|
-
.count("* as count")
|
|
80
|
-
.first();
|
|
81
|
-
const totalCount = Number((totalCountResult === null || totalCountResult === void 0 ? void 0 : totalCountResult.count) || 0);
|
|
82
|
-
const count = data.length;
|
|
83
|
-
const totalPages = Math.ceil(totalCount / limit);
|
|
84
|
-
return {
|
|
85
|
-
success: true,
|
|
86
|
-
data,
|
|
87
|
-
page,
|
|
88
|
-
limit,
|
|
89
|
-
count,
|
|
90
|
-
totalCount,
|
|
91
|
-
totalPages,
|
|
92
|
-
};
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Get GPS location by ID
|
|
97
|
-
*/
|
|
98
|
-
getById(id) {
|
|
99
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
-
const result = yield this.baseQuery().where("gl.id", id).first();
|
|
101
|
-
return result ? this.parseLocationJson(result) : null;
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Get GPS location by UUID
|
|
106
|
-
*/
|
|
107
|
-
getByUuid(uuid) {
|
|
108
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
-
const result = yield this.baseQuery().where("gl.uuid", uuid).first();
|
|
110
|
-
return result ? this.parseLocationJson(result) : null;
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Get current location for a trip
|
|
115
|
-
*/
|
|
116
|
-
getCurrentLocationByTripId(tripId) {
|
|
117
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
-
const result = yield this.baseQuery()
|
|
119
|
-
.where("gl.trip_id", tripId)
|
|
120
|
-
.orderBy("gl.recorded_at", "desc")
|
|
121
|
-
.first();
|
|
122
|
-
return result ? this.parseLocationJson(result) : null;
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Get location history for a trip
|
|
127
|
-
*/
|
|
128
|
-
getLocationHistoryByTripId(tripId_1) {
|
|
129
|
-
return __awaiter(this, arguments, void 0, function* (tripId, page = 1, limit = 100) {
|
|
130
|
-
const offset = (page - 1) * limit;
|
|
131
|
-
// Get paginated data
|
|
132
|
-
const rawData = yield this.baseQuery()
|
|
133
|
-
.where("gl.trip_id", tripId)
|
|
134
|
-
.limit(limit)
|
|
135
|
-
.offset(offset)
|
|
136
|
-
.orderBy("gl.recorded_at", "desc");
|
|
137
|
-
// Parse JSON fields
|
|
138
|
-
const data = rawData.map((location) => this.parseLocationJson(location));
|
|
139
|
-
// Get total count
|
|
140
|
-
const totalCountResult = yield this.knex("gps_locations")
|
|
141
|
-
.where("trip_id", tripId)
|
|
142
|
-
.count("* as count")
|
|
143
|
-
.first();
|
|
144
|
-
const totalCount = Number((totalCountResult === null || totalCountResult === void 0 ? void 0 : totalCountResult.count) || 0);
|
|
145
|
-
const count = data.length;
|
|
146
|
-
const totalPages = Math.ceil(totalCount / limit);
|
|
147
|
-
return {
|
|
148
|
-
success: true,
|
|
149
|
-
data,
|
|
150
|
-
page,
|
|
151
|
-
limit,
|
|
152
|
-
count,
|
|
153
|
-
totalCount,
|
|
154
|
-
totalPages,
|
|
155
|
-
};
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Get recent locations for a trip (last N locations)
|
|
160
|
-
*/
|
|
161
|
-
getRecentLocationsByTripId(tripId_1) {
|
|
162
|
-
return __awaiter(this, arguments, void 0, function* (tripId, limit = 10) {
|
|
163
|
-
const rawData = yield this.baseQuery()
|
|
164
|
-
.where("gl.trip_id", tripId)
|
|
165
|
-
.orderBy("gl.recorded_at", "desc")
|
|
166
|
-
.limit(limit);
|
|
167
|
-
return rawData.map((location) => this.parseLocationJson(location));
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Get locations by user ID
|
|
172
|
-
*/
|
|
173
|
-
getLocationsByUserId(userId_1) {
|
|
174
|
-
return __awaiter(this, arguments, void 0, function* (userId, page = 1, limit = 100) {
|
|
175
|
-
const offset = (page - 1) * limit;
|
|
176
|
-
// Get paginated data
|
|
177
|
-
const rawData = yield this.baseQuery()
|
|
178
|
-
.where("gl.user_id", userId)
|
|
179
|
-
.limit(limit)
|
|
180
|
-
.offset(offset)
|
|
181
|
-
.orderBy("gl.recorded_at", "desc");
|
|
182
|
-
// Parse JSON fields
|
|
183
|
-
const data = rawData.map((location) => this.parseLocationJson(location));
|
|
184
|
-
// Get total count
|
|
185
|
-
const totalCountResult = yield this.knex("gps_locations")
|
|
186
|
-
.where("user_id", userId)
|
|
187
|
-
.count("* as count")
|
|
188
|
-
.first();
|
|
189
|
-
const totalCount = Number((totalCountResult === null || totalCountResult === void 0 ? void 0 : totalCountResult.count) || 0);
|
|
190
|
-
const count = data.length;
|
|
191
|
-
const totalPages = Math.ceil(totalCount / limit);
|
|
192
|
-
return {
|
|
193
|
-
success: true,
|
|
194
|
-
data,
|
|
195
|
-
page,
|
|
196
|
-
limit,
|
|
197
|
-
count,
|
|
198
|
-
totalCount,
|
|
199
|
-
totalPages,
|
|
200
|
-
};
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Get trip location summary
|
|
205
|
-
*/
|
|
206
|
-
getTripLocationSummary(tripId) {
|
|
207
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
208
|
-
// Get current location
|
|
209
|
-
const currentLocation = yield this.getCurrentLocationByTripId(tripId);
|
|
210
|
-
// Get total count
|
|
211
|
-
const countResult = yield this.knex("gps_locations")
|
|
212
|
-
.where("trip_id", tripId)
|
|
213
|
-
.count("* as count")
|
|
214
|
-
.first();
|
|
215
|
-
const totalLocations = Number((countResult === null || countResult === void 0 ? void 0 : countResult.count) || 0);
|
|
216
|
-
return {
|
|
217
|
-
trip_id: tripId,
|
|
218
|
-
current_location: currentLocation || undefined,
|
|
219
|
-
last_updated: currentLocation === null || currentLocation === void 0 ? void 0 : currentLocation.recorded_at,
|
|
220
|
-
total_locations: totalLocations,
|
|
221
|
-
};
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Create a new GPS location
|
|
226
|
-
*/
|
|
227
|
-
create(data) {
|
|
228
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
229
|
-
const [result] = yield this.knex("gps_locations")
|
|
230
|
-
.insert({
|
|
231
|
-
trip_id: data.trip_id,
|
|
232
|
-
user_id: data.user_id,
|
|
233
|
-
latitude: data.latitude,
|
|
234
|
-
longitude: data.longitude,
|
|
235
|
-
accuracy: data.accuracy,
|
|
236
|
-
altitude: data.altitude,
|
|
237
|
-
speed: data.speed,
|
|
238
|
-
heading: data.heading,
|
|
239
|
-
recorded_at: data.recorded_at || new Date(),
|
|
240
|
-
metadata: data.metadata ? JSON.stringify(data.metadata) : null,
|
|
241
|
-
})
|
|
242
|
-
.returning("*");
|
|
243
|
-
// Fetch with joins
|
|
244
|
-
return this.getById(result.id);
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Update a GPS location by ID
|
|
249
|
-
*/
|
|
250
|
-
update(id, data) {
|
|
251
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
252
|
-
const updateData = {};
|
|
253
|
-
if (data.latitude !== undefined)
|
|
254
|
-
updateData.latitude = data.latitude;
|
|
255
|
-
if (data.longitude !== undefined)
|
|
256
|
-
updateData.longitude = data.longitude;
|
|
257
|
-
if (data.accuracy !== undefined)
|
|
258
|
-
updateData.accuracy = data.accuracy;
|
|
259
|
-
if (data.altitude !== undefined)
|
|
260
|
-
updateData.altitude = data.altitude;
|
|
261
|
-
if (data.speed !== undefined)
|
|
262
|
-
updateData.speed = data.speed;
|
|
263
|
-
if (data.heading !== undefined)
|
|
264
|
-
updateData.heading = data.heading;
|
|
265
|
-
if (data.recorded_at !== undefined)
|
|
266
|
-
updateData.recorded_at = data.recorded_at;
|
|
267
|
-
if (data.metadata !== undefined)
|
|
268
|
-
updateData.metadata = JSON.stringify(data.metadata);
|
|
269
|
-
updateData.updated_at = new Date();
|
|
270
|
-
const [result] = yield this.knex("gps_locations")
|
|
271
|
-
.where("id", id)
|
|
272
|
-
.update(updateData)
|
|
273
|
-
.returning("*");
|
|
274
|
-
return result ? this.getById(result.id) : null;
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Delete a GPS location by ID
|
|
279
|
-
*/
|
|
280
|
-
delete(id) {
|
|
281
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
282
|
-
const result = yield this.knex("gps_locations").where("id", id).delete();
|
|
283
|
-
return result > 0;
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Delete old GPS locations (older than specified hours)
|
|
288
|
-
*/
|
|
289
|
-
deleteOldLocations() {
|
|
290
|
-
return __awaiter(this, arguments, void 0, function* (hoursOld = 48) {
|
|
291
|
-
const cutoffDate = new Date();
|
|
292
|
-
cutoffDate.setHours(cutoffDate.getHours() - hoursOld);
|
|
293
|
-
const result = yield this.knex("gps_locations")
|
|
294
|
-
.where("recorded_at", "<", cutoffDate)
|
|
295
|
-
.delete();
|
|
296
|
-
return result;
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Calculate distance between two GPS coordinates using Haversine formula
|
|
301
|
-
* Returns distance in kilometers
|
|
302
|
-
*/
|
|
303
|
-
calculateDistance(lat1, lon1, lat2, lon2) {
|
|
304
|
-
const R = 6371; // Radius of the Earth in km
|
|
305
|
-
const dLat = this.toRad(lat2 - lat1);
|
|
306
|
-
const dLon = this.toRad(lon2 - lon1);
|
|
307
|
-
const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
|
|
308
|
-
Math.cos(this.toRad(lat1)) *
|
|
309
|
-
Math.cos(this.toRad(lat2)) *
|
|
310
|
-
Math.sin(dLon / 2) *
|
|
311
|
-
Math.sin(dLon / 2);
|
|
312
|
-
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
313
|
-
const distance = R * c;
|
|
314
|
-
return distance;
|
|
315
|
-
}
|
|
316
|
-
toRad(degrees) {
|
|
317
|
-
return degrees * (Math.PI / 180);
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Calculate total distance traveled for a trip
|
|
321
|
-
*/
|
|
322
|
-
calculateTripDistance(tripId) {
|
|
323
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
324
|
-
const locations = yield this.knex("gps_locations")
|
|
325
|
-
.where("trip_id", tripId)
|
|
326
|
-
.orderBy("recorded_at", "asc")
|
|
327
|
-
.select("latitude", "longitude");
|
|
328
|
-
if (locations.length < 2) {
|
|
329
|
-
return 0;
|
|
330
|
-
}
|
|
331
|
-
let totalDistance = 0;
|
|
332
|
-
for (let i = 1; i < locations.length; i++) {
|
|
333
|
-
const prev = locations[i - 1];
|
|
334
|
-
const curr = locations[i];
|
|
335
|
-
totalDistance += this.calculateDistance(Number(prev.latitude), Number(prev.longitude), Number(curr.latitude), Number(curr.longitude));
|
|
336
|
-
}
|
|
337
|
-
return totalDistance;
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Get location history with distances
|
|
342
|
-
*/
|
|
343
|
-
getLocationHistoryWithDistances(tripId) {
|
|
344
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
345
|
-
const locations = yield this.knex("gps_locations")
|
|
346
|
-
.where("trip_id", tripId)
|
|
347
|
-
.orderBy("recorded_at", "asc")
|
|
348
|
-
.select("*");
|
|
349
|
-
const locationsWithDistance = [];
|
|
350
|
-
for (let i = 0; i < locations.length; i++) {
|
|
351
|
-
const location = locations[i];
|
|
352
|
-
let distanceFromPrevious;
|
|
353
|
-
if (i > 0) {
|
|
354
|
-
const prev = locations[i - 1];
|
|
355
|
-
distanceFromPrevious = this.calculateDistance(Number(prev.latitude), Number(prev.longitude), Number(location.latitude), Number(location.longitude));
|
|
356
|
-
}
|
|
357
|
-
locationsWithDistance.push(Object.assign(Object.assign({}, location), { distance_from_previous: distanceFromPrevious }));
|
|
358
|
-
}
|
|
359
|
-
return locationsWithDistance;
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
exports.GPSLocationDAO = GPSLocationDAO;
|
|
364
|
-
//# sourceMappingURL=gps-location.dao.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gps-location.dao.js","sourceRoot":"","sources":["../../../src/dao/gps-location/gps-location.dao.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,0EAA+C;AAQ/C,MAAa,cAAc;IAGzB,IAAY,IAAI;QACd,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,KAAK,GAAG,wBAAW,CAAC,aAAa,EAAE,CAAC;QAC3C,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;OAEG;IACK,iBAAiB,CAAC,QAAa;;QACrC,6BAA6B;QAC7B,IAAI,QAAQ,CAAC,IAAI,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvD,QAAQ,CAAC,IAA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,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC1C,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;gBAC9B,IAAI,oBAAwC,CAAC;gBAE7C,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;oBACV,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;oBAC9B,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,CAC3C,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EACrB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EACtB,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EACzB,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAC3B,CAAC;gBACJ,CAAC;gBAED,qBAAqB,CAAC,IAAI,iCACrB,QAAQ,KACX,sBAAsB,EAAE,oBAAoB,IAC5C,CAAC;YACL,CAAC;YAED,OAAO,qBAAqB,CAAC;QAC/B,CAAC;KAAA;CACF;AAjaD,wCAiaC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { IUser } from "../user/user.interfaces";
|
|
2
|
-
import { ITrip } from "../trip/trip.interfaces";
|
|
3
|
-
export interface IGPSLocation {
|
|
4
|
-
id?: number;
|
|
5
|
-
uuid?: string;
|
|
6
|
-
trip_id: number;
|
|
7
|
-
user_id: number;
|
|
8
|
-
latitude: number;
|
|
9
|
-
longitude: number;
|
|
10
|
-
accuracy?: number;
|
|
11
|
-
altitude?: number;
|
|
12
|
-
speed?: number;
|
|
13
|
-
heading?: number;
|
|
14
|
-
recorded_at: Date | string;
|
|
15
|
-
metadata?: any;
|
|
16
|
-
created_at?: Date | string;
|
|
17
|
-
updated_at?: Date | string;
|
|
18
|
-
user?: IUser;
|
|
19
|
-
trip?: ITrip;
|
|
20
|
-
}
|
|
21
|
-
export interface IGPSLocationWithDistance extends IGPSLocation {
|
|
22
|
-
distance_from_previous?: number;
|
|
23
|
-
}
|
|
24
|
-
export interface ITripLocationSummary {
|
|
25
|
-
trip_id: number;
|
|
26
|
-
current_location?: IGPSLocation;
|
|
27
|
-
last_updated?: Date | string;
|
|
28
|
-
total_distance?: number;
|
|
29
|
-
total_locations?: number;
|
|
30
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gps-location.interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/gps-location/gps-location.interfaces.ts"],"names":[],"mappings":""}
|