hvp-shared 6.10.0 → 6.12.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.
@@ -4,6 +4,32 @@
4
4
  * Response interfaces for QVET data endpoints.
5
5
  * Used by frontend to consume synced QVET data.
6
6
  */
7
+ /**
8
+ * Standard pagination info for QVET endpoints
9
+ */
10
+ export interface QvetPagination {
11
+ total: number;
12
+ limit: number;
13
+ skip: number;
14
+ hasMore: boolean;
15
+ }
16
+ /**
17
+ * Generic paginated response for QVET list endpoints
18
+ * Use this for all QVET list endpoints to ensure consistent pagination format.
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
+ * }
27
+ */
28
+ export interface QvetPaginatedResponse<T> {
29
+ ok: boolean;
30
+ data: T[];
31
+ pagination: QvetPagination;
32
+ }
7
33
  /**
8
34
  * Single sale record from QVET
9
35
  * Represents one line item in a sale transaction
@@ -40,17 +66,9 @@ export interface QvetSaleResponse {
40
66
  }
41
67
  /**
42
68
  * Paginated list of sales
69
+ * Uses generic QvetPaginatedResponse for consistent pagination format.
43
70
  */
44
- export interface QvetSalesListResponse {
45
- ok: boolean;
46
- data: QvetSaleResponse[];
47
- pagination: {
48
- total: number;
49
- limit: number;
50
- skip: number;
51
- hasMore: boolean;
52
- };
53
- }
71
+ export type QvetSalesListResponse = QvetPaginatedResponse<QvetSaleResponse>;
54
72
  /**
55
73
  * Sales summary statistics for a period
56
74
  */
@@ -134,17 +152,9 @@ export interface QvetPurchaseResponse {
134
152
  }
135
153
  /**
136
154
  * Paginated list of purchases
155
+ * Uses generic QvetPaginatedResponse for consistent pagination format.
137
156
  */
138
- export interface QvetPurchasesListResponse {
139
- ok: boolean;
140
- data: QvetPurchaseResponse[];
141
- pagination: {
142
- total: number;
143
- limit: number;
144
- skip: number;
145
- hasMore: boolean;
146
- };
147
- }
157
+ export type QvetPurchasesListResponse = QvetPaginatedResponse<QvetPurchaseResponse>;
148
158
  /**
149
159
  * Purchases summary statistics for a period
150
160
  */
@@ -221,17 +231,9 @@ export interface QvetMovementResponse {
221
231
  }
222
232
  /**
223
233
  * Paginated list of movements
234
+ * Uses generic QvetPaginatedResponse for consistent pagination format.
224
235
  */
225
- export interface QvetMovementsListResponse {
226
- ok: boolean;
227
- data: QvetMovementResponse[];
228
- pagination: {
229
- total: number;
230
- limit: number;
231
- skip: number;
232
- hasMore: boolean;
233
- };
234
- }
236
+ export type QvetMovementsListResponse = QvetPaginatedResponse<QvetMovementResponse>;
235
237
  /**
236
238
  * Movements summary statistics for a period
237
239
  */
@@ -295,17 +297,9 @@ export interface QvetTransferResponse {
295
297
  }
296
298
  /**
297
299
  * Paginated list of transfers
300
+ * Uses generic QvetPaginatedResponse for consistent pagination format.
298
301
  */
299
- export interface QvetTransfersListResponse {
300
- ok: boolean;
301
- data: QvetTransferResponse[];
302
- pagination: {
303
- total: number;
304
- limit: number;
305
- skip: number;
306
- hasMore: boolean;
307
- };
308
- }
302
+ export type QvetTransfersListResponse = QvetPaginatedResponse<QvetTransferResponse>;
309
303
  /**
310
304
  * Transfers summary statistics for a period
311
305
  */
@@ -336,3 +330,77 @@ export interface QvetTransfersQueryParams {
336
330
  skip?: number;
337
331
  sort?: string;
338
332
  }
333
+ /**
334
+ * Status of a consolidated transfer
335
+ * - completed: Both exit and entry legs exist
336
+ * - pending: Only exit leg exists (transfer in transit)
337
+ */
338
+ export type ConsolidatedTransferStatus = 'completed' | 'pending';
339
+ /**
340
+ * Single item within a consolidated transfer
341
+ */
342
+ export interface ConsolidatedTransferItem {
343
+ productName: string;
344
+ quantity: number;
345
+ unitCost: number;
346
+ totalValue: number;
347
+ lot: string;
348
+ }
349
+ /**
350
+ * Consolidated transfer record
351
+ *
352
+ * QVET registers inter-warehouse transfers as multiple movements through
353
+ * intermediate "COLABORADOR-X" warehouses. This consolidated view combines
354
+ * those movements to show the real source and target warehouses.
355
+ *
356
+ * @example
357
+ * Original in QVET:
358
+ * Exit: ID 3206 @ 14:42 - MONTEJO → COLABORADOR-URBAN
359
+ * Entry: ID 3207 @ 15:01 - COLABORADOR-URBAN → URBAN CENTER
360
+ *
361
+ * Consolidated:
362
+ * exitDate: "2025-01-23T14:42:00.000Z"
363
+ * entryDate: "2025-01-23T15:01:00.000Z"
364
+ * realSource: "MONTEJO"
365
+ * realTarget: "URBAN CENTER"
366
+ * status: "completed"
367
+ * exitTransferIds: [3206]
368
+ * entryTransferIds: [3207]
369
+ *
370
+ * If only exit exists (pending):
371
+ * entryDate: null
372
+ * realTarget: null
373
+ * status: "pending"
374
+ * entryTransferIds: []
375
+ */
376
+ export interface ConsolidatedTransfer {
377
+ /** When items left the source warehouse */
378
+ exitDate: string;
379
+ /** When items arrived at destination (null if pending) */
380
+ entryDate: string | null;
381
+ /** Real source warehouse (not COLABORADOR) */
382
+ realSource: string;
383
+ /** Real target warehouse (null if pending/unknown) */
384
+ realTarget: string | null;
385
+ /** Transfer status */
386
+ status: ConsolidatedTransferStatus;
387
+ /** Notes/observations from the transfer (combined from all items) */
388
+ notes: string;
389
+ /** Items in this transfer */
390
+ items: ConsolidatedTransferItem[];
391
+ /** Number of distinct items */
392
+ totalItems: number;
393
+ /** Sum of all quantities */
394
+ totalQuantity: number;
395
+ /** Sum of all item values */
396
+ totalValue: number;
397
+ /** QVET transfer IDs for exit leg */
398
+ exitTransferIds: number[];
399
+ /** QVET transfer IDs for entry leg */
400
+ entryTransferIds: number[];
401
+ }
402
+ /**
403
+ * Paginated list of consolidated transfers
404
+ * Uses generic QvetPaginatedResponse for consistent pagination format.
405
+ */
406
+ export type ConsolidatedTransfersResponse = QvetPaginatedResponse<ConsolidatedTransfer>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hvp-shared",
3
- "version": "6.10.0",
3
+ "version": "6.12.0",
4
4
  "description": "Shared types and utilities for HVP backend and frontend",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",