@mydoormot/app-types 1.7.28 → 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,5 +1,5 @@
1
1
 
2
- > @mydoormot/app-types@1.7.27 build /Users/chuksben/Desktop/projects/microservices/mydoormot/packages/app-types
2
+ > @mydoormot/app-types@1.7.29 build /Users/chuksben/Desktop/projects/microservices/mydoormot/packages/app-types
3
3
  > tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,11 +8,11 @@
8
8
  CLI Target: es2021
9
9
  ESM Build start
10
10
  CJS Build start
11
- CJS dist/index.cjs 9.03 KB
12
- CJS ⚡️ Build success in 117ms
13
- ESM dist/index.js 7.18 KB
14
- ESM ⚡️ Build success in 118ms
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
15
  DTS Build start
16
- DTS ⚡️ Build success in 780ms
17
- DTS dist/index.d.ts 26.78 KB
18
- DTS dist/index.d.cts 26.78 KB
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,17 @@
1
1
  # @mydoormot/app-types
2
2
 
3
+ ## 1.7.30
4
+
5
+ ### Patch Changes
6
+
7
+ - Refactored vehicle types
8
+
9
+ ## 1.7.29
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated rider api types
14
+
3
15
  ## 1.7.28
4
16
 
5
17
  ### 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";
@@ -175,9 +175,10 @@ var VehicleType = /* @__PURE__ */ ((VehicleType2) => {
175
175
  })(VehicleType || {});
176
176
  var VehicleLogType = /* @__PURE__ */ ((VehicleLogType2) => {
177
177
  VehicleLogType2["REFUEL"] = "REFUEL";
178
- VehicleLogType2["MAINTENANCE"] = "MAINTENANCE";
179
178
  return VehicleLogType2;
180
179
  })(VehicleLogType || {});
