qeai-sdk 2.0.1 → 2.0.2

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.
Files changed (129) hide show
  1. package/dist/dtos/auth/register-user.dto.js +4 -1
  2. package/dist/dtos/categories/create-category.dto.js +6 -3
  3. package/dist/dtos/categories/delete-category.dto.d.ts +1 -1
  4. package/dist/dtos/categories/delete-category.dto.js +5 -3
  5. package/dist/dtos/categories/update-category.dto.d.ts +12 -10
  6. package/dist/dtos/categories/update-category.dto.js +15 -13
  7. package/dist/dtos/chain/create-chain.dto.d.ts +11 -12
  8. package/dist/dtos/chain/create-chain.dto.js +15 -14
  9. package/dist/dtos/chain/delete-chain.dto.d.ts +6 -6
  10. package/dist/dtos/chain/delete-chain.dto.js +11 -9
  11. package/dist/dtos/chain/update-chain.dto.d.ts +26 -16
  12. package/dist/dtos/chain/update-chain.dto.js +32 -21
  13. package/dist/dtos/common/search-by-name.dto.d.ts +23 -0
  14. package/dist/dtos/common/search-by-name.dto.js +24 -1
  15. package/dist/dtos/ingredients/create-ingredient.dto.d.ts +5 -5
  16. package/dist/dtos/ingredients/create-ingredient.dto.js +9 -8
  17. package/dist/dtos/ingredients/delete-ingredient.dto.d.ts +14 -7
  18. package/dist/dtos/ingredients/delete-ingredient.dto.js +18 -9
  19. package/dist/dtos/ingredients/index.d.ts +0 -1
  20. package/dist/dtos/ingredients/index.js +0 -1
  21. package/dist/dtos/ingredients/update-ingredient.dto.d.ts +20 -11
  22. package/dist/dtos/ingredients/update-ingredient.dto.js +28 -19
  23. package/dist/dtos/orders/change-order-status.dto.d.ts +19 -10
  24. package/dist/dtos/orders/change-order-status.dto.js +27 -14
  25. package/dist/dtos/orders/create-order.dto.d.ts +33 -23
  26. package/dist/dtos/orders/create-order.dto.js +43 -31
  27. package/dist/dtos/orders/order-item.dto.d.ts +35 -18
  28. package/dist/dtos/orders/order-item.dto.js +54 -32
  29. package/dist/dtos/orders/order-pagination.dto.d.ts +1 -1
  30. package/dist/dtos/orders/order-pagination.dto.js +3 -3
  31. package/dist/dtos/orders/paid-order.dto.d.ts +16 -8
  32. package/dist/dtos/orders/paid-order.dto.js +25 -14
  33. package/dist/dtos/payments/create-payment-audit-dynamo.dto.d.ts +81 -0
  34. package/dist/dtos/payments/create-payment-audit-dynamo.dto.js +81 -0
  35. package/dist/dtos/payments/create-payment-audit-s3.dto.d.ts +81 -0
  36. package/dist/dtos/payments/create-payment-audit-s3.dto.js +81 -0
  37. package/dist/dtos/payments/index.d.ts +2 -0
  38. package/dist/dtos/payments/index.js +2 -0
  39. package/dist/dtos/payments/payment-session-item.dto.d.ts +4 -4
  40. package/dist/dtos/payments/payment-session-item.dto.js +7 -4
  41. package/dist/dtos/payments/webhook-data.dto.d.ts +1 -1
  42. package/dist/dtos/payments/webhook-data.dto.js +1 -0
  43. package/dist/dtos/products/create-product.dto.d.ts +1 -1
  44. package/dist/dtos/products/create-product.dto.js +2 -1
  45. package/dist/dtos/products/delete-product.dto.d.ts +1 -1
  46. package/dist/dtos/products/delete-product.dto.js +5 -3
  47. package/dist/dtos/products/submodules/product-image/bulk-create-product-image.dto.d.ts +3 -3
  48. package/dist/dtos/products/submodules/product-image/bulk-create-product-image.dto.js +5 -5
  49. package/dist/dtos/products/submodules/product-image/create-product-image.dto.d.ts +1 -1
  50. package/dist/dtos/products/submodules/product-image/create-product-image.dto.js +4 -4
  51. package/dist/dtos/products/submodules/product-image/update-product-image.dto.d.ts +1 -1
  52. package/dist/dtos/products/submodules/product-image/update-product-image.dto.js +4 -4
  53. package/dist/dtos/products/submodules/product-question/create-product-question.dto.d.ts +2 -2
  54. package/dist/dtos/products/submodules/product-question/create-product-question.dto.js +8 -8
  55. package/dist/dtos/products/submodules/product-question/replace-by-product-id.dto.d.ts +1 -1
  56. package/dist/dtos/products/submodules/product-question/update-product-question.dto.d.ts +1 -1
  57. package/dist/dtos/products/submodules/product-question/update-product-question.dto.js +4 -4
  58. package/dist/dtos/products/submodules/product-recipe/create-product-recipe.dto.d.ts +1 -1
  59. package/dist/dtos/products/submodules/product-recipe/create-product-recipe.dto.js +2 -2
  60. package/dist/dtos/products/submodules/product-recipe/replace-by-product-id.dto.d.ts +2 -2
  61. package/dist/dtos/products/submodules/product-recipe/replace-by-product-id.dto.js +5 -5
  62. package/dist/dtos/products/submodules/product-recipe/update-product-recipe.dto.d.ts +1 -8
  63. package/dist/dtos/products/submodules/product-recipe/update-product-recipe.dto.js +3 -16
  64. package/dist/dtos/products/submodules/product-schedule/create-product-schedule.dto.d.ts +1 -1
  65. package/dist/dtos/products/submodules/product-schedule/create-product-schedule.dto.js +2 -2
  66. package/dist/dtos/products/submodules/product-schedule/replace-by-product-id.dto.d.ts +1 -1
  67. package/dist/dtos/products/submodules/product-schedule/update-product-schedule.dto.d.ts +1 -1
  68. package/dist/dtos/products/submodules/product-schedule/update-product-schedule.dto.js +4 -4
  69. package/dist/dtos/products/submodules/product-size/create-product-size.dto.js +1 -1
  70. package/dist/dtos/products/submodules/product-size/product-size-data.dto.js +1 -1
  71. package/dist/dtos/products/submodules/product-size/update-product-size.dto.d.ts +1 -1
  72. package/dist/dtos/products/submodules/product-size/update-product-size.dto.js +2 -2
  73. package/dist/dtos/products/submodules/product-tag/index.d.ts +1 -3
  74. package/dist/dtos/products/submodules/product-tag/index.js +1 -3
  75. package/dist/dtos/products/submodules/product-tag/{remove-product-tag.dto.d.ts → product-tag.dto.d.ts} +1 -1
  76. package/dist/dtos/products/submodules/product-tag/{remove-product-tag.dto.js → product-tag.dto.js} +3 -3
  77. package/dist/dtos/products/update-product.dto.d.ts +4 -4
  78. package/dist/dtos/products/update-product.dto.js +5 -4
  79. package/dist/dtos/questions/create-question.dto.d.ts +1 -1
  80. package/dist/dtos/questions/create-question.dto.js +2 -1
  81. package/dist/dtos/questions/delete-question.dto.d.ts +1 -1
  82. package/dist/dtos/questions/delete-question.dto.js +5 -3
  83. package/dist/dtos/questions/index.d.ts +0 -1
  84. package/dist/dtos/questions/index.js +0 -1
  85. package/dist/dtos/questions/update-question.dto.d.ts +4 -4
  86. package/dist/dtos/questions/update-question.dto.js +5 -5
  87. package/dist/dtos/restaurants/create-restaurant.dto.d.ts +15 -1
  88. package/dist/dtos/restaurants/create-restaurant.dto.js +38 -2
  89. package/dist/dtos/restaurants/delete-restaurant.dto.d.ts +1 -1
  90. package/dist/dtos/restaurants/delete-restaurant.dto.js +5 -3
  91. package/dist/dtos/restaurants/update-restaurant.dto.d.ts +17 -10
  92. package/dist/dtos/restaurants/update-restaurant.dto.js +32 -16
  93. package/dist/dtos/tags/create-tag.dto.d.ts +1 -1
  94. package/dist/dtos/tags/create-tag.dto.js +5 -4
  95. package/dist/dtos/tags/delete-tag.dto.d.ts +1 -1
  96. package/dist/dtos/tags/delete-tag.dto.js +5 -3
  97. package/dist/dtos/tags/index.d.ts +0 -1
  98. package/dist/dtos/tags/index.js +0 -1
  99. package/dist/dtos/tags/update-tag.dto.d.ts +3 -3
  100. package/dist/dtos/tags/update-tag.dto.js +6 -5
  101. package/dist/dtos/translations/create-translation.dto.js +6 -1
  102. package/dist/dtos/translations/delete-translation.dto.d.ts +1 -1
  103. package/dist/dtos/translations/delete-translation.dto.js +4 -3
  104. package/dist/dtos/translations/update-translation.dto.d.ts +3 -3
  105. package/dist/dtos/translations/update-translation.dto.js +7 -4
  106. package/dist/enums/index.d.ts +0 -2
  107. package/dist/enums/index.js +0 -2
  108. package/dist/interfaces/orders/order-item.interface.d.ts +4 -4
  109. package/dist/interfaces/orders/order.interface.d.ts +9 -9
  110. package/dist/types/index.d.ts +1 -0
  111. package/dist/types/index.js +1 -0
  112. package/dist/types/order-mode.type.d.ts +12 -3
  113. package/dist/types/order-mode.type.js +20 -1
  114. package/dist/types/order-status.type.d.ts +22 -0
  115. package/dist/{enums/order-status.enum.d.ts → types/order-status.type.js} +25 -26
  116. package/package.json +1 -1
  117. package/dist/dtos/ingredients/search-by-name.dto.d.ts +0 -18
  118. package/dist/dtos/ingredients/search-by-name.dto.js +0 -33
  119. package/dist/dtos/products/submodules/product-tag/create-product-tag.dto.d.ts +0 -24
  120. package/dist/dtos/products/submodules/product-tag/create-product-tag.dto.js +0 -46
  121. package/dist/dtos/products/submodules/product-tag/find-product-tag.dto.d.ts +0 -24
  122. package/dist/dtos/products/submodules/product-tag/find-product-tag.dto.js +0 -46
  123. package/dist/dtos/questions/search-by-name.dto.d.ts +0 -18
  124. package/dist/dtos/questions/search-by-name.dto.js +0 -33
  125. package/dist/dtos/tags/search-by-name.dto.d.ts +0 -18
  126. package/dist/dtos/tags/search-by-name.dto.js +0 -33
  127. package/dist/enums/order-status.enum.js +0 -69
  128. package/dist/enums/order-type.enum.d.ts +0 -45
  129. package/dist/enums/order-type.enum.js +0 -46
