qeai-sdk 2.0.1 → 2.0.3

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 (148) 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 +14 -16
  8. package/dist/dtos/chain/create-chain.dto.js +24 -22
  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 +30 -20
  12. package/dist/dtos/chain/update-chain.dto.js +39 -26
  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 +2 -2
  44. package/dist/dtos/products/create-product.dto.js +12 -9
  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 +5 -5
  78. package/dist/dtos/products/update-product.dto.js +10 -7
  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 -4
  107. package/dist/enums/index.js +0 -4
  108. package/dist/interfaces/auth/account.interface.d.ts +4 -4
  109. package/dist/interfaces/auth/user.interface.d.ts +1 -1
  110. package/dist/interfaces/categories/category.interface.d.ts +5 -5
  111. package/dist/interfaces/chains/chain.interface.d.ts +2 -2
  112. package/dist/interfaces/ingredients/ingredient.interface.d.ts +4 -4
  113. package/dist/interfaces/orders/order-item.interface.d.ts +4 -4
  114. package/dist/interfaces/orders/order.interface.d.ts +9 -9
  115. package/dist/interfaces/products/product.interface.d.ts +11 -8
  116. package/dist/interfaces/products/response/sub-resources/create-tag-response.interface.d.ts +1 -1
  117. package/dist/interfaces/products/response/sub-resources/recipe-relationship.interface.d.ts +0 -2
  118. package/dist/interfaces/questions/question.interface.d.ts +8 -6
  119. package/dist/interfaces/restaurants/restaurant.interface.d.ts +7 -7
  120. package/dist/interfaces/translations/translation.interface.d.ts +4 -4
  121. package/dist/types/currency.type.d.ts +26 -0
  122. package/dist/types/currency.type.js +18 -0
  123. package/dist/types/index.d.ts +3 -0
  124. package/dist/types/index.js +3 -0
  125. package/dist/types/order-mode.type.d.ts +12 -3
  126. package/dist/types/order-mode.type.js +16 -1
  127. package/dist/types/order-status.type.d.ts +22 -0
  128. package/dist/{enums/order-status.enum.d.ts → types/order-status.type.js} +25 -26
  129. package/dist/types/product-status.type.d.ts +25 -0
  130. package/dist/types/product-status.type.js +17 -0
  131. package/package.json +1 -1
  132. package/dist/dtos/ingredients/search-by-name.dto.d.ts +0 -18
  133. package/dist/dtos/ingredients/search-by-name.dto.js +0 -33
  134. package/dist/dtos/products/submodules/product-tag/create-product-tag.dto.d.ts +0 -24
  135. package/dist/dtos/products/submodules/product-tag/create-product-tag.dto.js +0 -46
  136. package/dist/dtos/products/submodules/product-tag/find-product-tag.dto.d.ts +0 -24
  137. package/dist/dtos/products/submodules/product-tag/find-product-tag.dto.js +0 -46
  138. package/dist/dtos/questions/search-by-name.dto.d.ts +0 -18
  139. package/dist/dtos/questions/search-by-name.dto.js +0 -33
  140. package/dist/dtos/tags/search-by-name.dto.d.ts +0 -18
  141. package/dist/dtos/tags/search-by-name.dto.js +0 -33
  142. package/dist/enums/currency.enum.d.ts +0 -21
  143. package/dist/enums/currency.enum.js +0 -22
  144. package/dist/enums/order-status.enum.js +0 -69
  145. package/dist/enums/order-type.enum.d.ts +0 -45
  146. package/dist/enums/order-type.enum.js +0 -46
  147. package/dist/enums/product-status.enum.d.ts +0 -55
  148. package/dist/enums/product-status.enum.js +0 -56
