hvp-shared 6.12.0 → 6.13.0
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,11 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* QVET API Response Types
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Item types and data payloads for QVET endpoints.
|
|
5
|
+
*
|
|
6
|
+
* ## Response Pattern
|
|
7
|
+
*
|
|
8
|
+
* Backend uses standard ApiResponse types from hvp-shared:
|
|
9
|
+
* - Lists: `ApiListSuccessResponse<QvetSaleResponse[]>` with meta/links
|
|
10
|
+
* - Single: `ApiSingleSuccessResponse<QvetSalesSummaryData>`
|
|
11
|
+
* - Arrays (no pagination): `ApiSingleSuccessResponse<QvetSalesBySectionItem[]>`
|
|
12
|
+
*
|
|
13
|
+
* Frontend receives standard format:
|
|
14
|
+
* ```json
|
|
15
|
+
* {
|
|
16
|
+
* "ok": true,
|
|
17
|
+
* "status_code": 200,
|
|
18
|
+
* "resource": "qvet-sales",
|
|
19
|
+
* "operation": "all",
|
|
20
|
+
* "data": [...],
|
|
21
|
+
* "meta": { "total": 100, "page": 1, "limit": 25, "totalPages": 4, "itemsOnPage": 25 },
|
|
22
|
+
* "links": { "current": "...", "next": "...", ... }
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
6
25
|
*/
|
|
7
26
|
/**
|
|
8
|
-
*
|
|
27
|
+
* @deprecated No longer used. Backend uses standard ApiListSuccessResponse with meta.
|
|
28
|
+
* Kept for backward compatibility during migration.
|
|
9
29
|
*/
|
|
10
30
|
export interface QvetPagination {
|
|
11
31
|
total: number;
|
|
@@ -14,16 +34,8 @@ export interface QvetPagination {
|
|
|
14
34
|
hasMore: boolean;
|
|
15
35
|
}
|
|
16
36
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* // Backend returns this structure:
|
|
22
|
-
* {
|
|
23
|
-
* ok: true,
|
|
24
|
-
* data: [...],
|
|
25
|
-
* pagination: { total: 100, limit: 25, skip: 0, hasMore: true }
|
|
26
|
-
* }
|
|
37
|
+
* @deprecated No longer used. Backend uses ApiListSuccessResponse<T[]> directly.
|
|
38
|
+
* Kept for backward compatibility during migration.
|
|
27
39
|
*/
|
|
28
40
|
export interface QvetPaginatedResponse<T> {
|
|
29
41
|
ok: boolean;
|
|
@@ -65,29 +77,34 @@ export interface QvetSaleResponse {
|
|
|
65
77
|
syncedAt: string;
|
|
66
78
|
}
|
|
67
79
|
/**
|
|
68
|
-
*
|
|
69
|
-
* Uses generic QvetPaginatedResponse for consistent pagination format.
|
|
80
|
+
* @deprecated Use ApiListSuccessResponse<QvetSaleResponse[]> instead.
|
|
70
81
|
*/
|
|
71
82
|
export type QvetSalesListResponse = QvetPaginatedResponse<QvetSaleResponse>;
|
|
72
83
|
/**
|
|
73
|
-
* Sales summary statistics for a period
|
|
84
|
+
* Sales summary statistics data for a period.
|
|
85
|
+
* Backend wraps with: ApiSingleSuccessResponse<QvetSalesSummaryData>
|
|
86
|
+
*/
|
|
87
|
+
export interface QvetSalesSummaryData {
|
|
88
|
+
totalRecords: number;
|
|
89
|
+
totalSales: number;
|
|
90
|
+
totalSubtotal: number;
|
|
91
|
+
totalTax: number;
|
|
92
|
+
totalDiscount: number;
|
|
93
|
+
totalQuantity: number;
|
|
94
|
+
avgTicket: number;
|
|
95
|
+
uniqueCustomers: number;
|
|
96
|
+
uniqueProducts: number;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* @deprecated Use QvetSalesSummaryData with ApiSingleSuccessResponse.
|
|
74
100
|
*/
|
|
75
101
|
export interface QvetSalesSummaryResponse {
|
|
76
102
|
ok: boolean;
|
|
77
|
-
data:
|
|
78
|
-
totalRecords: number;
|
|
79
|
-
totalSales: number;
|
|
80
|
-
totalSubtotal: number;
|
|
81
|
-
totalTax: number;
|
|
82
|
-
totalDiscount: number;
|
|
83
|
-
totalQuantity: number;
|
|
84
|
-
avgTicket: number;
|
|
85
|
-
uniqueCustomers: number;
|
|
86
|
-
uniqueProducts: number;
|
|
87
|
-
};
|
|
103
|
+
data: QvetSalesSummaryData;
|
|
88
104
|
}
|
|
89
105
|
/**
|
|
90
|
-
* Sales by section aggregation
|
|
106
|
+
* Sales by section aggregation item.
|
|
107
|
+
* Backend returns: ApiSingleSuccessResponse<QvetSalesBySectionItem[]>
|
|
91
108
|
*/
|
|
92
109
|
export interface QvetSalesBySectionItem {
|
|
93
110
|
section: string;
|
|
@@ -95,10 +112,6 @@ export interface QvetSalesBySectionItem {
|
|
|
95
112
|
totalQuantity: number;
|
|
96
113
|
recordCount: number;
|
|
97
114
|
}
|
|
98
|
-
export interface QvetSalesBySectionResponse {
|
|
99
|
-
ok: boolean;
|
|
100
|
-
data: QvetSalesBySectionItem[];
|
|
101
|
-
}
|
|
102
115
|
/**
|
|
103
116
|
* Query parameters for sales endpoint
|
|
104
117
|
*/
|
|
@@ -114,6 +127,7 @@ export interface QvetSalesQueryParams {
|
|
|
114
127
|
qvetCode?: number;
|
|
115
128
|
customerName?: string;
|
|
116
129
|
limit?: number;
|
|
130
|
+
page?: number;
|
|
117
131
|
skip?: number;
|
|
118
132
|
sort?: string;
|
|
119
133
|
}
|
|
@@ -151,29 +165,34 @@ export interface QvetPurchaseResponse {
|
|
|
151
165
|
syncedAt: string;
|
|
152
166
|
}
|
|
153
167
|
/**
|
|
154
|
-
*
|
|
155
|
-
* Uses generic QvetPaginatedResponse for consistent pagination format.
|
|
168
|
+
* @deprecated Use ApiListSuccessResponse<QvetPurchaseResponse[]> instead.
|
|
156
169
|
*/
|
|
157
170
|
export type QvetPurchasesListResponse = QvetPaginatedResponse<QvetPurchaseResponse>;
|
|
158
171
|
/**
|
|
159
|
-
* Purchases summary statistics for a period
|
|
172
|
+
* Purchases summary statistics data for a period.
|
|
173
|
+
* Backend wraps with: ApiSingleSuccessResponse<QvetPurchasesSummaryData>
|
|
174
|
+
*/
|
|
175
|
+
export interface QvetPurchasesSummaryData {
|
|
176
|
+
totalRecords: number;
|
|
177
|
+
totalPurchases: number;
|
|
178
|
+
totalSubtotal: number;
|
|
179
|
+
totalTax: number;
|
|
180
|
+
totalDiscount: number;
|
|
181
|
+
totalQuantity: number;
|
|
182
|
+
avgPurchase: number;
|
|
183
|
+
uniqueSuppliers: number;
|
|
184
|
+
uniqueProducts: number;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* @deprecated Use QvetPurchasesSummaryData with ApiSingleSuccessResponse.
|
|
160
188
|
*/
|
|
161
189
|
export interface QvetPurchasesSummaryResponse {
|
|
162
190
|
ok: boolean;
|
|
163
|
-
data:
|
|
164
|
-
totalRecords: number;
|
|
165
|
-
totalPurchases: number;
|
|
166
|
-
totalSubtotal: number;
|
|
167
|
-
totalTax: number;
|
|
168
|
-
totalDiscount: number;
|
|
169
|
-
totalQuantity: number;
|
|
170
|
-
avgPurchase: number;
|
|
171
|
-
uniqueSuppliers: number;
|
|
172
|
-
uniqueProducts: number;
|
|
173
|
-
};
|
|
191
|
+
data: QvetPurchasesSummaryData;
|
|
174
192
|
}
|
|
175
193
|
/**
|
|
176
|
-
* Purchases by supplier aggregation
|
|
194
|
+
* Purchases by supplier aggregation item.
|
|
195
|
+
* Backend returns: ApiSingleSuccessResponse<QvetPurchasesBySupplierItem[]>
|
|
177
196
|
*/
|
|
178
197
|
export interface QvetPurchasesBySupplierItem {
|
|
179
198
|
supplier: string;
|
|
@@ -181,10 +200,6 @@ export interface QvetPurchasesBySupplierItem {
|
|
|
181
200
|
totalQuantity: number;
|
|
182
201
|
recordCount: number;
|
|
183
202
|
}
|
|
184
|
-
export interface QvetPurchasesBySupplierResponse {
|
|
185
|
-
ok: boolean;
|
|
186
|
-
data: QvetPurchasesBySupplierItem[];
|
|
187
|
-
}
|
|
188
203
|
/**
|
|
189
204
|
* Query parameters for purchases endpoint
|
|
190
205
|
*/
|
|
@@ -200,6 +215,7 @@ export interface QvetPurchasesQueryParams {
|
|
|
200
215
|
supplier?: string;
|
|
201
216
|
qvetCode?: number;
|
|
202
217
|
limit?: number;
|
|
218
|
+
page?: number;
|
|
203
219
|
skip?: number;
|
|
204
220
|
sort?: string;
|
|
205
221
|
}
|
|
@@ -230,26 +246,34 @@ export interface QvetMovementResponse {
|
|
|
230
246
|
syncedAt: string;
|
|
231
247
|
}
|
|
232
248
|
/**
|
|
233
|
-
*
|
|
234
|
-
* Uses generic QvetPaginatedResponse for consistent pagination format.
|
|
249
|
+
* @deprecated Use ApiListSuccessResponse<QvetMovementResponse[]> instead.
|
|
235
250
|
*/
|
|
236
251
|
export type QvetMovementsListResponse = QvetPaginatedResponse<QvetMovementResponse>;
|
|
237
252
|
/**
|
|
238
|
-
*
|
|
253
|
+
* Movement type breakdown item.
|
|
254
|
+
*/
|
|
255
|
+
export interface MovementTypeBreakdown {
|
|
256
|
+
type: string;
|
|
257
|
+
count: number;
|
|
258
|
+
totalQuantity: number;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Movements summary statistics data for a period.
|
|
262
|
+
* Backend wraps with: ApiSingleSuccessResponse<QvetMovementsSummaryData>
|
|
263
|
+
*/
|
|
264
|
+
export interface QvetMovementsSummaryData {
|
|
265
|
+
totalRecords: number;
|
|
266
|
+
totalQuantityIn: number;
|
|
267
|
+
totalQuantityOut: number;
|
|
268
|
+
uniqueProducts: number;
|
|
269
|
+
byMovementType: MovementTypeBreakdown[];
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* @deprecated Use QvetMovementsSummaryData with ApiSingleSuccessResponse.
|
|
239
273
|
*/
|
|
240
274
|
export interface QvetMovementsSummaryResponse {
|
|
241
275
|
ok: boolean;
|
|
242
|
-
data:
|
|
243
|
-
totalRecords: number;
|
|
244
|
-
totalQuantityIn: number;
|
|
245
|
-
totalQuantityOut: number;
|
|
246
|
-
uniqueProducts: number;
|
|
247
|
-
byMovementType: Array<{
|
|
248
|
-
type: string;
|
|
249
|
-
count: number;
|
|
250
|
-
totalQuantity: number;
|
|
251
|
-
}>;
|
|
252
|
-
};
|
|
276
|
+
data: QvetMovementsSummaryData;
|
|
253
277
|
}
|
|
254
278
|
/**
|
|
255
279
|
* Query parameters for movements endpoint
|
|
@@ -267,6 +291,7 @@ export interface QvetMovementsQueryParams {
|
|
|
267
291
|
family?: string;
|
|
268
292
|
qvetCode?: number;
|
|
269
293
|
limit?: number;
|
|
294
|
+
page?: number;
|
|
270
295
|
skip?: number;
|
|
271
296
|
sort?: string;
|
|
272
297
|
}
|
|
@@ -296,23 +321,27 @@ export interface QvetTransferResponse {
|
|
|
296
321
|
syncedAt: string;
|
|
297
322
|
}
|
|
298
323
|
/**
|
|
299
|
-
*
|
|
300
|
-
* Uses generic QvetPaginatedResponse for consistent pagination format.
|
|
324
|
+
* @deprecated Use ApiListSuccessResponse<QvetTransferResponse[]> instead.
|
|
301
325
|
*/
|
|
302
326
|
export type QvetTransfersListResponse = QvetPaginatedResponse<QvetTransferResponse>;
|
|
303
327
|
/**
|
|
304
|
-
* Transfers summary statistics for a period
|
|
328
|
+
* Transfers summary statistics data for a period.
|
|
329
|
+
* Backend wraps with: ApiSingleSuccessResponse<QvetTransfersSummaryData>
|
|
330
|
+
*/
|
|
331
|
+
export interface QvetTransfersSummaryData {
|
|
332
|
+
totalRecords: number;
|
|
333
|
+
totalQuantity: number;
|
|
334
|
+
totalValue: number;
|
|
335
|
+
uniqueProducts: number;
|
|
336
|
+
sourceWarehouses: number;
|
|
337
|
+
targetWarehouses: number;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* @deprecated Use QvetTransfersSummaryData with ApiSingleSuccessResponse.
|
|
305
341
|
*/
|
|
306
342
|
export interface QvetTransfersSummaryResponse {
|
|
307
343
|
ok: boolean;
|
|
308
|
-
data:
|
|
309
|
-
totalRecords: number;
|
|
310
|
-
totalQuantity: number;
|
|
311
|
-
totalValue: number;
|
|
312
|
-
uniqueProducts: number;
|
|
313
|
-
sourceWarehouses: number;
|
|
314
|
-
targetWarehouses: number;
|
|
315
|
-
};
|
|
344
|
+
data: QvetTransfersSummaryData;
|
|
316
345
|
}
|
|
317
346
|
/**
|
|
318
347
|
* Query parameters for transfers endpoint
|
|
@@ -327,6 +356,7 @@ export interface QvetTransfersQueryParams {
|
|
|
327
356
|
targetWarehouse?: string;
|
|
328
357
|
productName?: string;
|
|
329
358
|
limit?: number;
|
|
359
|
+
page?: number;
|
|
330
360
|
skip?: number;
|
|
331
361
|
sort?: string;
|
|
332
362
|
}
|
|
@@ -400,7 +430,83 @@ export interface ConsolidatedTransfer {
|
|
|
400
430
|
entryTransferIds: number[];
|
|
401
431
|
}
|
|
402
432
|
/**
|
|
403
|
-
*
|
|
404
|
-
* Uses generic QvetPaginatedResponse for consistent pagination format.
|
|
433
|
+
* @deprecated Use ApiListSuccessResponse<ConsolidatedTransfer[]> instead.
|
|
405
434
|
*/
|
|
406
435
|
export type ConsolidatedTransfersResponse = QvetPaginatedResponse<ConsolidatedTransfer>;
|
|
436
|
+
/**
|
|
437
|
+
* Single collection (cobro) record from QVET
|
|
438
|
+
* Represents a payment transaction - used for reception bonus calculations
|
|
439
|
+
*
|
|
440
|
+
* Field presence analysis (9787 rows from 2025):
|
|
441
|
+
* - 100%: amount, type, branch
|
|
442
|
+
* - 99%+: collectorName, cashRegister, paymentMethod
|
|
443
|
+
* - 96%: date, time, company
|
|
444
|
+
* - 87-92%: customerName, saleDate, sellerName, deliveryNoteNumber, invoice info
|
|
445
|
+
* - 40%: state, city, postalCode
|
|
446
|
+
*/
|
|
447
|
+
export interface QvetCollectionResponse {
|
|
448
|
+
id: string;
|
|
449
|
+
amount: number;
|
|
450
|
+
type: string;
|
|
451
|
+
branch: string;
|
|
452
|
+
collectorName?: string;
|
|
453
|
+
cashRegister?: string;
|
|
454
|
+
paymentMethod?: string;
|
|
455
|
+
date?: string;
|
|
456
|
+
time?: string;
|
|
457
|
+
company?: string;
|
|
458
|
+
customerName?: string;
|
|
459
|
+
saleDate?: string;
|
|
460
|
+
sellerName?: string;
|
|
461
|
+
deliveryNoteNumber?: number;
|
|
462
|
+
invoiceDate?: string;
|
|
463
|
+
invoiceNumber?: string;
|
|
464
|
+
state?: string;
|
|
465
|
+
city?: string;
|
|
466
|
+
postalCode?: string;
|
|
467
|
+
address?: string;
|
|
468
|
+
syncedAt: string;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Collections summary statistics data.
|
|
472
|
+
* Backend wraps with: ApiSingleSuccessResponse<QvetCollectionsSummaryData>
|
|
473
|
+
*/
|
|
474
|
+
export interface QvetCollectionsSummaryData {
|
|
475
|
+
totalRecords: number;
|
|
476
|
+
totalAmount: number;
|
|
477
|
+
avgAmount: number;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Collections grouped by collector - for reception bonus calculations.
|
|
481
|
+
* Backend returns: ApiSingleSuccessResponse<QvetCollectionsByCollectorItem[]>
|
|
482
|
+
*/
|
|
483
|
+
export interface QvetCollectionsByCollectorItem {
|
|
484
|
+
collectorName: string;
|
|
485
|
+
totalAmount: number;
|
|
486
|
+
recordCount: number;
|
|
487
|
+
branches: string[];
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Collections grouped by payment method.
|
|
491
|
+
* Backend returns: ApiSingleSuccessResponse<QvetCollectionsByPaymentMethodItem[]>
|
|
492
|
+
*/
|
|
493
|
+
export interface QvetCollectionsByPaymentMethodItem {
|
|
494
|
+
paymentMethod: string;
|
|
495
|
+
totalAmount: number;
|
|
496
|
+
recordCount: number;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Query parameters for collections endpoint
|
|
500
|
+
*/
|
|
501
|
+
export interface QvetCollectionsQueryParams {
|
|
502
|
+
year?: number;
|
|
503
|
+
month?: number;
|
|
504
|
+
halfMonth?: 1 | 2;
|
|
505
|
+
branch?: string;
|
|
506
|
+
collectorName?: string;
|
|
507
|
+
paymentMethod?: string;
|
|
508
|
+
type?: string;
|
|
509
|
+
limit?: number;
|
|
510
|
+
page?: number;
|
|
511
|
+
skip?: number;
|
|
512
|
+
}
|
|
@@ -2,7 +2,26 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* QVET API Response Types
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Item types and data payloads for QVET endpoints.
|
|
6
|
+
*
|
|
7
|
+
* ## Response Pattern
|
|
8
|
+
*
|
|
9
|
+
* Backend uses standard ApiResponse types from hvp-shared:
|
|
10
|
+
* - Lists: `ApiListSuccessResponse<QvetSaleResponse[]>` with meta/links
|
|
11
|
+
* - Single: `ApiSingleSuccessResponse<QvetSalesSummaryData>`
|
|
12
|
+
* - Arrays (no pagination): `ApiSingleSuccessResponse<QvetSalesBySectionItem[]>`
|
|
13
|
+
*
|
|
14
|
+
* Frontend receives standard format:
|
|
15
|
+
* ```json
|
|
16
|
+
* {
|
|
17
|
+
* "ok": true,
|
|
18
|
+
* "status_code": 200,
|
|
19
|
+
* "resource": "qvet-sales",
|
|
20
|
+
* "operation": "all",
|
|
21
|
+
* "data": [...],
|
|
22
|
+
* "meta": { "total": 100, "page": 1, "limit": 25, "totalPages": 4, "itemsOnPage": 25 },
|
|
23
|
+
* "links": { "current": "...", "next": "...", ... }
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
7
26
|
*/
|
|
8
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|