@@ -8,65 +8,75 @@ var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
10
  import { Type } from 'class-transformer';
11
- import { IsArray, ArrayMinSize, ValidateNested, IsEnum, IsString, IsOptional, MinLength, IsMongoId, IsNotEmpty, IsDateString, } from 'class-validator';
11
+ import { IsArray, ArrayMinSize, ValidateNested, IsString, IsOptional, MinLength, IsMongoId, IsNotEmpty, IsDateString, IsIn, } from 'class-validator';
12
12
  import { OrderItemDto } from './order-item.dto.js';
13
- import { OrderType } from '../../enums/order-type.enum.js';
13
+ import { ORDER_MODES } from '../../types/order-mode.type.js';
14
14
  /**
15
- * DTO for creating a new order.
15
+ * Data Transfer Object for creating a new order in QeHay.
16
16
  *
17
- * Used by the Orders microservice to create new orders with items,
18
- * order type, and optional delivery/pickup information.
19
- * Validates the order structure and required fields based on order type.
17
+ * This DTO defines the structure, validation and documentation for the data needed to create a restaurant order.
18
+ * It supports all main QeHay order flows (DINE_IN, PICKUP, DELIVERY) and enforces minimum business rules at field level.
19
+ *
20
+ * Each property is validated and documented for clear API contracts and seamless integration with client apps.
20
21
  *
21
22
  * @since 2.0.0
22
23
  */