@@ -7,65 +7,76 @@ 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, IsOptional, IsMongoId, IsUUID, IsNumber, Max, Min, IsEnum, } from "class-validator";
11
- import { Currency } from "../../enums/currency.enum.js";
10
+ import { IsString, IsOptional, IsMongoId, IsUUID, IsNumber, Max, Min, MinLength, IsNotEmpty, IsIn, } from "class-validator";
11
+ import { CURRENCIES } from "../../types/currency.type.js";
12
12
  /**
13
13
  * DTO for updating an existing chain.
14
14
  *
15
- * Extends CreateChainDto with all fields optional.
16
- * Used by the Products microservice to update chain details.
15
+ * Provides structure and validation for payloads to update a chain (restaurant brand)
16
+ * in the system. All fields related to chain details are optional to allow partial updates,
17
+ * but identifiers (chainId, updatedBy) are required for correct auditing and entity targeting.
18
+ *
19
+ * Used by the Products microservice to apply modifications to the properties of an existing chain.
17
20
  *
18
21
  * @since 2.0.0
22
+ *
23
+ * @example
24
+ * {
25
+ * "chainId": "550e8400-e29b-41d4-a716-446655440000",
26
+ * "name": "McDonald's",
27
+ * "currency": "PEN",
28
+ * "taxPercent": 8.5,
29
+ * "updatedBy": "507f1f77bcf86cd799439011"
30
+ * }
19
31
  */
20
32
  export class UpdateChainDto {
21
33
  /**
22
- * Chain name.
23
- * Must not be empty.
34
+ * The name of the chain (brand).
35
+ * Optional. If provided, must have at least 3 characters.
24
36
  *
25
37
  * @example "McDonald's"
26
38
  */
27
39
  name;
28
40
  /**
29
- * Chain currency code.
30
- * Must be a valid Currency enum value.
31
- * Defaults to PEN if not provided.
41
+ * The currency code for the chain.
42
+ * Optional. If provided, must be one of the supported currency codes (see CurrencyCode type).
32
43
  *
33
- * @example Currency.PEN
34
- * @default Currency.PEN
44
+ * @example "PEN"
45
+ * @default "PEN"
35
46
  */
36
- currency = Currency.PEN;
47
+ currency = "PEN";
37
48
  /**
38
- * Global tax percentage for the chain.
39
- * Must be between 0 and 100 if provided.
40
- * Defaults to 0 if not provided.
49
+ * Global tax percentage applied across the chain.
50
+ * Optional. Must be a number between 0 and 100 if provided.
41
51
  *
42
52
  * @example 8.5
43
53
  * @default 0.0
44
54
  */
45
55
  taxPercent = 0.0;
46
56
  /**
47
- * Chain ID to update.
48
- * Must be a valid UUID.
57
+ * Unique identifier of the chain to update.
58
+ * Required. Must be a valid UUID string.
49
59
  *
50
60
  * @example "550e8400-e29b-41d4-a716-446655440000"
51
61
  */
52
- id;
62
+ chainId;
53
63
  /**
54
- * User who updated the chain.
55
- * Must be a valid MongoDB ObjectId if provided.
64
+ * Unique identifier of the user performing the update.
65
+ * Required. Must be a valid MongoDB ObjectId.
56
66
  *
57
67
  * @example "507f1f77bcf86cd799439011"
58
68
  */
59
69
  updatedBy;
60
70
  }
61
71
  __decorate([
62
- IsString(),
63
72
  IsOptional(),
73
+ IsString(),
74
+ MinLength(3, { message: "Chain name must be at least 3 characters" }),
64
75
  __metadata("design:type", String)
65
76
  ], UpdateChainDto.prototype, "name", void 0);
66
77
  __decorate([
67
78
  IsOptional(),
68
- IsEnum(Currency, { message: "Currency must be a valid currency code" }),
79
+ IsIn(CURRENCIES, { message: "Currency must be a valid currency code" }),
69
80
  __metadata("design:type", String)
70
81
  ], UpdateChainDto.prototype, "currency", void 0);
