@mydoormot/app-types 1.7.29 → 1.7.30

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.
@@ -1,18 +1,18 @@
1
-
2
- > @mydoormot/app-types@1.7.28 build /Users/chuksben/Desktop/projects/microservices/mydoormot/packages/app-types
3
- > tsup src/index.ts --format esm,cjs --dts
4
-
5
- CLI Building entry: src/index.ts
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v7.3.0
8
- CLI Target: es2021
9
- ESM Build start
10
- CJS Build start
11
- ESM dist/index.js 7.13 KB
12
- ESM ⚡️ Build success in 64ms
13
- CJS dist/index.cjs 8.99 KB
14
- CJS ⚡️ Build success in 64ms
15
- DTS Build start
16
- DTS ⚡️ Build success in 872ms
17
- DTS dist/index.d.ts 26.76 KB
18
- DTS dist/index.d.cts 26.76 KB
1
+
2
+ > @mydoormot/app-types@1.7.29 build /Users/chuksben/Desktop/projects/microservices/mydoormot/packages/app-types
3
+ > tsup src/index.ts --format esm,cjs --dts
4
+
5
+ CLI Building entry: src/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v7.3.0
8
+ CLI Target: es2021
9
+ ESM Build start
10
+ CJS Build start
11
+ ESM dist/index.js 7.15 KB
12
+ ESM ⚡️ Build success in 61ms
13
+ CJS dist/index.cjs 9.00 KB
14
+ CJS ⚡️ Build success in 62ms
15
+ DTS Build start
16
+ DTS ⚡️ Build success in 846ms
17
+ DTS dist/index.d.ts 28.00 KB
18
+ DTS dist/index.d.cts 28.00 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @mydoormot/app-types
2
2
 
3
+ ## 1.7.30
4
+
5
+ ### Patch Changes
6
+
7
+ - Refactored vehicle types
8
+
3
9
  ## 1.7.29
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -167,7 +167,7 @@ var NotificationType = /* @__PURE__ */ ((NotificationType2) => {
167
167
  return NotificationType2;
168
168
  })(NotificationType || {});
169
169
 