23
24
  export class CreateOrderDto {
24
25
  /**
25
- * Array of items in the order.
26
- * Must contain at least one item.
27
- * Each item is validated as an OrderItemDto.
26
+ * List of items included in the order.
27
+ * - Must contain at least one item.
28
+ * - Each element is validated as OrderItemDto.
28
29
  *
29
- * @example [{ productId: "...", quantity: 2, price: 19.98 }]
30
+ * @type {OrderItemDto[]}
31
+ * @example [{ "productId": "651cb9...", "quantity": 2, "price": 19.98 }]
30
32
  */
31
33
  items;
32
34
  /**
33
- * Type of order (DINE_IN, PICKUP, or DELIVERY).
34
- * Determines the fulfillment flow and required fields.
35
+ * Type of order (DINE_IN, PICKUP, DELIVERY).
36
+ * This determines the flow and required additional fields.
35
37
  *
36
- * @example OrderType.DELIVERY
38
+ * @type {OrderMode}
39
+ * @example "DELIVERY"
37
40
  */
38
41
  mode;
39
42
  /**
40
- * Optional table identifier for dine-in orders.
41
- * Must be at least 2 characters long if provided.
43
+ * Table identifier for dine-in orders.
44
+ * - Required for DINE_IN orders.
45
+ * - Ignored for PICKUP and DELIVERY.
46
+ * - Must be at least 2 characters if provided.
42
47
  *
48
+ * @type {string}
43
49
  * @example "Table 5"
44
50
  */
45
51
  tableId;
46
52
  /**
47
- * Optional delivery address for delivery orders.
53
+ * Delivery address, required when mode is DELIVERY.
48
54
  *
55
+ * @type {string}
49
56
  * @example "123 Main St, Downtown"
50
57
  */
51
58
  deliveryAddress;
52
59
  /**
53
- * Optional pickup time for pickup orders.
54
- * Must be a valid ISO date string if provided.
60
+ * Scheduled pickup time for pickup orders, as a valid ISO 8601 string.
61
+ * Only relevant for PICKUP mode.
55
62
  *
63
+ * @type {string}
56
64
  * @example "2024-01-15T18:30:00Z"
57
65
  */
58
66
  pickupTime;
59
67
  /**
60
- * Payment method identifier.
61
- * Required for orders that require payment before confirmation.
68
+ * Identifier of the payment method selected by the customer.
69
+ * - Required for orders requiring pre-payment (typically DELIVERY and PICKUP).
62
70
  *
71
+ * @type {string}
63
72
  * @example "payment-method-uuid-123"
64
73
  */
65
74
  paymentMethodId;
66
75
  /**
67
- * Optional user identifier who created the order.
68
- * Must be a valid MongoDB ObjectId if provided.
76
+ * User identifier (MongoDB ObjectId) of the customer who created the order.
77
+ * - Required. Used for user traceability and order ownership.
69
78
  *
79
+ * @type {string}
70
80
  * @example "507f1f77bcf86cd799439011"
71
81
  */
72
82
  userId;
@@ -79,33 +89,35 @@ __decorate([
79
89
  __metadata("design:type", Array)
80
90
  ], CreateOrderDto.prototype, "items", void 0);
81
91
  __decorate([
82
- IsEnum(OrderType, { message: 'Order type must be DINE_IN, PICKUP, or DELIVERY' }),
92
+ IsIn(ORDER_MODES, { message: 'Order type must be DINE_IN, PICKUP, or DELIVERY' }),
93
+ IsString({ message: 'Order mode must be a string' }),
94
+ IsNotEmpty({ message: 'Order mode is required' }),
83
95
  __metadata("design:type", String)
84
96
  ], CreateOrderDto.prototype, "mode", void 0);
85
97
  __decorate([
86
- IsString(),
87
- MinLength(2),
98
+ IsString({ message: 'tableId must be a string' }),
99
+ MinLength(2, { message: 'tableId must be at least 2 characters' }),
88
100
  IsOptional(),
89
101
  __metadata("design:type", String)
90
102
  ], CreateOrderDto.prototype, "tableId", void 0);
91
103
  __decorate([
92
- IsString(),
104
+ IsString({ message: 'Delivery address must be a string' }),
93
105
  IsOptional(),
94
106
  __metadata("design:type", String)
95
107
  ], CreateOrderDto.prototype, "deliveryAddress", void 0);
96
108
  __decorate([
97
- IsDateString(),
109
+ IsDateString({}, { message: 'pickupTime must be a valid ISO date string' }),
98
110
  IsOptional(),
99
111
  __metadata("design:type", String)
100
112
  ], CreateOrderDto.prototype, "pickupTime", void 0);
101
113
  __decorate([
102
- IsString(),
114
+ IsString({ message: 'paymentMethodId must be a string' }),
103
115
  IsNotEmpty({ message: 'Payment method ID is required' }),
104
116
  __metadata("design:type", String)
105
117
  ], CreateOrderDto.prototype, "paymentMethodId", void 0);
106
118
  __decorate([
107
- IsString(),
108
- IsMongoId(),
109
- IsOptional(),
119
+ IsString({ message: 'userId must be a string' }),
120
+ IsMongoId({ message: 'userId must be a valid MongoDB ObjectId' }),
121
+ IsNotEmpty({ message: 'userId is required' }),
110
122
  __metadata("design:type", String)
111
123
  ], CreateOrderDto.prototype, "userId", void 0);
@@ -1,65 +1,82 @@
1
1
  /**
2
- * DTO for order item information.
2
+ * Data Transfer Object representing a single item within an order.
3
3
  *
4
- * Represents a single item in an order with its product details,
5
- * size (if applicable), quantity, price, and optional notes or child items.
6
- * Supports nested items for complex order structures (e.g., combo meals).
4
+ * Used by QeHay to structure each item the customer wishes to order, including the product, quantity, pricing, variant size,
5
+ * optional notes, and possible nested (child) items such as combos.
7
6
  *
7
+ * All properties are validated and documented to ensure data integrity and improve maintainability.
8
+ *
9
+ * @class OrderItemDto
8
10
  * @since 2.0.0
9
11
  */
10
12
  export declare class OrderItemDto {
11
13
  /**
12
- * Unique identifier of the product.
13
- * Must be a valid UUID.
14
+ * Unique identifier for the product.
15
+ * Required.
16
+ * Must be a valid UUID v4.
14
17
  *
18
+ * @type {string}
15
19
  * @example "550e8400-e29b-41d4-a716-446655440000"
16
20
  */
17
21
  productId: string;
18
22
  /**
19
- * Optional unique identifier of the product size variant.
20
- * Must be a valid UUID if provided.
23
+ * Optional unique identifier for the product size (variant).
24
+ * Only set when the selected product has multiple sizes/variants.
25
+ * Must be a valid UUID v4 if provided.
21
26
  *
27
+ * @type {string}
22
28
  * @example "660e8400-e29b-41d4-a716-446655440001"
23
29
  */
24
30
  productSizeId?: string;
25
31
  /**
26
- * Optional name of the size variant.
32
+ * Optional name or label for the product size/variant.
33
+ * Useful for displaying selected size in the client.
27
34
  *
35
+ * @type {string}
28
36
  * @example "Large"
29
37
  */
30
38
  sizeName?: string;
31
39
  /**
32
- * Optional price for the size variant.
33
- * Must be a positive number if provided.
40
+ * Optional additional price for the selected size/variant.
41
+ * If specified, must be a positive number.
34
42
  *
43
+ * @type {number}
35
44
  * @example 12.99
36
45
  */
37
46
  sizePrice?: number;
38
47
  /**
39
- * Quantity of this item in the order.
40
- * Must be a positive number.
48
+ * Quantity of the ordered product (how many units the customer wants).
49
+ * Required.
50
+ * Must be a positive number (greater than zero).
41
51
  *
52
+ * @type {number}
42
53
  * @example 2
43
54
  */
44
55
  quantity: number;
45
56
  /**
46
- * Unit price for this item.
57
+ * Unit price for this item (for one product or one variant, without multiplying by quantity).
58
+ * Required.
47
59
  * Must be a positive number.
48
60
  *
61
+ * @type {number}
49
62
  * @example 9.99
50
63
  */
51
64
  price: number;
52
65
  /**
53
- * Optional notes or special instructions for this item.
66
+ * Optional notes or special instructions for this item (i.e. "No onions", "Add extra cheese").
67
+ * Useful for customizations or clarifications by the customer.
68
+ * Minimum length: 5 characters. Maximum: 200.
54
69
  *
70
+ * @type {string}
55
71
  * @example "No onions, extra cheese"
56
72
  */
57
73
  notes?: string;
58
74
  /**
59
- * Optional array of child items (for nested structures like combo meals).
60
- * Each child item is validated as an OrderItemDto.
75
+ * Optional array of nested child items (for combos, extras, etc).
76
+ * Each child item must also be a valid OrderItemDto instance, supporting recursive order nesting.
61
77
  *
62
- * @example [{ productId: "...", quantity: 1, price: 5.99 }]
78
+ * @type {OrderItemDto[]}
79
+ * @example [{ "productId": "...", "quantity": 1, "price": 5.99 }]
63
80
  */
64
81
  childItems?: OrderItemDto[];
65
82
  }
@@ -8,111 +8,133 @@ var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
10
  import { Type } from 'class-transformer';
11
- import { IsArray, IsNumber, IsOptional, IsPositive, IsString, IsUUID, ValidateNested, } from 'class-validator';
11
+ import { IsArray, IsNotEmpty, IsNumber, IsOptional, IsPositive, IsString, IsUUID, MaxLength, MinLength, ValidateNested, } from 'class-validator';
12
12
  /**
13
- * DTO for order item information.
13
+ * Data Transfer Object representing a single item within an order.
14
14
  *
15
- * Represents a single item in an order with its product details,
16
- * size (if applicable), quantity, price, and optional notes or child items.
17
- * Supports nested items for complex order structures (e.g., combo meals).
15
+ * Used by QeHay to structure each item the customer wishes to order, including the product, quantity, pricing, variant size,
16
+ * optional notes, and possible nested (child) items such as combos.
18
17
  *
18
+ * All properties are validated and documented to ensure data integrity and improve maintainability.
19
+ *
20
+ * @class OrderItemDto
19
21
  * @since 2.0.0
20
22
  */
21
23
  export class OrderItemDto {
22
24
  /**
23
- * Unique identifier of the product.
24
- * Must be a valid UUID.
25
+ * Unique identifier for the product.
26
+ * Required.
27
+ * Must be a valid UUID v4.
25
28
  *
29
+ * @type {string}
26
30
  * @example "550e8400-e29b-41d4-a716-446655440000"
27
31
  */
28
32
  productId;
29
33
  /**
30
- * Optional unique identifier of the product size variant.
31
- * Must be a valid UUID if provided.
34
+ * Optional unique identifier for the product size (variant).
35
+ * Only set when the selected product has multiple sizes/variants.
36
+ * Must be a valid UUID v4 if provided.
32
37
  *
38
+ * @type {string}
33
39
  * @example "660e8400-e29b-41d4-a716-446655440001"
34
40
  */
35
41
  productSizeId;
36
42
  /**
37
- * Optional name of the size variant.
43
+ * Optional name or label for the product size/variant.
44
+ * Useful for displaying selected size in the client.
38
45
  *
46
+ * @type {string}
39
47
  * @example "Large"
40
48
  */
41
49
  sizeName;
42
50
  /**
43
- * Optional price for the size variant.
44
- * Must be a positive number if provided.
51
+ * Optional additional price for the selected size/variant.
52
+ * If specified, must be a positive number.
45
53
  *
54
+ * @type {number}
46
55
  * @example 12.99
47
56
  */
48
57
  sizePrice;
49
58
  /**
50
- * Quantity of this item in the order.
51
- * Must be a positive number.
59
+ * Quantity of the ordered product (how many units the customer wants).
60
+ * Required.
61
+ * Must be a positive number (greater than zero).
52
62
  *
63
+ * @type {number}
53
64
  * @example 2
54
65
  */
55
66
  quantity;
56
67
  /**
57
- * Unit price for this item.
68
+ * Unit price for this item (for one product or one variant, without multiplying by quantity).
69
+ * Required.
58
70
  * Must be a positive number.
59
71
  *
72
+ * @type {number}
60
73
  * @example 9.99
61
74
  */
62
75
  price;
63
76
  /**
64
- * Optional notes or special instructions for this item.
77
+ * Optional notes or special instructions for this item (i.e. "No onions", "Add extra cheese").
78
+ * Useful for customizations or clarifications by the customer.
79
+ * Minimum length: 5 characters. Maximum: 200.
65
80
  *
81
+ * @type {string}
66
82
  * @example "No onions, extra cheese"
67
83
  */
68
84
  notes;
69
85
  /**
70
- * Optional array of child items (for nested structures like combo meals).
71
- * Each child item is validated as an OrderItemDto.
86
+ * Optional array of nested child items (for combos, extras, etc).
87
+ * Each child item must also be a valid OrderItemDto instance, supporting recursive order nesting.
72
88
  *
73
- * @example [{ productId: "...", quantity: 1, price: 5.99 }]
89
+ * @type {OrderItemDto[]}
90
+ * @example [{ "productId": "...", "quantity": 1, "price": 5.99 }]
74
91
  */
75
92
  childItems;
76
93
  }
77
94
  __decorate([
78
- IsString(),
79
- IsUUID(),
95
+ IsString({ message: "productId must be a string" }),
96
+ IsUUID('4', { message: "productId must be a valid UUID v4" }),
97
+ IsNotEmpty({ message: "productId is required" }),
80
98
  __metadata("design:type", String)
81
99
  ], OrderItemDto.prototype, "productId", void 0);
82
100
  __decorate([
83
- IsString(),
101
+ IsString({ message: "productSizeId must be a string" }),
84
102
  IsOptional(),
85
- IsUUID(),
103
+ IsUUID('4', { message: "productSizeId must be a valid UUID v4" }),
86
104
  __metadata("design:type", String)
87
105
  ], OrderItemDto.prototype, "productSizeId", void 0);
88
106
  __decorate([
89
- IsString(),
107
+ IsString({ message: "sizeName must be a string" }),
90
108
  IsOptional(),
91
109
  __metadata("design:type", String)
92
110
  ], OrderItemDto.prototype, "sizeName", void 0);
93
111
  __decorate([
94
- IsNumber(),
112
+ IsNumber({}, { message: "sizePrice must be a number" }),
95
113
  IsOptional(),
96
- IsPositive(),
114
+ IsPositive({ message: "sizePrice must be a positive number" }),
97
115
  __metadata("design:type", Number)
98
116
  ], OrderItemDto.prototype, "sizePrice", void 0);
99
117
  __decorate([
100
- IsNumber(),
101
- IsPositive(),
118
+ IsNumber({}, { message: "quantity must be a number" }),
119
+ IsPositive({ message: "quantity must be a positive number" }),
120
+ IsNotEmpty({ message: "quantity is required" }),
102
121
  __metadata("design:type", Number)
103
122
  ], OrderItemDto.prototype, "quantity", void 0);
104
123
  __decorate([
105
- IsNumber(),
106
- IsPositive(),
124
+ IsNumber({}, { message: "price must be a number" }),
125
+ IsPositive({ message: "price must be a positive number" }),
126
+ IsNotEmpty({ message: "price is required" }),
107
127
  __metadata("design:type", Number)
108
128
  ], OrderItemDto.prototype, "price", void 0);
109
129
  __decorate([
110
- IsString(),
130
+ IsString({ message: "notes must be a string" }),
111
131
  IsOptional(),
132
+ MinLength(5, { message: "notes must be at least 5 characters" }),
133
+ MaxLength(200, { message: "notes must be at most 200 characters" }),
112
134
  __metadata("design:type", String)
113
135
  ], OrderItemDto.prototype, "notes", void 0);
114
136
  __decorate([
115
- IsArray(),
137
+ IsArray({ message: "childItems must be an array" }),
116
138
  IsOptional(),
117
139
  ValidateNested({ each: true }),
118
140
  Type(() => OrderItemDto),
@@ -1,5 +1,5 @@
1
- import { OrderStatus } from '../../enums/order-status.enum.js';
2
1
  import { PaginationDto } from '../common/pagination.dto.js';
2
+ import type { OrderStatus } from '../../types/order-status.type.js';
3
3
  /**
4
4
  * DTO for paginated order queries with optional status filter.
5
5
  *
@@ -7,9 +7,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { IsEnum, IsOptional } from 'class-validator';
11
- import { OrderStatus } from '../../enums/order-status.enum.js';
10
+ import { IsIn, IsOptional } from 'class-validator';
12
11
  import { PaginationDto } from '../common/pagination.dto.js';
12
+ import { ORDER_STATUS } from '../../types/order-status.type.js';
13
13
  /**
14
14
  * DTO for paginated order queries with optional status filter.
15
15
  *
@@ -29,6 +29,6 @@ export class OrderPaginationDto extends PaginationDto {
29
29
  }
30
30
  __decorate([
31
31
  IsOptional(),
32
- IsEnum(OrderStatus, { message: 'Status must be a valid order status' }),
32
+ IsIn(ORDER_STATUS, { message: 'Status must be a valid order status' }),
33
33
  __metadata("design:type", String)
34
34
  ], OrderPaginationDto.prototype, "status", void 0);
@@ -1,29 +1,37 @@
1
1
  /**
2
- * DTO for paid order information.
2
+ * Data Transfer Object for paid order information in QeHay.
3
3
  *
4
- * Represents order payment confirmation data after a successful payment.
5
- * Used by the Orders microservice to update order payment status.
4
+ * This DTO is used to communicate the result of a successful payment for an order.
5
+ * It encapsulates all data needed to mark an order as paid and link it to the relevant payment evidence.
6
+ * Used by the Orders microservice (and related systems) to update order payment status and retain payment tracing information.
6
7
  *
8
+ * Each property is validated and clearly documented to guarantee interoperability and support audits.
9
+ *
10
+ * @class PaidOrderDto
7
11
  * @since 2.0.0
8
12
  */
9
13
  export declare class PaidOrderDto {
10
14
  /**
11
- * Payment charge identifier from the payment provider.
15
+ * Payment charge identifier provided by the payment gateway or provider.
16
+ * This value links the QeHay order to the payment platform transaction.
12
17
  *
18
+ * @type {string}
13
19
  * @example "ch_1234567890abcdef"
14
20
  */
15
21
  paymentChargeId: string;
16
22
  /**
17
- * Unique identifier of the paid order.
18
- * Must be a valid UUID.
23
+ * Unique identifier (UUID v4) of the paid order within QeHay.
24
+ * Used to reference and update the order entity.
19
25
  *
26
+ * @type {string}
20
27
  * @example "550e8400-e29b-41d4-a716-446655440000"
21
28
  */
22
29
  orderId: string;
23
30
  /**
24
- * URL to the payment receipt.
25
- * Must be a valid URL format.
31
+ * Direct URL of the payment receipt generated by the payment platform.
32
+ * This allows for audit, download, or viewing of payment proof by users or admins.
26
33
  *
34
+ * @type {string}
27
35
  * @example "https://payments.example.com/receipts/receipt_123456"
28
36
  */
29
37
  receiptUrl: string;
@@ -7,48 +7,59 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { IsString, IsUrl, IsUUID } from 'class-validator';
10
+ import { IsNotEmpty, IsString, IsUrl, IsUUID } from "class-validator";
11
11
  /**
12
- * DTO for paid order information.
12
+ * Data Transfer Object for paid order information in QeHay.
13
13
  *
14
- * Represents order payment confirmation data after a successful payment.
15
- * Used by the Orders microservice to update order payment status.
14
+ * This DTO is used to communicate the result of a successful payment for an order.
15
+ * It encapsulates all data needed to mark an order as paid and link it to the relevant payment evidence.
16
+ * Used by the Orders microservice (and related systems) to update order payment status and retain payment tracing information.
16
17
  *
18
+ * Each property is validated and clearly documented to guarantee interoperability and support audits.
19
+ *
20
+ * @class PaidOrderDto
17
21
  * @since 2.0.0
18
22
  */
19
23
  export class PaidOrderDto {
20
24
  /**
21
- * Payment charge identifier from the payment provider.
25
+ * Payment charge identifier provided by the payment gateway or provider.
26
+ * This value links the QeHay order to the payment platform transaction.
22
27
  *
28
+ * @type {string}
23
29
  * @example "ch_1234567890abcdef"
24
30
  */
25
31
  paymentChargeId;
26
32
  /**
27
- * Unique identifier of the paid order.
28
- * Must be a valid UUID.
33
+ * Unique identifier (UUID v4) of the paid order within QeHay.
34
+ * Used to reference and update the order entity.
29
35
  *
36
+ * @type {string}
30
37
  * @example "550e8400-e29b-41d4-a716-446655440000"
31
38
  */
32
39
  orderId;
33
40
  /**
34
- * URL to the payment receipt.
35
- * Must be a valid URL format.
41
+ * Direct URL of the payment receipt generated by the payment platform.
42
+ * This allows for audit, download, or viewing of payment proof by users or admins.
36
43
  *
44
+ * @type {string}
37
45
  * @example "https://payments.example.com/receipts/receipt_123456"
38
46
  */
39
47
  receiptUrl;
40
48
  }
41
49
  __decorate([
42
- IsString(),
50
+ IsString({ message: "paymentChargeId must be a string" }),
51
+ IsNotEmpty({ message: "paymentChargeId is required" }),
43
52
  __metadata("design:type", String)
44
53
  ], PaidOrderDto.prototype, "paymentChargeId", void 0);
45
54
  __decorate([
46
- IsString(),
47
- IsUUID(),
55
+ IsString({ message: "orderId must be a string" }),
56
+ IsUUID("4", { message: "orderId must be a valid UUID v4" }),
57
+ IsNotEmpty({ message: "orderId is required" }),
48
58
  __metadata("design:type", String)
49
59
  ], PaidOrderDto.prototype, "orderId", void 0);
50
60
  __decorate([
51
- IsString(),
52
- IsUrl(),
61
+ IsString({ message: "receiptUrl must be a string" }),
62
+ IsUrl({}, { message: "receiptUrl must be a valid URL" }),
63
+ IsNotEmpty({ message: "receiptUrl is required" }),
53
64
  __metadata("design:type", String)
54
65
  ], PaidOrderDto.prototype, "receiptUrl", void 0);
@@ -0,0 +1,81 @@
1
+ export declare class CreatePaymentAuditDynamoDto {
2
+ /**
3
+ * Unique identifier for the audited transaction.
4
+ * Should be globally unique per transaction.
5
+ *
6
+ * @example "txn_123abc456"
7
+ */
8
+ transactionId: string;
9
+ /**
10
+ * ISO 8601 timestamp indicating when the payment event occurred.
11
+ *
12
+ * @example "2024-06-01T12:00:00.000Z"
13
+ */
14
+ timestamp: string;
15
+ /**
16
+ * Unique identifier of the related order.
17
+ *
18
+ * @example "order_789xyz"
19
+ */
20
+ orderId: string;
21
+ /**
22
+ * Name of the payment provider (e.g., "stripe", "culqi").
23
+ *
24
+ * @example "stripe"
25
+ */
26
+ provider: string;
27
+ /**
28
+ * Name or path of the API endpoint called (e.g., "/charges").
29
+ *
30
+ * @example "/charges"
31
+ */
32
+ endpoint: string;
33
+ /**
34
+ * HTTP method used for the audited request.
35
+ *
36
+ * @example "POST"
37
+ */
38
+ method: string;
39
+ /**
40
+ * HTTP response status code from the provider (e.g., 200, 500).
41
+ *
42
+ * @example 200
43
+ */
44
+ statusCode: number;
45
+ /**
46
+ * Status of the operation/audit (e.g., "success", "error").
47
+ *
48
+ * @example "success"
49
+ */
50
+ status: string;
51
+ /**
52
+ * Processing time for the audited action, in milliseconds.
53
+ *
54
+ * @example 845
55
+ */
56
+ durationMs: number;
57
+ /**
58
+ * (Optional) IP address from which the request originated.
59
+ *
60
+ * @example "192.168.0.1"
61
+ */
62
+ ipAddress?: string;
63
+ /**
64
+ * URL of the external log or audit file, if available (e.g., S3 presigned url).
65
+ *
66
+ * @example "https://s3.amazonaws.com/bucket/audit/txn_123.json"
67
+ */
68
+ logUrl: string;
69
+ /**
70
+ * ISO 8601 timestamp indicating when the audit record was created.
71
+ *
72
+ * @example "2024-06-01T12:01:00.000Z"
73
+ */
74
+ createdAt: string;
75
+ /**
76
+ * ISO 8601 timestamp indicating the last update to the audit record.
77
+ *
78
+ * @example "2024-06-01T12:05:30.000Z"
79
+ */
80
+ updatedAt: string;
81
+ }