71
82
  __decorate([
@@ -78,12 +89,14 @@ __decorate([
78
89
  __decorate([
79
90
  IsString(),
80
91
  IsUUID(),
81
- IsOptional(),
92
+ IsNotEmpty({ message: "chainId is required and must be a valid UUID." }),
82
93
  __metadata("design:type", String)
83
- ], UpdateChainDto.prototype, "id", void 0);
94
+ ], UpdateChainDto.prototype, "chainId", void 0);
84
95
  __decorate([
85
96
  IsString(),
86
- IsMongoId(),
87
- IsOptional(),
97
+ IsMongoId({ message: "updatedBy must be a valid MongoDB ObjectId." }),
98
+ IsNotEmpty({
99
+ message: "updatedBy is required and must be a valid MongoDB ObjectId.",
100
+ }),
88
101
  __metadata("design:type", String)
89
102
  ], UpdateChainDto.prototype, "updatedBy", void 0);
@@ -1,4 +1,27 @@
1
1
  import { PaginationDto } from './pagination.dto.js';
2
+ /**
3
+ * DTO for searching entities by name.
4
+ *
5
+ * This class extends PaginationDto and is designed to be used as a base
6
+ * DTO for search operations where a search by text (typically a name)
7
+ * is required. It is used across multiple modules to standardize
8
+ * search-by-name functionality and provide pagination support.
9
+ *
10
+ * @example
11
+ * {
12
+ * "name": "cheese",
13
+ * "page": 1,
14
+ * "limit": 10
15
+ * }
16
+ *
17
+ * @since 2.0.0
18
+ */
2
19
  export declare class SearchByNameDto extends PaginationDto {
20
+ /**
21
+ * The search term for the entity name.
22
+ * Must be a non-empty string.
23
+ *
24
+ * @example "vegetarian"
25
+ */
3
26
  name: string;
4
27
  }
@@ -9,11 +9,34 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  };
10
10
  import { IsNotEmpty, IsString } from 'class-validator';
11
11
  import { PaginationDto } from './pagination.dto.js';
12
+ /**
13
+ * DTO for searching entities by name.
14
+ *
15
+ * This class extends PaginationDto and is designed to be used as a base
16
+ * DTO for search operations where a search by text (typically a name)
17
+ * is required. It is used across multiple modules to standardize
18
+ * search-by-name functionality and provide pagination support.
19
+ *
20
+ * @example
21
+ * {
22
+ * "name": "cheese",
23
+ * "page": 1,
24
+ * "limit": 10
25
+ * }
26
+ *
27
+ * @since 2.0.0
28
+ */
12
29
  export class SearchByNameDto extends PaginationDto {
30
+ /**
31
+ * The search term for the entity name.
32
+ * Must be a non-empty string.
33
+ *
34
+ * @example "vegetarian"
35
+ */
13
36
  name;
14
37
  }
15
38
  __decorate([
16
39
  IsString(),
17
- IsNotEmpty(),
40
+ IsNotEmpty({ message: 'Search term is required' }),
18
41
  __metadata("design:type", String)
19
42
  ], SearchByNameDto.prototype, "name", void 0);
@@ -2,27 +2,27 @@
2
2
  * DTO for creating a new ingredient.
3
3
  *
4
4
  * Used by the Products microservice to create new ingredients.
5
- * Ingredients are used in recipes and inventory management.
5
+ * Ingredients are utilized in recipes and inventory management.
6
6
  *
7
7
  * @since 2.0.0
8
8
  */
9
9
  export declare class CreateIngredientDto {
10
10
  /**
11
- * Name of the ingredient.
12
- * Must not be empty and maximum length of 100 characters.
11
+ * Ingredient name.
12
+ * Must not be empty and must have a maximum length of 25 characters.
13
13
  *
14
14
  * @example "Tomato"
15
15
  */
16
16
  name: string;
17
17
  /**
18
18
  * Unit of measurement for the ingredient.
19
- * Must not be empty and maximum length of 20 characters.
19
+ * Must not be empty and must have a maximum length of 12 characters.
20
20
  *
21
21
  * @example "kg"
22
22
  */
23
23
  unit: string;
24
24
  /**
25
- * User who created the ingredient.
25
+ * User ID of the user who created the ingredient.
26
26
  * Must be a valid MongoDB ObjectId.
27
27
  *
28
28
  * @example "507f1f77bcf86cd799439011"
@@ -12,27 +12,27 @@ import { IsString, IsNotEmpty, MaxLength, IsMongoId } from 'class-validator';
12
12
  * DTO for creating a new ingredient.
13
13
  *
14
14
  * Used by the Products microservice to create new ingredients.
15
- * Ingredients are used in recipes and inventory management.
15
+ * Ingredients are utilized in recipes and inventory management.
16
16
  *
17
17
  * @since 2.0.0
18
18
  */
19
19
  export class CreateIngredientDto {
20
20
  /**
21
- * Name of the ingredient.
22
- * Must not be empty and maximum length of 100 characters.
21
+ * Ingredient name.
22
+ * Must not be empty and must have a maximum length of 25 characters.
23
23
  *
24
24
  * @example "Tomato"
25
25
  */
26
26
  name;
27
27
  /**
28
28
  * Unit of measurement for the ingredient.
29
- * Must not be empty and maximum length of 20 characters.
29
+ * Must not be empty and must have a maximum length of 12 characters.
30
30
  *
31
31
  * @example "kg"
32
32
  */
33
33
  unit;
34
34
  /**
35
- * User who created the ingredient.
35
+ * User ID of the user who created the ingredient.
36
36
  * Must be a valid MongoDB ObjectId.
37
37
  *
38
38
  * @example "507f1f77bcf86cd799439011"
@@ -42,17 +42,18 @@ export class CreateIngredientDto {
42
42
  __decorate([
43
43
  IsString(),
44
44
  IsNotEmpty({ message: 'Ingredient name is required' }),
45
- MaxLength(100, { message: 'Ingredient name must be at most 100 characters' }),
45
+ MaxLength(25, { message: 'Ingredient name must be at most 25 characters' }),
46
46
  __metadata("design:type", String)
47
47
  ], CreateIngredientDto.prototype, "name", void 0);
48
48
  __decorate([
49
49
  IsString(),
50
50
  IsNotEmpty({ message: 'Unit is required' }),
51
- MaxLength(20, { message: 'Unit must be at most 20 characters' }),
51
+ MaxLength(12, { message: 'Unit must be at most 12 characters' }),
52
52
  __metadata("design:type", String)
53
53
  ], CreateIngredientDto.prototype, "unit", void 0);
54
54
  __decorate([
55
55
  IsString(),
56
- IsMongoId(),
56
+ IsMongoId({ message: 'createdBy must be a valid MongoDB ObjectId' }),
57
+ IsNotEmpty({ message: 'createdBy is required and must be a valid MongoDB ObjectId' }),
57
58
  __metadata("design:type", String)
58
59
  ], CreateIngredientDto.prototype, "createdBy", void 0);
@@ -1,22 +1,29 @@
1
1
  /**
2
2
  * DTO for deleting an ingredient.
3
3
  *
4
- * Used by the Products microservice to soft-delete ingredients.
5
- * Includes ingredient ID and user who performed the deletion.
4
+ * Provides structure and validation for requests to soft-delete ingredients
5
+ * in the system. Used by the Products microservice to safely remove ingredient records.
6
+ * Captures which ingredient is being deleted and which user performs the operation for audit purposes.
6
7
  *
7
8
  * @since 2.0.0
9
+ *
10
+ * @example
11
+ * {
12
+ * "ingredientId": "550e8400-e29b-41d4-a716-446655440000",
13
+ * "deletedBy": "507f1f77bcf86cd799439011"
14
+ * }
8
15
  */
9
16
  export declare class DeleteIngredientDto {
10
17
  /**
11
- * Ingredient ID to delete.
12
- * Must be a valid UUID.
18
+ * Unique identifier of the ingredient to delete.
19
+ * Required. Must be a valid UUID string.
13
20
  *
14
21
  * @example "550e8400-e29b-41d4-a716-446655440000"
15
22
  */
16
- id: string;
23
+ ingredientId: string;
17
24
  /**
18
- * User who deleted the ingredient.
19
- * Must be a valid MongoDB ObjectId.
25
+ * Unique identifier of the user performing the deletion.
26
+ * Required. Must be a valid MongoDB ObjectId.
20
27
  *
21
28
  * @example "507f1f77bcf86cd799439011"
22
29
  */
@@ -7,37 +7,46 @@ 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, IsMongoId, IsUUID } from 'class-validator';
10
+ import { IsString, IsMongoId, IsUUID, IsNotEmpty } from 'class-validator';
11
11
  /**
12
12
  * DTO for deleting an ingredient.
13
13
  *
14
- * Used by the Products microservice to soft-delete ingredients.
15
- * Includes ingredient ID and user who performed the deletion.
14
+ * Provides structure and validation for requests to soft-delete ingredients
15
+ * in the system. Used by the Products microservice to safely remove ingredient records.
16
+ * Captures which ingredient is being deleted and which user performs the operation for audit purposes.
16
17
  *
17
18
  * @since 2.0.0
19
+ *
20
+ * @example
21
+ * {
22
+ * "ingredientId": "550e8400-e29b-41d4-a716-446655440000",
23
+ * "deletedBy": "507f1f77bcf86cd799439011"
24
+ * }
18
25
  */
19
26
  export class DeleteIngredientDto {
20
27
  /**
21
- * Ingredient ID to delete.
22
- * Must be a valid UUID.
28
+ * Unique identifier of the ingredient to delete.
29
+ * Required. Must be a valid UUID string.
23
30
  *
24
31
  * @example "550e8400-e29b-41d4-a716-446655440000"
25
32
  */
26
- id;
33
+ ingredientId;
27
34
  /**
28
- * User who deleted the ingredient.
29
- * Must be a valid MongoDB ObjectId.
35
+ * Unique identifier of the user performing the deletion.
36
+ * Required. Must be a valid MongoDB ObjectId.
30
37
  *
31
38
  * @example "507f1f77bcf86cd799439011"
32
39
  */
33
40
  deletedBy;
34
41
  }
35
42
  __decorate([
43
+ IsNotEmpty({ message: 'ingredientId is required and must be a valid UUID.' }),
36
44
  IsString(),
37
45
  IsUUID(),
38
46
  __metadata("design:type", String)
39
- ], DeleteIngredientDto.prototype, "id", void 0);
47
+ ], DeleteIngredientDto.prototype, "ingredientId", void 0);
40
48
  __decorate([
49
+ IsNotEmpty({ message: 'deletedBy is required and must be a valid MongoDB ObjectId.' }),
41
50
  IsString(),
42
51
  IsMongoId(),
43
52
  __metadata("design:type", String)
@@ -9,4 +9,3 @@
9
9
  export * from './create-ingredient.dto.js';
10
10
  export * from './update-ingredient.dto.js';
11
11
  export * from './delete-ingredient.dto.js';
12
- export * from './search-by-name.dto.js';
@@ -9,4 +9,3 @@
9
9
  export * from './create-ingredient.dto.js';
10
10
  export * from './update-ingredient.dto.js';
11
11
  export * from './delete-ingredient.dto.js';
12
- export * from './search-by-name.dto.js';
@@ -1,38 +1,47 @@
1
1
  /**
2
2
  * DTO for updating an existing ingredient.
3
3
  *
4
- * Extends CreateIngredientDto with all fields optional.
5
- * Used by the Products microservice to update ingredient details.
4
+ * Provides structure and validation for payloads to update ingredient data within the system.
5
+ * Permits partial updates: only the provided fields will be updated.
6
+ * Used by the Products microservice to modify ingredient details.
6
7
  *
7
8
  * @since 2.0.0
9
+ *
10
+ * @example
11
+ * {
12
+ * "ingredientId": "550e8400-e29b-41d4-a716-446655440000",
13
+ * "name": "Tomato",
14
+ * "unit": "kg",
15
+ * "updatedBy": "507f1f77bcf86cd799439011"
16
+ * }
8
17
  */
9
18
  export declare class UpdateIngredientDto {
10
19
  /**
11
- * Name of the ingredient.
12
- * Must not be empty and maximum length of 100 characters.
20
+ * Ingredient name.
21
+ * Optional. If provided, must be a string with a maximum length of 25 characters.
13
22
  *
14
23
  * @example "Tomato"
15
24
  */
16
25
  name?: string;
17
26
  /**
18
27
  * Unit of measurement for the ingredient.
19
- * Must not be empty and maximum length of 20 characters.
28
+ * Optional. If provided, must be a string with a maximum length of 12 characters.
20
29
  *
21
30
  * @example "kg"
22
31
  */
23
32
  unit?: string;
24
33
  /**
25
- * Ingredient ID to update.
26
- * Must be a valid UUID.
34
+ * Unique identifier of the ingredient to update.
35
+ * Required. Must be a valid UUID string.
27
36
  *
28
37
  * @example "550e8400-e29b-41d4-a716-446655440000"
29
38
  */
30
- id?: string;
39
+ ingredientId: string;
31
40
  /**
32
- * User who updated the ingredient.
33
- * Must be a valid MongoDB ObjectId if provided.
41
+ * Unique identifier of the user performing the update.
42
+ * Required. Must be a valid MongoDB ObjectId.
34
43
  *
35
44
  * @example "507f1f77bcf86cd799439011"
36
45
  */
37
- updatedBy?: string;
46
+ updatedBy: string;
38
47
  }
@@ -7,66 +7,75 @@ 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, IsOptional, IsMongoId, IsUUID, MaxLength, } from "class-validator";
10
+ import { IsString, IsOptional, IsMongoId, IsUUID, MaxLength, IsNotEmpty, } from "class-validator";
11
11
  /**
12
12
  * DTO for updating an existing ingredient.
13
13
  *
14
- * Extends CreateIngredientDto with all fields optional.
15
- * Used by the Products microservice to update ingredient details.
14
+ * Provides structure and validation for payloads to update ingredient data within the system.
15
+ * Permits partial updates: only the provided fields will be updated.
16
+ * Used by the Products microservice to modify ingredient details.
16
17
  *
17
18
  * @since 2.0.0
19
+ *
20
+ * @example
21
+ * {
22
+ * "ingredientId": "550e8400-e29b-41d4-a716-446655440000",
23
+ * "name": "Tomato",
24
+ * "unit": "kg",
25
+ * "updatedBy": "507f1f77bcf86cd799439011"
26
+ * }
18
27
  */
19
28
  export class UpdateIngredientDto {
20
29
  /**
21
- * Name of the ingredient.
22
- * Must not be empty and maximum length of 100 characters.
30
+ * Ingredient name.
31
+ * Optional. If provided, must be a string with a maximum length of 25 characters.
23
32
  *
24
33
  * @example "Tomato"
25
34
  */
26
35
  name;
27
36
  /**
28
37
  * Unit of measurement for the ingredient.
29
- * Must not be empty and maximum length of 20 characters.
38
+ * Optional. If provided, must be a string with a maximum length of 12 characters.
30
39
  *
31
40
  * @example "kg"
32
41
  */
33
42
  unit;
34
43
  /**
35
- * Ingredient ID to update.
36
- * Must be a valid UUID.
44
+ * Unique identifier of the ingredient to update.
45
+ * Required. Must be a valid UUID string.
37
46
  *
38
47
  * @example "550e8400-e29b-41d4-a716-446655440000"
39
48
  */
40
- id;
49
+ ingredientId;
41
50
  /**
42
- * User who updated the ingredient.
43
- * Must be a valid MongoDB ObjectId if provided.
51
+ * Unique identifier of the user performing the update.
52
+ * Required. Must be a valid MongoDB ObjectId.
44
53
  *
45
54
  * @example "507f1f77bcf86cd799439011"
46
55
  */
47
56
  updatedBy;
48
57
  }
49
58
  __decorate([
50
- IsString(),
51
- MaxLength(100, { message: "Ingredient name must be at most 100 characters" }),
52
59
  IsOptional(),
60
+ IsString(),
61
+ MaxLength(25, { message: "Ingredient name must be at most 25 characters" }),
53
62
  __metadata("design:type", String)
54
63
  ], UpdateIngredientDto.prototype, "name", void 0);
55
64
  __decorate([
56
- IsString(),
57
- MaxLength(20, { message: "Unit must be at most 20 characters" }),
58
65
  IsOptional(),
66
+ IsString(),
67
+ MaxLength(12, { message: "Unit must be at most 12 characters" }),
59
68
  __metadata("design:type", String)
60
69
  ], UpdateIngredientDto.prototype, "unit", void 0);
61
70
  __decorate([
62
71
  IsString(),
63
72
  IsUUID(),
64
- IsOptional(),
73
+ IsNotEmpty({ message: 'ingredientId is required and must be a valid UUID.' }),
65
74
  __metadata("design:type", String)
66
- ], UpdateIngredientDto.prototype, "id", void 0);
75
+ ], UpdateIngredientDto.prototype, "ingredientId", void 0);
67
76
  __decorate([
68
77
  IsString(),
69
- IsMongoId(),
70
- IsOptional(),
78
+ IsMongoId({ message: 'updatedBy must be a valid MongoDB ObjectId.' }),
79
+ IsNotEmpty({ message: 'updatedBy is required and must be a valid MongoDB ObjectId.' }),
71
80
  __metadata("design:type", String)
72
81
  ], UpdateIngredientDto.prototype, "updatedBy", void 0);