180
+
181
+ // src/rider.ts
181
182
  var RemittanceStatus = /* @__PURE__ */ ((RemittanceStatus2) => {
182
183
  RemittanceStatus2["Pending"] = "pending";
183
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"
@@ -212,16 +193,13 @@ type Vehicle = {
212
193
  vehicleType: VehicleType | `${VehicleType}`;
213
194
  businessId: string;
214
195
  shortName?: string;
215
- riderId?: string;
216
196
  userId?: string;
217
197
  };
218
198
  type VehicleWithRider = Vehicle & {
219
- rider: Rider | null;
220
- riderUserDetails: User | null;
199
+ riders: RiderWithUserDetails[];
221
200
  };
222
201
  declare enum VehicleLogType {
223
- REFUEL = "REFUEL",
224
- MAINTENANCE = "MAINTENANCE"
202
+ REFUEL = "REFUEL"
225
203
  }
226
204
  type VehicleLog = {
227
205
  id: string;
@@ -235,14 +213,75 @@ type VehicleLog = {
235
213
  updatedAt: string;
236
214
  previousLogId?: string;
237
215
  errandIdsSinceLastRefuel?: string[];
238
- maintenanceType?: string;
239
- maintenanceCost?: number;
216
+ lastRecalculatedAt?: string;
240
217
  vehicleDetails?: Vehicle;
241
218
  };
242
219
  type VehicleLogWithErrands = VehicleLog & {
243
220
  errandsCount?: number;
244
221
  totalErrandsRevenue?: number;
245
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
+ };
246
285
  declare enum RemittanceStatus {
247
286
  Pending = "pending",
248
287
  Remitted = "remitted",
@@ -837,6 +876,9 @@ interface TransactionItem {
837
876
  quantity: number;
838
877
  unitPrice: number;
839
878
  totalPrice: number;
879
+ productId?: string;
880
+ variantId?: string;
881
+ isAddon?: boolean;
840
882
  }
841
883
  interface Transaction {
842
884
  id: string;
@@ -850,6 +892,7 @@ interface Transaction {
850
892
  businessId?: string;
851
893
  categoryId?: string;
852
894
  customerId?: string;
895
+ riderId?: string;
853
896
  items?: TransactionItem[];
854
897
  customerDetails?: Customer;
855
898
  }
@@ -1048,4 +1091,4 @@ declare enum LinkDestination {
1048
1091
  }
1049
1092
  type NullOrUndefined = null | undefined;
1050
1093
 
1051
- 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, 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"
@@ -212,16 +193,13 @@ type Vehicle = {
212
193
  vehicleType: VehicleType | `${VehicleType}`;
213
194
  businessId: string;
214
195
  shortName?: string;
215
- riderId?: string;
216
196
  userId?: string;
217
197
  };
218
198
  type VehicleWithRider = Vehicle & {
219
- rider: Rider | null;
220
- riderUserDetails: User | null;
199
+ riders: RiderWithUserDetails[];
221
200
  };
222
201
  declare enum VehicleLogType {
223
- REFUEL = "REFUEL",
224
- MAINTENANCE = "MAINTENANCE"
202
+ REFUEL = "REFUEL"
225
203
  }
226
204
  type VehicleLog = {
227
205
  id: string;
@@ -235,14 +213,75 @@ type VehicleLog = {
235
213
  updatedAt: string;
236
214
  previousLogId?: string;
237
215
  errandIdsSinceLastRefuel?: string[];
238
- maintenanceType?: string;
239
- maintenanceCost?: number;
216
+ lastRecalculatedAt?: string;
240
217
  vehicleDetails?: Vehicle;
241
218
  };
242
219
  type VehicleLogWithErrands = VehicleLog & {
243
220
  errandsCount?: number;
244
221
  totalErrandsRevenue?: number;
245
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
+ };
246
285
  declare enum RemittanceStatus {
247
286
  Pending = "pending",
248
287
  Remitted = "remitted",
@@ -837,6 +876,9 @@ interface TransactionItem {
837
876
  quantity: number;
838
877
  unitPrice: number;
839
878
  totalPrice: number;
879
+ productId?: string;
880
+ variantId?: string;
881
+ isAddon?: boolean;
840
882
  }
841
883
  interface Transaction {
842
884
  id: string;
@@ -850,6 +892,7 @@ interface Transaction {
850
892
  businessId?: string;
851
893
  categoryId?: string;
852
894
  customerId?: string;
895
+ riderId?: string;
853
896
  items?: TransactionItem[];
854
897
  customerDetails?: Customer;
855
898
  }
@@ -1048,4 +1091,4 @@ declare enum LinkDestination {
1048
1091
  }
1049
1092
  type NullOrUndefined = null | undefined;
1050
1093
 
1051
- 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, 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";
@@ -127,9 +127,10 @@ var VehicleType = /* @__PURE__ */ ((VehicleType2) => {
127
127
  })(VehicleType || {});
128
128
  var VehicleLogType = /* @__PURE__ */ ((VehicleLogType2) => {
129
129
  VehicleLogType2["REFUEL"] = "REFUEL";
130
- VehicleLogType2["MAINTENANCE"] = "MAINTENANCE";
131
130
  return VehicleLogType2;
132
131
  })(VehicleLogType || {});
132
+
133
+ // src/rider.ts
133
134
  var RemittanceStatus = /* @__PURE__ */ ((RemittanceStatus2) => {
134
135
  RemittanceStatus2["Pending"] = "pending";
135
136
  RemittanceStatus2["Remitted"] = "remitted";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mydoormot/app-types",
3
- "version": "1.7.28",
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,17 +3,21 @@ 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;
9
- vehicleId: string;
13
+ vehicleId?: string;
10
14
 
11
15
  // city: string | City;
12
16
  currLocation: {
13
17
  coordinates: number[];
14
18
  };
15
19
  // vehicle: string | Vehicle;
16
- vehicleNumber: string;
20
+ vehicleNumber?: string;
17
21
  verified: boolean;
18
22
  active: boolean;
19
23
  updatedAt: Date;
@@ -29,55 +33,8 @@ 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
- riderId?: string;
48
- userId?: string;
49
- };
50
-
51
- export type VehicleWithRider = Vehicle & {
52
- rider: Rider | null;
53
- riderUserDetails: User | null;
54
- };
55
-
56
- export enum VehicleLogType {
57
- REFUEL = 'REFUEL',
58
- MAINTENANCE = 'MAINTENANCE',
59
- }
60
-
61
- export type VehicleLog = {
62
- id: string;
63
- vehicleId: string;
64
- businessId: string;
65
- type: VehicleLogType | `${VehicleLogType}`;
66
- fuelLiters?: number;
67
- fuelCost?: number;
68
- note?: string;
69
- createdAt: string;
70
- updatedAt: string;
71
- previousLogId?: string;
72
- errandIdsSinceLastRefuel?: string[];
73
- maintenanceType?: string;
74
- maintenanceCost?: number;
75
- vehicleDetails?: Vehicle;
76
- };
77
-
78
- export type VehicleLogWithErrands = VehicleLog & {
79
- errandsCount?: number;
80
- totalErrandsRevenue?: number;
36
+ export type RiderWithUserDetails = Rider & {
37
+ userDetails?: User;
81
38
  };
82
39
 
83
40
  // Rider Settlement Types
@@ -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 {
@@ -21,6 +24,7 @@ export interface Transaction {
21
24
  businessId?: string;
22
25
  categoryId?: string;
23
26
  customerId?: string;
27
+ riderId?: string;
24
28
  items?: TransactionItem[];
25
29
  customerDetails?: Customer;
26
30
  }
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
+ }