hvp-shared 6.9.0 → 6.11.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
  */
@@ -268,3 +270,105 @@ export interface QvetMovementsQueryParams {
268
270
  skip?: number;
269
271
  sort?: string;
270
272
  }
273
+ /**
274
+ * Single transfer record from QVET
275
+ * Represents an inter-warehouse transfer
276
+ */
277
+ export interface QvetTransferResponse {
278
+ id: string;
279
+ transferId: number;
280
+ date: string;
281
+ productName: string;
282
+ sourceWarehouse: string;
283
+ targetWarehouse: string;
284
+ quantity: number;
285
+ conversionFactor: number;
286
+ initialStockSource: number;
287
+ initialStockTarget: number;
288
+ unitCost: number;
289
+ averageCost: number;
290
+ lot: string;
291
+ lotExpiryDate: string | null;
292
+ userName: string;
293
+ responsibleSource: string;
294
+ responsibleTarget: string;
295
+ notes: string;
296
+ syncedAt: string;
297
+ }
298
+ /**
299
+ * Paginated list of transfers
300
+ * Uses generic QvetPaginatedResponse for consistent pagination format.
301
+ */
302
+ export type QvetTransfersListResponse = QvetPaginatedResponse<QvetTransferResponse>;
303
+ /**
304
+ * Transfers summary statistics for a period
305
+ */
306
+ export interface QvetTransfersSummaryResponse {
307
+ ok: boolean;
308
+ data: {
309
+ totalRecords: number;
310
+ totalQuantity: number;
311
+ totalValue: number;
312
+ uniqueProducts: number;
313
+ sourceWarehouses: number;
314
+ targetWarehouses: number;
315
+ };
316
+ }
317
+ /**
318
+ * Query parameters for transfers endpoint
319
+ */
320
+ export interface QvetTransfersQueryParams {
321
+ startDate?: string;
322
+ endDate?: string;
323
+ year?: number;
324
+ month?: number;
325
+ halfMonth?: 1 | 2;
326
+ sourceWarehouse?: string;
327
+ targetWarehouse?: string;
328
+ productName?: string;
329
+ limit?: number;
330
+ skip?: number;
331
+ sort?: string;
332
+ }
333
+ /**
334
+ * Single item within a consolidated transfer
335
+ */
336
+ export interface ConsolidatedTransferItem {
337
+ productName: string;
338
+ quantity: number;
339
+ unitCost: number;
340
+ totalValue: number;
341
+ lot: string;
342
+ }
343
+ /**
344
+ * Consolidated transfer record
345
+ *
346
+ * QVET registers inter-warehouse transfers as multiple movements through
347
+ * intermediate "COLABORADOR-X" warehouses. This consolidated view combines
348
+ * those movements to show the real source and target warehouses.
349
+ *
350
+ * @example
351
+ * Original in QVET:
352
+ * ID 3206: MONTEJO → COLABORADOR-URBAN (exit)
353
+ * ID 3207: COLABORADOR-URBAN → URBAN CENTER (entry)
354
+ *
355
+ * Consolidated:
356
+ * realSource: "MONTEJO"
357
+ * realTarget: "URBAN CENTER"
358
+ * transferIds: [3206, 3207]
359
+ */
360
+ export interface ConsolidatedTransfer {
361
+ date: string;
362
+ realSource: string;
363
+ realTarget: string;
364
+ items: ConsolidatedTransferItem[];
365
+ totalItems: number;
366
+ totalQuantity: number;
367
+ totalValue: number;
368
+ transferIds: number[];
369
+ }
370
+ /**
371
+ * Paginated list of consolidated transfers
372
+ * Uses generic QvetPaginatedResponse for consistent pagination format.
373
+ */
374
+ export type ConsolidatedTransfersResponse = QvetPaginatedResponse<ConsolidatedTransfer>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hvp-shared",
3
- "version": "6.9.0",
3
+ "version": "6.11.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",