@@ -1,25 +1,34 @@
1
- import { OrderStatus } from '../../enums/order-status.enum.js';
1
+ import type { OrderStatus } from "../../types/order-status.type.js";
2
2
  /**
3
- * DTO for changing an order's status.
3
+ * Data Transfer Object (DTO) for changing the status of an order.
4
4
  *
5
- * Used by the Orders microservice to update the status of an existing order.
6
- * Validates the order ID and new status value.
5
+ * This DTO is used by the Orders microservice to request a status change for an existing order.
6
+ * It ensures that the required order identifier and the new order status are both valid.
7
7
  *
8
+ * @class ChangeOrderStatusDto
8
9
  * @since 2.0.0
10
+ *
11
+ * @example
12
+ * {
13
+ * "orderId": "550e8400-e29b-41d4-a716-446655440000",
14
+ * "status": "CONFIRMED"
15
+ * }
9
16
  */
10
17
  export declare class ChangeOrderStatusDto {
11
18
  /**
12
- * Unique identifier of the order to update.
13
- * Must be a valid UUID version 4.
19
+ * Unique identifier of the order whose status is to be updated.
20
+ * Must be a valid UUID (version 4).
14
21
  *
22
+ * @type {string}
15
23
  * @example "550e8400-e29b-41d4-a716-446655440000"
16
24
  */
17
- id: string;
25
+ orderId: string;
18
26
  /**
19
- * New status for the order.
20
- * Must be a valid OrderStatus enum value.
27
+ * New status value to set for the order.
28
+ * Must be a valid value from the OrderStatus enum.
21
29
  *
22
- * @example OrderStatus.CONFIRMED
30
+ * @type {OrderStatus}
31
+ * @example "CONFIRMED"
23
32
  */
24
33
  status: OrderStatus;
25
34
  }