170
- // src/rider.ts
170
+ // src/vehicle.ts
171
171
  var VehicleType = /* @__PURE__ */ ((VehicleType2) => {
172
172
  VehicleType2["Bike"] = "bike";
173
173
  VehicleType2["Shuttle"] = "shuttle";
@@ -177,6 +177,8 @@ var VehicleLogType = /* @__PURE__ */ ((VehicleLogType2) => {
177
177
  VehicleLogType2["REFUEL"] = "REFUEL";
178
178
  return VehicleLogType2;
179
179
  })(VehicleLogType || {});
180
+
181
+ // src/rider.ts
180
182
  var RemittanceStatus = /* @__PURE__ */ ((RemittanceStatus2) => {
181
183
  RemittanceStatus2["Pending"] = "pending";
182
184
  RemittanceStatus2["Remitted"] = "remitted";
package/dist/index.d.cts CHANGED
@@ -180,25 +180,6 @@ interface InvoiceItem {
180
180
  itemDetails?: Errand;
181
181
  }
182
182
 
183
- type Rider = {
184
- id: string;
185
- userId: string;
186
- vehicleId?: string;
187
- currLocation: {
188
- coordinates: number[];
189
- };
190
- vehicleNumber?: string;
191
- verified: boolean;
192
- active: boolean;
193
- updatedAt: Date;
194
- createdAt: Date;
195
- rating: number;
196
- version: number;
197
- hasBeenRated: boolean;
198
- state?: string | State;
199
- currentErrand?: Errand;
200
- lastDeliveredErrand?: Errand;
201
- };
202
183
  declare enum VehicleType {
203
184
  Bike = "bike",
204
185
  Shuttle = "shuttle"
@@ -214,9 +195,6 @@ type Vehicle = {
214
195
  shortName?: string;
215
196
  userId?: string;
216
197
  };
217
- type RiderWithUserDetails = Rider & {
218
- userDetails?: User;
219
- };
220
198
  type VehicleWithRider = Vehicle & {
221
199
  riders: RiderWithUserDetails[];
222
200
  };
@@ -235,12 +213,75 @@ type VehicleLog = {
235
213
  updatedAt: string;
236
214
  previousLogId?: string;
237
215
  errandIdsSinceLastRefuel?: string[];
216
+ lastRecalculatedAt?: string;
238
217
  vehicleDetails?: Vehicle;
239
218
  };
240
219
  type VehicleLogWithErrands = VehicleLog & {
241
220
  errandsCount?: number;
242
221
  totalErrandsRevenue?: number;
243
222
  };
223
+ interface VehicleErrandStats {
224
+ count: number;
225
+ totalRevenue: number;
226
+ }
227
+ interface VehicleFuelStats {
228
+ totalCost: number;
229
+ totalLiters: number;
230
+ refuelCount: number;
231
+ }
232
+ interface VehicleMaintenanceStats {
233
+ totalCost: number;
234
+ recordCount: number;
235
+ }
236
+ interface VehiclePerformanceItem {
237
+ vehicleId: string;
238
+ vehicleNumber: string;
239
+ shortName: string | null;
240
+ errands: VehicleErrandStats;
241
+ fuel: VehicleFuelStats;
242
+ maintenance: VehicleMaintenanceStats;
243
+ netProfit: number;
244
+ }
245
+ interface VehiclePerformanceTotals {
246
+ totalRevenue: number;
247
+ totalFuelCost: number;
248
+ totalMaintenanceCost: number;
249
+ netProfit: number;
250
+ }
251
+ interface VehiclePerformanceFilters {
252
+ businessId: string;
253
+ vehicleId: string | null;
254
+ startDate: string | null;
255
+ endDate: string | null;
256
+ }
257
+ interface VehiclePerformanceData {
258
+ vehicles: VehiclePerformanceItem[];
259
+ totals: VehiclePerformanceTotals;
260
+ filters: VehiclePerformanceFilters;
261
+ }
262
+
263
+ type Rider = {
264
+ id: string;
265
+ userId: string;
266
+ vehicleId?: string;
267
+ currLocation: {
268
+ coordinates: number[];
269
+ };
270
+ vehicleNumber?: string;
271
+ verified: boolean;
272
+ active: boolean;
273
+ updatedAt: Date;
274
+ createdAt: Date;
275
+ rating: number;
276
+ version: number;
277
+ hasBeenRated: boolean;
278
+ state?: string | State;
279
+ currentErrand?: Errand;
280
+ lastDeliveredErrand?: Errand;
281
+ };
282
+ type RiderWithUserDetails = Rider & {
283
+ userDetails?: User;
284
+ };
244
285
  declare enum RemittanceStatus {
245
286
  Pending = "pending",
246
287
  Remitted = "remitted",
@@ -835,6 +876,9 @@ interface TransactionItem {
835
876
  quantity: number;
836
877
  unitPrice: number;
837
878
  totalPrice: number;
879
+ productId?: string;
880
+ variantId?: string;
881
+ isAddon?: boolean;
838
882
  }
839
883
  interface Transaction {
840
884
  id: string;
@@ -1047,4 +1091,4 @@ declare enum LinkDestination {
1047
1091
  }
1048
1092
  type NullOrUndefined = null | undefined;
1049
1093
 
1050
- export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessMember, type BusinessPg, BusinessRole, type City, type Collection, type Coupon, type Customer, type CustomerTransactionStats, DeliveryStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, GlobalRoles, type Invoice, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type PaginateResult, ParcelSize, PaymentOptions, type PendingErrand, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, RemittanceStatus, type Rider, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, SettlementType, type State, type TraccarDevice, TraccarDeviceStatus, type TraccarPosition, type TrackerDevice, type Transaction, type TransactionCategory, type TransactionItem, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, VehicleType, type VehicleWithRider, type Vendor, errandTimeline };
1094
+ export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessMember, type BusinessPg, BusinessRole, type City, type Collection, type Coupon, type Customer, type CustomerTransactionStats, DeliveryStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, GlobalRoles, type Invoice, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type PaginateResult, ParcelSize, PaymentOptions, type PendingErrand, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, RemittanceStatus, type Rider, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, SettlementType, type State, type TraccarDevice, TraccarDeviceStatus, type TraccarPosition, type TrackerDevice, type Transaction, type TransactionCategory, type TransactionItem, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleErrandStats, type VehicleFuelStats, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, type VehicleMaintenanceStats, type VehiclePerformanceData, type VehiclePerformanceFilters, type VehiclePerformanceItem, type VehiclePerformanceTotals, VehicleType, type VehicleWithRider, type Vendor, errandTimeline };
package/dist/index.d.ts CHANGED
@@ -180,25 +180,6 @@ interface InvoiceItem {
180
180
  itemDetails?: Errand;
181
181
  }
182
182
 
183
- type Rider = {
184
- id: string;
185
- userId: string;
186
- vehicleId?: string;
187
- currLocation: {
188
- coordinates: number[];
189
- };
190
- vehicleNumber?: string;
191
- verified: boolean;
192
- active: boolean;
193
- updatedAt: Date;
194
- createdAt: Date;
195
- rating: number;
196
- version: number;
197
- hasBeenRated: boolean;
198
- state?: string | State;
199
- currentErrand?: Errand;
200
- lastDeliveredErrand?: Errand;
201
- };
202
183
  declare enum VehicleType {
203
184
  Bike = "bike",
204
185
  Shuttle = "shuttle"
@@ -214,9 +195,6 @@ type Vehicle = {
214
195
  shortName?: string;
215
196
  userId?: string;
216
197
  };
217
- type RiderWithUserDetails = Rider & {
218
- userDetails?: User;
219
- };
220
198
  type VehicleWithRider = Vehicle & {
221
199
  riders: RiderWithUserDetails[];
222
200
  };
@@ -235,12 +213,75 @@ type VehicleLog = {
235
213
  updatedAt: string;
236
214
  previousLogId?: string;
237
215
  errandIdsSinceLastRefuel?: string[];
216
+ lastRecalculatedAt?: string;
238
217
  vehicleDetails?: Vehicle;
239
218
  };
240
219
  type VehicleLogWithErrands = VehicleLog & {
241
220
  errandsCount?: number;
242
221
  totalErrandsRevenue?: number;
243
222
  };
223
+ interface VehicleErrandStats {
224
+ count: number;
225
+ totalRevenue: number;
226
+ }
227
+ interface VehicleFuelStats {
228
+ totalCost: number;
229
+ totalLiters: number;
230
+ refuelCount: number;
231
+ }
232
+ interface VehicleMaintenanceStats {
233
+ totalCost: number;
234
+ recordCount: number;
235
+ }
236
+ interface VehiclePerformanceItem {
237
+ vehicleId: string;
238
+ vehicleNumber: string;
239
+ shortName: string | null;
240
+ errands: VehicleErrandStats;
241
+ fuel: VehicleFuelStats;
242
+ maintenance: VehicleMaintenanceStats;
243
+ netProfit: number;
244
+ }
245
+ interface VehiclePerformanceTotals {
246
+ totalRevenue: number;
247
+ totalFuelCost: number;
248
+ totalMaintenanceCost: number;
249
+ netProfit: number;
250
+ }
251
+ interface VehiclePerformanceFilters {
252
+ businessId: string;
253
+ vehicleId: string | null;
254
+ startDate: string | null;
255
+ endDate: string | null;
256
+ }
257
+ interface VehiclePerformanceData {
258
+ vehicles: VehiclePerformanceItem[];
259
+ totals: VehiclePerformanceTotals;
260
+ filters: VehiclePerformanceFilters;
261
+ }
262
+
263
+ type Rider = {
264
+ id: string;
265
+ userId: string;
266
+ vehicleId?: string;
267
+ currLocation: {
268
+ coordinates: number[];
269
+ };
270
+ vehicleNumber?: string;
271
+ verified: boolean;
272
+ active: boolean;
273
+ updatedAt: Date;
274
+ createdAt: Date;
275
+ rating: number;
276
+ version: number;
277
+ hasBeenRated: boolean;
278
+ state?: string | State;
279
+ currentErrand?: Errand;
280
+ lastDeliveredErrand?: Errand;
281
+ };
282
+ type RiderWithUserDetails = Rider & {
283
+ userDetails?: User;
284
+ };
244
285
  declare enum RemittanceStatus {
245
286
  Pending = "pending",
246
287
  Remitted = "remitted",
@@ -835,6 +876,9 @@ interface TransactionItem {
835
876
  quantity: number;
836
877
  unitPrice: number;
837
878
  totalPrice: number;
879
+ productId?: string;
880
+ variantId?: string;
881
+ isAddon?: boolean;
838
882
  }
839
883
  interface Transaction {
840
884
  id: string;
@@ -1047,4 +1091,4 @@ declare enum LinkDestination {
1047
1091
  }
1048
1092
  type NullOrUndefined = null | undefined;
1049
1093
 
1050
- export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessMember, type BusinessPg, BusinessRole, type City, type Collection, type Coupon, type Customer, type CustomerTransactionStats, DeliveryStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, GlobalRoles, type Invoice, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type PaginateResult, ParcelSize, PaymentOptions, type PendingErrand, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, RemittanceStatus, type Rider, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, SettlementType, type State, type TraccarDevice, TraccarDeviceStatus, type TraccarPosition, type TrackerDevice, type Transaction, type TransactionCategory, type TransactionItem, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, VehicleType, type VehicleWithRider, type Vendor, errandTimeline };
1094
+ export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessMember, type BusinessPg, BusinessRole, type City, type Collection, type Coupon, type Customer, type CustomerTransactionStats, DeliveryStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, GlobalRoles, type Invoice, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type PaginateResult, ParcelSize, PaymentOptions, type PendingErrand, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, RemittanceStatus, type Rider, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, SettlementType, type State, type TraccarDevice, TraccarDeviceStatus, type TraccarPosition, type TrackerDevice, type Transaction, type TransactionCategory, type TransactionItem, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleErrandStats, type VehicleFuelStats, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, type VehicleMaintenanceStats, type VehiclePerformanceData, type VehiclePerformanceFilters, type VehiclePerformanceItem, type VehiclePerformanceTotals, VehicleType, type VehicleWithRider, type Vendor, errandTimeline };
package/dist/index.js CHANGED
@@ -119,7 +119,7 @@ var NotificationType = /* @__PURE__ */ ((NotificationType2) => {
119
119
  return NotificationType2;
120
120
  })(NotificationType || {});
121
121
 
122
- // src/rider.ts
122
+ // src/vehicle.ts
123
123
  var VehicleType = /* @__PURE__ */ ((VehicleType2) => {
124
124
  VehicleType2["Bike"] = "bike";
125
125
  VehicleType2["Shuttle"] = "shuttle";
@@ -129,6 +129,8 @@ var VehicleLogType = /* @__PURE__ */ ((VehicleLogType2) => {
129
129
  VehicleLogType2["REFUEL"] = "REFUEL";
130
130
  return VehicleLogType2;
131
131
  })(VehicleLogType || {});
132
+
133
+ // src/rider.ts
132
134
  var RemittanceStatus = /* @__PURE__ */ ((RemittanceStatus2) => {
133
135
  RemittanceStatus2["Pending"] = "pending";
134
136
  RemittanceStatus2["Remitted"] = "remitted";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mydoormot/app-types",
3
- "version": "1.7.29",
3
+ "version": "1.7.30",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
package/src/index.ts CHANGED
@@ -28,6 +28,7 @@ export * from './location';
28
28
  export * from './invoice';
29
29
  export * from './notification';
30
30
  export * from './rider';
31
+ export * from './vehicle';
31
32
  export * from './enterprise';
32
33
  export * from './coupon';
33
34
  export * from './business';
package/src/rider.ts CHANGED
@@ -3,6 +3,10 @@ import { Errand } from './errand';
3
3
  import { State } from './location';
4
4
  import { User } from './user';
5
5
 
6
+ // Re-export vehicle types for backwards compatibility
7
+ export type { Vehicle, VehicleWithRider, VehicleLog, VehicleLogWithErrands } from './vehicle';
8
+ export { VehicleType, VehicleLogType } from './vehicle';
9
+
6
10
  export type Rider = {
7
11
  id: string;
8
12
  userId: string;
@@ -29,56 +33,10 @@ export type Rider = {
29
33
  lastDeliveredErrand?: Errand;
30
34
  };
31
35
 
32
- export enum VehicleType {
33
- Bike = 'bike',
34
- Shuttle = 'shuttle',
35
- }
36
-
37
- export type Vehicle = {
38
- id: string;
39
- vehicleNumber: string;
40
- version: number;
41
- createdAt: string;
42
- updatedAt: string;
43
- vehicleType: VehicleType | `${VehicleType}`;
44
- businessId: string;
45
-
46
- shortName?: string;
47
- userId?: string;
48
- };
49
-
50
36
  export type RiderWithUserDetails = Rider & {
51
37
  userDetails?: User;
52
38
  };
53
39
 
54
- export type VehicleWithRider = Vehicle & {
55
- riders: RiderWithUserDetails[];
56
- };
57
-
58
- export enum VehicleLogType {
59
- REFUEL = 'REFUEL',
60
- }
61
-
62
- export type VehicleLog = {
63
- id: string;
64
- vehicleId: string;
65
- businessId: string;
66
- type: VehicleLogType | `${VehicleLogType}`;
67
- fuelLiters?: number;
68
- fuelCost?: number;
69
- note?: string;
70
- createdAt: string;
71
- updatedAt: string;
72
- previousLogId?: string;
73
- errandIdsSinceLastRefuel?: string[];
74
- vehicleDetails?: Vehicle;
75
- };
76
-
77
- export type VehicleLogWithErrands = VehicleLog & {
78
- errandsCount?: number;
79
- totalErrandsRevenue?: number;
80
- };
81
-
82
40
  // Rider Settlement Types
83
41
  export enum RemittanceStatus {
84
42
  Pending = 'pending',
@@ -7,6 +7,9 @@ export interface TransactionItem {
7
7
  quantity: number;
8
8
  unitPrice: number;
9
9
  totalPrice: number;
10
+ productId?: string;
11
+ variantId?: string;
12
+ isAddon?: boolean;
10
13
  }
11
14
 
12
15
  export interface Transaction {
package/src/vehicle.ts ADDED
@@ -0,0 +1,95 @@
1
+ import { RiderWithUserDetails } from './rider';
2
+
3
+ export enum VehicleType {
4
+ Bike = 'bike',
5
+ Shuttle = 'shuttle',
6
+ }
7
+
8
+ export type Vehicle = {
9
+ id: string;
10
+ vehicleNumber: string;
11
+ version: number;
12
+ createdAt: string;
13
+ updatedAt: string;
14
+ vehicleType: VehicleType | `${VehicleType}`;
15
+ businessId: string;
16
+
17
+ shortName?: string;
18
+ userId?: string;
19
+ };
20
+
21
+ export type VehicleWithRider = Vehicle & {
22
+ riders: RiderWithUserDetails[];
23
+ };
24
+
25
+ export enum VehicleLogType {
26
+ REFUEL = 'REFUEL',
27
+ }
28
+
29
+ export type VehicleLog = {
30
+ id: string;
31
+ vehicleId: string;
32
+ businessId: string;
33
+ type: VehicleLogType | `${VehicleLogType}`;
34
+ fuelLiters?: number;
35
+ fuelCost?: number;
36
+ note?: string;
37
+ createdAt: string;
38
+ updatedAt: string;
39
+ previousLogId?: string;
40
+ errandIdsSinceLastRefuel?: string[];
41
+ lastRecalculatedAt?: string;
42
+ vehicleDetails?: Vehicle;
43
+ };
44
+
45
+ export type VehicleLogWithErrands = VehicleLog & {
46
+ errandsCount?: number;
47
+ totalErrandsRevenue?: number;
48
+ };
49
+
50
+ // Vehicle Performance Types
51
+ export interface VehicleErrandStats {
52
+ count: number;
53
+ totalRevenue: number;
54
+ }
55
+
56
+ export interface VehicleFuelStats {
57
+ totalCost: number;
58
+ totalLiters: number;
59
+ refuelCount: number;
60
+ }
61
+
62
+ export interface VehicleMaintenanceStats {
63
+ totalCost: number;
64
+ recordCount: number;
65
+ }
66
+
67
+ export interface VehiclePerformanceItem {
68
+ vehicleId: string;
69
+ vehicleNumber: string;
70
+ shortName: string | null;
71
+ errands: VehicleErrandStats;
72
+ fuel: VehicleFuelStats;
73
+ maintenance: VehicleMaintenanceStats;
74
+ netProfit: number;
75
+ }
76
+
77
+ export interface VehiclePerformanceTotals {
78
+ totalRevenue: number;
79
+ totalFuelCost: number;
80
+ totalMaintenanceCost: number;
81
+ netProfit: number;
82
+ }
83
+
84
+ export interface VehiclePerformanceFilters {
85
+ businessId: string;
86
+ vehicleId: string | null;
87
+ startDate: string | null;
88
+ endDate: string | null;
89
+ }
90
+
91
+ export interface VehiclePerformanceData {
92
+ vehicles: VehiclePerformanceItem[];
93
+ totals: VehiclePerformanceTotals;
94
+ filters: VehiclePerformanceFilters;
95
+ }