@mydoormot/app-types 1.7.20 → 1.7.21

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.19 build /Users/chuksben/Desktop/projects/microservices/mydoormot/packages/app-types
2
+ > @mydoormot/app-types@1.7.20 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 8.20 KB
12
- CJS ⚡️ Build success in 134ms
13
- ESM dist/index.js 6.47 KB
14
- ESM ⚡️ Build success in 135ms
15
11
  DTS Build start
16
- DTS ⚡️ Build success in 1184ms
17
- DTS dist/index.d.ts 19.33 KB
18
- DTS dist/index.d.cts 19.33 KB
12
+ CJS dist/index.cjs 9.29 KB
13
+ CJS ⚡️ Build success in 837ms
14
+ ESM dist/index.js 7.44 KB
15
+ ESM ⚡️ Build success in 837ms
16
+ DTS ⚡️ Build success in 792ms
17
+ DTS dist/index.d.ts 22.98 KB
18
+ DTS dist/index.d.cts 22.98 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @mydoormot/app-types
2
2
 
3
+ ## 1.7.21
4
+
5
+ ### Patch Changes
6
+
7
+ - Added commerce
8
+
3
9
  ## 1.7.20
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -34,7 +34,10 @@ __export(src_exports, {
34
34
  MembershipStatus: () => MembershipStatus,
35
35
  NotificationType: () => NotificationType,
36
36
  ParcelSize: () => ParcelSize,
37
+ PaymentMethod: () => PaymentMethod,
37
38
  PaymentOptions: () => PaymentOptions,
39
+ RemittanceMethod: () => RemittanceMethod,
40
+ RemittanceStatus: () => RemittanceStatus,
38
41
  RoleType: () => RoleType,
39
42
  TraccarDeviceStatus: () => TraccarDeviceStatus,
40
43
  VehicleLogType: () => VehicleLogType,
@@ -175,6 +178,27 @@ var VehicleLogType = /* @__PURE__ */ ((VehicleLogType2) => {
175
178
  VehicleLogType2["MAINTENANCE"] = "MAINTENANCE";
176
179
  return VehicleLogType2;
177
180
  })(VehicleLogType || {});
181
+ var RemittanceStatus = /* @__PURE__ */ ((RemittanceStatus2) => {
182
+ RemittanceStatus2["Pending"] = "pending";
183
+ RemittanceStatus2["Remitted"] = "remitted";
184
+ RemittanceStatus2["Waived"] = "waived";
185
+ RemittanceStatus2["Cancelled"] = "cancelled";
186
+ return RemittanceStatus2;
187
+ })(RemittanceStatus || {});
188
+ var RemittanceMethod = /* @__PURE__ */ ((RemittanceMethod2) => {
189
+ RemittanceMethod2["Cash"] = "cash";
190
+ RemittanceMethod2["Transfer"] = "transfer";
191
+ RemittanceMethod2["Deduction"] = "deduction";
192
+ RemittanceMethod2["Other"] = "other";
193
+ return RemittanceMethod2;
194
+ })(RemittanceMethod || {});
195
+ var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
196
+ PaymentMethod2["CashOnDelivery"] = "cash_on_delivery";
197
+ PaymentMethod2["PrepaidOnline"] = "prepaid_online";
198
+ PaymentMethod2["PrepaidTransfer"] = "prepaid_transfer";
199
+ PaymentMethod2["BusinessInvoice"] = "business_invoice";
200
+ return PaymentMethod2;
201
+ })(PaymentMethod || {});
178
202
 
179
203
  // src/enterprise.ts