@@ -7,37 +7,50 @@ 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, IsUUID } from 'class-validator';
11
- import { OrderStatus } from '../../enums/order-status.enum.js';
10
+ import { IsIn, IsNotEmpty, IsString, IsUUID } from "class-validator";
11
+ import { ORDER_STATUS } from "../../types/order-status.type.js";
12
12
  /**
13
- * DTO for changing an order's status.
13
+ * Data Transfer Object (DTO) for changing the status of an order.
14
14
  *
15
- * Used by the Orders microservice to update the status of an existing order.
16
- * Validates the order ID and new status value.
15
+ * This DTO is used by the Orders microservice to request a status change for an existing order.
16
+ * It ensures that the required order identifier and the new order status are both valid.
17
17
  *
18
+ * @class ChangeOrderStatusDto
18
19
  * @since 2.0.0
20
+ *
21
+ * @example
22
+ * {
23
+ * "orderId": "550e8400-e29b-41d4-a716-446655440000",
24
+ * "status": "CONFIRMED"
25
+ * }
19
26
  */
20
27
  export class ChangeOrderStatusDto {
21
28
  /**
22
- * Unique identifier of the order to update.
23
- * Must be a valid UUID version 4.
29
+ * Unique identifier of the order whose status is to be updated.
30
+ * Must be a valid UUID (version 4).
24
31
  *
32
+ * @type {string}
25
33
  * @example "550e8400-e29b-41d4-a716-446655440000"
26
34
  */
27
- id;
35
+ orderId;
28
36
  /**
29
- * New status for the order.
30
- * Must be a valid OrderStatus enum value.
37
+ * New status value to set for the order.
38
+ * Must be a valid value from the OrderStatus enum.
31
39
  *
32
- * @example OrderStatus.CONFIRMED
40
+ * @type {OrderStatus}
41
+ * @example "CONFIRMED"
33
42
  */
34
43
  status;
35
44
  }
36
45
  __decorate([
37
- IsUUID(4, { message: 'Order ID must be a valid UUID' }),
46
+ IsUUID(4, { message: "orderId must be a valid UUID v4" }),
47
+ IsString({ message: "orderId must be a string" }),
48
+ IsNotEmpty({ message: "orderId is required" }),
38
49
  __metadata("design:type", String)
39
- ], ChangeOrderStatusDto.prototype, "id", void 0);
50
+ ], ChangeOrderStatusDto.prototype, "orderId", void 0);
40
51
  __decorate([
41
- IsEnum(OrderStatus, { message: 'Status must be a valid order status' }),
52
+ IsIn(ORDER_STATUS, { message: "status must be a valid order status" }),
53
+ IsString({ message: "status must be a string" }),
54
+ IsNotEmpty({ message: "status is required" }),
42
55
  __metadata("design:type", String)
43
56
  ], ChangeOrderStatusDto.prototype, "status", void 0);