180
204
  var EnterpriseType = /* @__PURE__ */ ((EnterpriseType2) => {
@@ -231,7 +255,10 @@ var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
231
255
  MembershipStatus,
232
256
  NotificationType,
233
257
  ParcelSize,
258
+ PaymentMethod,
234
259
  PaymentOptions,
260
+ RemittanceMethod,
261
+ RemittanceStatus,
235
262
  RoleType,
236
263
  TraccarDeviceStatus,
237
264
  VehicleLogType,
package/dist/index.d.cts CHANGED
@@ -243,6 +243,74 @@ type VehicleLogWithErrands = VehicleLog & {
243
243
  errandsCount?: number;
244
244
  totalErrandsRevenue?: number;
245
245
  };
246
+ declare enum RemittanceStatus {
247
+ Pending = "pending",
248
+ Remitted = "remitted",
249
+ Waived = "waived",
250
+ Cancelled = "cancelled"
251
+ }
252
+ declare enum RemittanceMethod {
253
+ Cash = "cash",
254
+ Transfer = "transfer",
255
+ Deduction = "deduction",
256
+ Other = "other"
257
+ }
258
+ declare enum PaymentMethod {
259
+ CashOnDelivery = "cash_on_delivery",
260
+ PrepaidOnline = "prepaid_online",
261
+ PrepaidTransfer = "prepaid_transfer",
262
+ BusinessInvoice = "business_invoice"
263
+ }
264
+ interface AdditionalFee {
265
+ description: string;
266
+ amount: number;
267
+ createdAt?: Date;
268
+ createdBy?: string;
269
+ }
270
+ interface RiderSettlement {
271
+ id: string;
272
+ errandId: string;
273
+ riderId: string;
274
+ businessId: string;
275
+ deliveryFeeAmount: number;
276
+ payOnDeliveryAmount: number;
277
+ additionalFees: AdditionalFee[];
278
+ totalCollectionAmount: number;
279
+ collectionRequired: boolean;
280
+ remittanceStatus: RemittanceStatus;
281
+ remittedAmount: number;
282
+ remittedAt?: Date;
283
+ remittedBy?: string;
284
+ remittanceMethod?: RemittanceMethod;
285
+ remittanceReference?: string;
286
+ paymentMethod?: PaymentMethod;
287
+ isPrePaid: boolean;
288
+ notes?: string;
289
+ createdAt: Date;
290
+ updatedAt: Date;
291
+ version: number;
292
+ }
293
+ interface RiderPerformanceSummary {
294
+ totalErrands: number;
295
+ totalRevenue: number;
296
+ riderCount: number;
297
+ }
298
+ interface RiderPerformanceItem {
299
+ riderId: string;
300
+ riderName: string;
301
+ errandCount: number;
302
+ revenue: number;
303
+ }
304
+ interface RiderPerformanceTimeSeries {
305
+ period: string;
306
+ errandCount: number;
307
+ revenue: number;
308
+ }
309
+ interface RiderPerformanceStats {
310
+ summary: RiderPerformanceSummary;
311
+ riders: RiderPerformanceItem[];
312
+ timeSeries?: RiderPerformanceTimeSeries[];
313
+ }
246
314
 
247
315
  declare enum ErrandStatus {
248
316
  Pending = "pending",
@@ -743,6 +811,83 @@ interface TrackerDevice {
743
811
  lastPosition?: TraccarPosition | NullOrUndefined;
744
812
  }
745
813
 
814
+ /**
815
+ * Maintenance Item - catalog of parts/services used in maintenance
816
+ */
817
+ interface MaintenanceItem {
818
+ id: string;
819
+ name: string;
820
+ slug: string;
821
+ description?: string;
822
+ businessId?: string | null;
823
+ unit?: string;
824
+ defaultUnitPrice?: number;
825
+ isActive: boolean;
826
+ createdAt: string;
827
+ updatedAt: string;
828
+ }
829
+ /**
830
+ * Part usage within a maintenance record.
831
+ * itemName is denormalized to preserve historical accuracy.
832
+ */
833
+ interface MaintenancePartUsage {
834
+ itemId: string;
835
+ itemName: string;
836
+ quantity: number;
837
+ unitPrice: number;
838
+ totalCost: number;
839
+ unit?: string;
840
+ note?: string;
841
+ }
842
+ /**
843
+ * Maintenance Record - tracks maintenance performed on a vehicle
844
+ */
845
+ interface MaintenanceRecord {
846
+ id: string;
847
+ businessId: string;
848
+ vehicleId: string;
849
+ maintenanceDate: string;
850
+ parts: MaintenancePartUsage[];
851
+ laborCost?: number;
852
+ totalCost: number;
853
+ performedBy?: string;
854
+ notes?: string;
855
+ createdAt: string;
856
+ updatedAt: string;
857
+ }
858
+ /**
859
+ * Summary statistics for maintenance records
860
+ */
861
+ interface MaintenanceStatsSummary {
862
+ totalCost: number;
863
+ totalLaborCost: number;
864
+ totalPartsCost: number;
865
+ recordCount: number;
866
+ }
867
+ /**
868
+ * Top item usage statistics
869
+ */
870
+ interface MaintenanceTopItem {
871
+ itemId: string;
872
+ itemName: string;
873
+ totalQuantity: number;
874
+ totalCost: number;
875
+ usageCount: number;
876
+ }
877
+ /**
878
+ * Maintenance statistics response
879
+ */
880
+ interface MaintenanceStats {
881
+ summary: MaintenanceStatsSummary;
882
+ topItems: MaintenanceTopItem[];
883
+ filters: {
884
+ businessId: string;
885
+ vehicleId: string | null;
886
+ startDate: string | null;
887
+ endDate: string | null;
888
+ };
889
+ }
890
+
746
891
  interface PaginateResult<T> {
747
892
  docs: T[];
748
893
  totalDocs: number;
@@ -765,4 +910,4 @@ declare enum LinkDestination {
765
910
  }
766
911
  type NullOrUndefined = null | undefined;
767
912
 
768
- export { type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, type BusinessCategory, type BusinessMember, type BusinessPg, BusinessRole, type City, 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, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type PaginateResult, ParcelSize, PaymentOptions, type PendingErrand, type Rider, RoleType, 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 };
913
+ export { type AdditionalFee, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, type BusinessCategory, type BusinessMember, type BusinessPg, BusinessRole, type City, 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, PaymentMethod, PaymentOptions, type PendingErrand, RemittanceMethod, RemittanceStatus, type Rider, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, RoleType, 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 };
package/dist/index.d.ts CHANGED
@@ -243,6 +243,74 @@ type VehicleLogWithErrands = VehicleLog & {
243
243
  errandsCount?: number;
244
244
  totalErrandsRevenue?: number;
245
245
  };
246
+ declare enum RemittanceStatus {
247
+ Pending = "pending",
248
+ Remitted = "remitted",
249
+ Waived = "waived",
250
+ Cancelled = "cancelled"
251
+ }
252
+ declare enum RemittanceMethod {
253
+ Cash = "cash",
254
+ Transfer = "transfer",
255
+ Deduction = "deduction",
256
+ Other = "other"
257
+ }
258
+ declare enum PaymentMethod {
259
+ CashOnDelivery = "cash_on_delivery",
260
+ PrepaidOnline = "prepaid_online",
261
+ PrepaidTransfer = "prepaid_transfer",
262
+ BusinessInvoice = "business_invoice"
263
+ }
264
+ interface AdditionalFee {
265
+ description: string;
266
+ amount: number;
267
+ createdAt?: Date;
268
+ createdBy?: string;
269
+ }
270
+ interface RiderSettlement {
271
+ id: string;
272
+ errandId: string;
273
+ riderId: string;
274
+ businessId: string;
275
+ deliveryFeeAmount: number;
276
+ payOnDeliveryAmount: number;
277
+ additionalFees: AdditionalFee[];
278
+ totalCollectionAmount: number;
279
+ collectionRequired: boolean;
280
+ remittanceStatus: RemittanceStatus;
281
+ remittedAmount: number;
282
+ remittedAt?: Date;
283
+ remittedBy?: string;
284
+ remittanceMethod?: RemittanceMethod;
285
+ remittanceReference?: string;
286
+ paymentMethod?: PaymentMethod;
287
+ isPrePaid: boolean;
288
+ notes?: string;
289
+ createdAt: Date;
290
+ updatedAt: Date;
291
+ version: number;
292
+ }
293
+ interface RiderPerformanceSummary {
294
+ totalErrands: number;
295
+ totalRevenue: number;
296
+ riderCount: number;
297
+ }
298
+ interface RiderPerformanceItem {
299
+ riderId: string;
300
+ riderName: string;
301
+ errandCount: number;
302
+ revenue: number;
303
+ }
304
+ interface RiderPerformanceTimeSeries {
305
+ period: string;
306
+ errandCount: number;
307
+ revenue: number;
308
+ }
309
+ interface RiderPerformanceStats {
310
+ summary: RiderPerformanceSummary;
311
+ riders: RiderPerformanceItem[];
312
+ timeSeries?: RiderPerformanceTimeSeries[];
313
+ }
246
314
 
247
315
  declare enum ErrandStatus {
248
316
  Pending = "pending",
@@ -743,6 +811,83 @@ interface TrackerDevice {
743
811
  lastPosition?: TraccarPosition | NullOrUndefined;
744
812
  }
745
813
 
814
+ /**
815
+ * Maintenance Item - catalog of parts/services used in maintenance
816
+ */
817
+ interface MaintenanceItem {
818
+ id: string;
819
+ name: string;
820
+ slug: string;
821
+ description?: string;
822
+ businessId?: string | null;
823
+ unit?: string;
824
+ defaultUnitPrice?: number;
825
+ isActive: boolean;
826
+ createdAt: string;
827
+ updatedAt: string;
828
+ }
829
+ /**
830
+ * Part usage within a maintenance record.
831
+ * itemName is denormalized to preserve historical accuracy.
832
+ */
833
+ interface MaintenancePartUsage {
834
+ itemId: string;
835
+ itemName: string;
836
+ quantity: number;
837
+ unitPrice: number;
838
+ totalCost: number;
839
+ unit?: string;
840
+ note?: string;
841
+ }
842
+ /**
843
+ * Maintenance Record - tracks maintenance performed on a vehicle
844
+ */
845
+ interface MaintenanceRecord {
846
+ id: string;
847
+ businessId: string;
848
+ vehicleId: string;
849
+ maintenanceDate: string;
850
+ parts: MaintenancePartUsage[];
851
+ laborCost?: number;
852
+ totalCost: number;
853
+ performedBy?: string;
854
+ notes?: string;
855
+ createdAt: string;
856
+ updatedAt: string;
857
+ }
858
+ /**
859
+ * Summary statistics for maintenance records
860
+ */
861
+ interface MaintenanceStatsSummary {
862
+ totalCost: number;
863
+ totalLaborCost: number;
864
+ totalPartsCost: number;
865
+ recordCount: number;
866
+ }
867
+ /**
868
+ * Top item usage statistics
869
+ */
870
+ interface MaintenanceTopItem {
871
+ itemId: string;
872
+ itemName: string;
873
+ totalQuantity: number;
874
+ totalCost: number;
875
+ usageCount: number;
876
+ }
877
+ /**
878
+ * Maintenance statistics response
879
+ */
880
+ interface MaintenanceStats {
881
+ summary: MaintenanceStatsSummary;
882
+ topItems: MaintenanceTopItem[];
883
+ filters: {
884
+ businessId: string;
885
+ vehicleId: string | null;
886
+ startDate: string | null;
887
+ endDate: string | null;
888
+ };
889
+ }
890
+
746
891
  interface PaginateResult<T> {
747
892
  docs: T[];
748
893
  totalDocs: number;
@@ -765,4 +910,4 @@ declare enum LinkDestination {
765
910
  }
766
911
  type NullOrUndefined = null | undefined;
767
912
 
768
- export { type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, type BusinessCategory, type BusinessMember, type BusinessPg, BusinessRole, type City, 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, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type PaginateResult, ParcelSize, PaymentOptions, type PendingErrand, type Rider, RoleType, 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 };
913
+ export { type AdditionalFee, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, type BusinessCategory, type BusinessMember, type BusinessPg, BusinessRole, type City, 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, PaymentMethod, PaymentOptions, type PendingErrand, RemittanceMethod, RemittanceStatus, type Rider, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, RoleType, 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 };
package/dist/index.js CHANGED
@@ -130,6 +130,27 @@ var VehicleLogType = /* @__PURE__ */ ((VehicleLogType2) => {
130
130
  VehicleLogType2["MAINTENANCE"] = "MAINTENANCE";
131
131
  return VehicleLogType2;
132
132
  })(VehicleLogType || {});
133
+ var RemittanceStatus = /* @__PURE__ */ ((RemittanceStatus2) => {
134
+ RemittanceStatus2["Pending"] = "pending";
135
+ RemittanceStatus2["Remitted"] = "remitted";
136
+ RemittanceStatus2["Waived"] = "waived";
137
+ RemittanceStatus2["Cancelled"] = "cancelled";
138
+ return RemittanceStatus2;
139
+ })(RemittanceStatus || {});
140
+ var RemittanceMethod = /* @__PURE__ */ ((RemittanceMethod2) => {
141
+ RemittanceMethod2["Cash"] = "cash";
142
+ RemittanceMethod2["Transfer"] = "transfer";
143
+ RemittanceMethod2["Deduction"] = "deduction";
144
+ RemittanceMethod2["Other"] = "other";
145
+ return RemittanceMethod2;
146
+ })(RemittanceMethod || {});
147
+ var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
148
+ PaymentMethod2["CashOnDelivery"] = "cash_on_delivery";
149
+ PaymentMethod2["PrepaidOnline"] = "prepaid_online";
150
+ PaymentMethod2["PrepaidTransfer"] = "prepaid_transfer";
151
+ PaymentMethod2["BusinessInvoice"] = "business_invoice";
152
+ return PaymentMethod2;
153
+ })(PaymentMethod || {});
133
154
 
134
155
  // src/enterprise.ts
135
156
  var EnterpriseType = /* @__PURE__ */ ((EnterpriseType2) => {
@@ -185,7 +206,10 @@ export {
185
206
  MembershipStatus,
186
207
  NotificationType,
187
208
  ParcelSize,
209
+ PaymentMethod,
188
210
  PaymentOptions,
211
+ RemittanceMethod,
212
+ RemittanceStatus,
189
213
  RoleType,
190
214
  TraccarDeviceStatus,
191
215
  VehicleLogType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mydoormot/app-types",
3
- "version": "1.7.20",
3
+ "version": "1.7.21",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
package/src/index.ts CHANGED
@@ -35,3 +35,4 @@ export * from './customer';
35
35
  export * from './transaction';
36
36
  export * from './stat';
37
37
  export * from './tracker';
38
+ export * from './maintenance';
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Maintenance Item - catalog of parts/services used in maintenance
3
+ */
4
+ export interface MaintenanceItem {
5
+ id: string;
6
+ name: string;
7
+ slug: string;
8
+ description?: string;
9
+ businessId?: string | null; // null = global item available to all businesses
10
+ unit?: string; // "piece", "liter", etc.
11
+ defaultUnitPrice?: number;
12
+ isActive: boolean;
13
+ createdAt: string;
14
+ updatedAt: string;
15
+ }
16
+
17
+ /**
18
+ * Part usage within a maintenance record.
19
+ * itemName is denormalized to preserve historical accuracy.
20
+ */
21
+ export interface MaintenancePartUsage {
22
+ itemId: string;
23
+ itemName: string; // Snapshot of item name at time of record creation
24
+ quantity: number;
25
+ unitPrice: number;
26
+ totalCost: number; // quantity * unitPrice
27
+ unit?: string;
28
+ note?: string;
29
+ }
30
+
31
+ /**
32
+ * Maintenance Record - tracks maintenance performed on a vehicle
33
+ */
34
+ export interface MaintenanceRecord {
35
+ id: string;
36
+ businessId: string;
37
+ vehicleId: string;
38
+ maintenanceDate: string;
39
+ parts: MaintenancePartUsage[];
40
+ laborCost?: number;
41
+ totalCost: number; // sum(parts.totalCost) + laborCost
42
+ performedBy?: string; // User ID who performed the maintenance
43
+ notes?: string;
44
+ createdAt: string;
45
+ updatedAt: string;
46
+ }
47
+
48
+ /**
49
+ * Summary statistics for maintenance records
50
+ */
51
+ export interface MaintenanceStatsSummary {
52
+ totalCost: number;
53
+ totalLaborCost: number;
54
+ totalPartsCost: number;
55
+ recordCount: number;
56
+ }
57
+
58
+ /**
59
+ * Top item usage statistics
60
+ */
61
+ export interface MaintenanceTopItem {
62
+ itemId: string;
63
+ itemName: string;
64
+ totalQuantity: number;
65
+ totalCost: number;
66
+ usageCount: number;
67
+ }
68
+
69
+ /**
70
+ * Maintenance statistics response
71
+ */
72
+ export interface MaintenanceStats {
73
+ summary: MaintenanceStatsSummary;
74
+ topItems: MaintenanceTopItem[];
75
+ filters: {
76
+ businessId: string;
77
+ vehicleId: string | null;
78
+ startDate: string | null;
79
+ endDate: string | null;
80
+ };
81
+ }
package/src/rider.ts CHANGED
@@ -84,3 +84,82 @@ export type VehicleLogWithErrands = VehicleLog & {
84
84
  // riderDetails: Rider | null;
85
85
  // riderUserDetails: User | null;
86
86
  // };
87
+
88
+ // Rider Settlement Types
89
+ export enum RemittanceStatus {
90
+ Pending = 'pending',
91
+ Remitted = 'remitted',
92
+ Waived = 'waived',
93
+ Cancelled = 'cancelled',
94
+ }
95
+
96
+ export enum RemittanceMethod {
97
+ Cash = 'cash',
98
+ Transfer = 'transfer',
99
+ Deduction = 'deduction',
100
+ Other = 'other',
101
+ }
102
+
103
+ export enum PaymentMethod {
104
+ CashOnDelivery = 'cash_on_delivery',
105
+ PrepaidOnline = 'prepaid_online',
106
+ PrepaidTransfer = 'prepaid_transfer',
107
+ BusinessInvoice = 'business_invoice',
108
+ }
109
+
110
+ export interface AdditionalFee {
111
+ description: string;
112
+ amount: number;
113
+ createdAt?: Date;
114
+ createdBy?: string;
115
+ }
116
+
117
+ export interface RiderSettlement {
118
+ id: string;
119
+ errandId: string;
120
+ riderId: string;
121
+ businessId: string;
122
+ deliveryFeeAmount: number;
123
+ payOnDeliveryAmount: number;
124
+ additionalFees: AdditionalFee[];
125
+ totalCollectionAmount: number;
126
+ collectionRequired: boolean;
127
+ remittanceStatus: RemittanceStatus;
128
+ remittedAmount: number;
129
+ remittedAt?: Date;
130
+ remittedBy?: string;
131
+ remittanceMethod?: RemittanceMethod;
132
+ remittanceReference?: string;
133
+ paymentMethod?: PaymentMethod;
134
+ isPrePaid: boolean;
135
+ notes?: string;
136
+ createdAt: Date;
137
+ updatedAt: Date;
138
+ version: number;
139
+ }
140
+
141
+ // Rider Performance Stats Types
142
+ export interface RiderPerformanceSummary {
143
+ totalErrands: number;
144
+ totalRevenue: number;
145
+ riderCount: number;
146
+ }
147
+
148
+ export interface RiderPerformanceItem {
149
+ riderId: string;
150
+ riderName: string;
151
+ errandCount: number;
152
+ revenue: number;
153
+ }
154
+
155
+ export interface RiderPerformanceTimeSeries {
156
+ period: string;
157
+ errandCount: number;
158
+ revenue: number;
159
+ }
160
+
161
+ export interface RiderPerformanceStats {
162
+ summary: RiderPerformanceSummary;
163
+ riders: RiderPerformanceItem[];
164
+ timeSeries?: RiderPerformanceTimeSeries[];
165
+ }