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.
- package/dist/dtos/auth/register-user.dto.js +4 -1
- package/dist/dtos/categories/create-category.dto.js +6 -3
- package/dist/dtos/categories/delete-category.dto.d.ts +1 -1
- package/dist/dtos/categories/delete-category.dto.js +5 -3
- package/dist/dtos/categories/update-category.dto.d.ts +12 -10
- package/dist/dtos/categories/update-category.dto.js +15 -13
- package/dist/dtos/chain/create-chain.dto.d.ts +11 -12
- package/dist/dtos/chain/create-chain.dto.js +15 -14
- package/dist/dtos/chain/delete-chain.dto.d.ts +6 -6
- package/dist/dtos/chain/delete-chain.dto.js +11 -9
- package/dist/dtos/chain/update-chain.dto.d.ts +26 -16
- package/dist/dtos/chain/update-chain.dto.js +32 -21
- package/dist/dtos/common/search-by-name.dto.d.ts +23 -0
- package/dist/dtos/common/search-by-name.dto.js +24 -1
- package/dist/dtos/ingredients/create-ingredient.dto.d.ts +5 -5
- package/dist/dtos/ingredients/create-ingredient.dto.js +9 -8
- package/dist/dtos/ingredients/delete-ingredient.dto.d.ts +14 -7
- package/dist/dtos/ingredients/delete-ingredient.dto.js +18 -9
- package/dist/dtos/ingredients/index.d.ts +0 -1
- package/dist/dtos/ingredients/index.js +0 -1
- package/dist/dtos/ingredients/update-ingredient.dto.d.ts +20 -11
- package/dist/dtos/ingredients/update-ingredient.dto.js +28 -19
- package/dist/dtos/orders/change-order-status.dto.d.ts +19 -10
- package/dist/dtos/orders/change-order-status.dto.js +27 -14
- package/dist/dtos/orders/create-order.dto.d.ts +33 -23
- package/dist/dtos/orders/create-order.dto.js +43 -31
- package/dist/dtos/orders/order-item.dto.d.ts +35 -18
- package/dist/dtos/orders/order-item.dto.js +54 -32
- package/dist/dtos/orders/order-pagination.dto.d.ts +1 -1
- package/dist/dtos/orders/order-pagination.dto.js +3 -3
- package/dist/dtos/orders/paid-order.dto.d.ts +16 -8
- package/dist/dtos/orders/paid-order.dto.js +25 -14
- package/dist/dtos/payments/create-payment-audit-dynamo.dto.d.ts +81 -0
- package/dist/dtos/payments/create-payment-audit-dynamo.dto.js +81 -0
- package/dist/dtos/payments/create-payment-audit-s3.dto.d.ts +81 -0
- package/dist/dtos/payments/create-payment-audit-s3.dto.js +81 -0
- package/dist/dtos/payments/index.d.ts +2 -0
- package/dist/dtos/payments/index.js +2 -0
- package/dist/dtos/payments/payment-session-item.dto.d.ts +4 -4
- package/dist/dtos/payments/payment-session-item.dto.js +7 -4
- package/dist/dtos/payments/webhook-data.dto.d.ts +1 -1
- package/dist/dtos/payments/webhook-data.dto.js +1 -0
- package/dist/dtos/products/create-product.dto.d.ts +1 -1
- package/dist/dtos/products/create-product.dto.js +2 -1
- package/dist/dtos/products/delete-product.dto.d.ts +1 -1
- package/dist/dtos/products/delete-product.dto.js +5 -3
- package/dist/dtos/products/submodules/product-image/bulk-create-product-image.dto.d.ts +3 -3
- package/dist/dtos/products/submodules/product-image/bulk-create-product-image.dto.js +5 -5
- package/dist/dtos/products/submodules/product-image/create-product-image.dto.d.ts +1 -1
- package/dist/dtos/products/submodules/product-image/create-product-image.dto.js +4 -4
- package/dist/dtos/products/submodules/product-image/update-product-image.dto.d.ts +1 -1
- package/dist/dtos/products/submodules/product-image/update-product-image.dto.js +4 -4
- package/dist/dtos/products/submodules/product-question/create-product-question.dto.d.ts +2 -2
- package/dist/dtos/products/submodules/product-question/create-product-question.dto.js +8 -8
- package/dist/dtos/products/submodules/product-question/replace-by-product-id.dto.d.ts +1 -1
- package/dist/dtos/products/submodules/product-question/update-product-question.dto.d.ts +1 -1
- package/dist/dtos/products/submodules/product-question/update-product-question.dto.js +4 -4
- package/dist/dtos/products/submodules/product-recipe/create-product-recipe.dto.d.ts +1 -1
- package/dist/dtos/products/submodules/product-recipe/create-product-recipe.dto.js +2 -2
- package/dist/dtos/products/submodules/product-recipe/replace-by-product-id.dto.d.ts +2 -2
- package/dist/dtos/products/submodules/product-recipe/replace-by-product-id.dto.js +5 -5
- package/dist/dtos/products/submodules/product-recipe/update-product-recipe.dto.d.ts +1 -8
- package/dist/dtos/products/submodules/product-recipe/update-product-recipe.dto.js +3 -16
- package/dist/dtos/products/submodules/product-schedule/create-product-schedule.dto.d.ts +1 -1
- package/dist/dtos/products/submodules/product-schedule/create-product-schedule.dto.js +2 -2
- package/dist/dtos/products/submodules/product-schedule/replace-by-product-id.dto.d.ts +1 -1
- package/dist/dtos/products/submodules/product-schedule/update-product-schedule.dto.d.ts +1 -1
- package/dist/dtos/products/submodules/product-schedule/update-product-schedule.dto.js +4 -4
- package/dist/dtos/products/submodules/product-size/create-product-size.dto.js +1 -1
- package/dist/dtos/products/submodules/product-size/product-size-data.dto.js +1 -1
- package/dist/dtos/products/submodules/product-size/update-product-size.dto.d.ts +1 -1
- package/dist/dtos/products/submodules/product-size/update-product-size.dto.js +2 -2
- package/dist/dtos/products/submodules/product-tag/index.d.ts +1 -3
- package/dist/dtos/products/submodules/product-tag/index.js +1 -3
- package/dist/dtos/products/submodules/product-tag/{remove-product-tag.dto.d.ts → product-tag.dto.d.ts} +1 -1
- package/dist/dtos/products/submodules/product-tag/{remove-product-tag.dto.js → product-tag.dto.js} +3 -3
- package/dist/dtos/products/update-product.dto.d.ts +4 -4
- package/dist/dtos/products/update-product.dto.js +5 -4
- package/dist/dtos/questions/create-question.dto.d.ts +1 -1
- package/dist/dtos/questions/create-question.dto.js +2 -1
- package/dist/dtos/questions/delete-question.dto.d.ts +1 -1
- package/dist/dtos/questions/delete-question.dto.js +5 -3
- package/dist/dtos/questions/index.d.ts +0 -1
- package/dist/dtos/questions/index.js +0 -1
- package/dist/dtos/questions/update-question.dto.d.ts +4 -4
- package/dist/dtos/questions/update-question.dto.js +5 -5
- package/dist/dtos/restaurants/create-restaurant.dto.d.ts +15 -1
- package/dist/dtos/restaurants/create-restaurant.dto.js +38 -2
- package/dist/dtos/restaurants/delete-restaurant.dto.d.ts +1 -1
- package/dist/dtos/restaurants/delete-restaurant.dto.js +5 -3
- package/dist/dtos/restaurants/update-restaurant.dto.d.ts +17 -10
- package/dist/dtos/restaurants/update-restaurant.dto.js +32 -16
- package/dist/dtos/tags/create-tag.dto.d.ts +1 -1
- package/dist/dtos/tags/create-tag.dto.js +5 -4
- package/dist/dtos/tags/delete-tag.dto.d.ts +1 -1
- package/dist/dtos/tags/delete-tag.dto.js +5 -3
- package/dist/dtos/tags/index.d.ts +0 -1
- package/dist/dtos/tags/index.js +0 -1
- package/dist/dtos/tags/update-tag.dto.d.ts +3 -3
- package/dist/dtos/tags/update-tag.dto.js +6 -5
- package/dist/dtos/translations/create-translation.dto.js +6 -1
- package/dist/dtos/translations/delete-translation.dto.d.ts +1 -1
- package/dist/dtos/translations/delete-translation.dto.js +4 -3
- package/dist/dtos/translations/update-translation.dto.d.ts +3 -3
- package/dist/dtos/translations/update-translation.dto.js +7 -4
- package/dist/enums/index.d.ts +0 -2
- package/dist/enums/index.js +0 -2
- package/dist/interfaces/orders/order-item.interface.d.ts +4 -4
- package/dist/interfaces/orders/order.interface.d.ts +9 -9
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/order-mode.type.d.ts +12 -3
- package/dist/types/order-mode.type.js +20 -1
- package/dist/types/order-status.type.d.ts +22 -0
- package/dist/{enums/order-status.enum.d.ts → types/order-status.type.js} +25 -26
- package/package.json +1 -1
- package/dist/dtos/ingredients/search-by-name.dto.d.ts +0 -18
- package/dist/dtos/ingredients/search-by-name.dto.js +0 -33
- package/dist/dtos/products/submodules/product-tag/create-product-tag.dto.d.ts +0 -24
- package/dist/dtos/products/submodules/product-tag/create-product-tag.dto.js +0 -46
- package/dist/dtos/products/submodules/product-tag/find-product-tag.dto.d.ts +0 -24
- package/dist/dtos/products/submodules/product-tag/find-product-tag.dto.js +0 -46
- package/dist/dtos/questions/search-by-name.dto.d.ts +0 -18
- package/dist/dtos/questions/search-by-name.dto.js +0 -33
- package/dist/dtos/tags/search-by-name.dto.d.ts +0 -18
- package/dist/dtos/tags/search-by-name.dto.js +0 -33
- package/dist/enums/order-status.enum.js +0 -69
- package/dist/enums/order-type.enum.d.ts +0 -45
- package/dist/enums/order-type.enum.js +0 -46
|
@@ -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
|
|
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
|
-
*
|
|
12
|
-
* Must not be empty and maximum length of
|
|
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
|
|
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
|
|
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
|
-
*
|
|
22
|
-
* Must not be empty and maximum length of
|
|
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
|
|
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(
|
|
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(
|
|
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
|
-
*
|
|
5
|
-
*
|
|
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
|
-
*
|
|
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
|
-
|
|
23
|
+
ingredientId: string;
|
|
17
24
|
/**
|
|
18
|
-
*
|
|
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
|
-
*
|
|
15
|
-
*
|
|
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
|
-
*
|
|
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
|
-
|
|
33
|
+
ingredientId;
|
|
27
34
|
/**
|
|
28
|
-
*
|
|
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, "
|
|
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)
|
|
@@ -1,38 +1,47 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DTO for updating an existing ingredient.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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
|
-
*
|
|
12
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
|
|
39
|
+
ingredientId: string;
|
|
31
40
|
/**
|
|
32
|
-
*
|
|
33
|
-
* Must be a valid MongoDB ObjectId
|
|
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
|
|
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
|
-
*
|
|
15
|
-
*
|
|
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
|
-
*
|
|
22
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
|
|
49
|
+
ingredientId;
|
|
41
50
|
/**
|
|
42
|
-
*
|
|
43
|
-
* Must be a valid MongoDB ObjectId
|
|
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
|
-
|
|
73
|
+
IsNotEmpty({ message: 'ingredientId is required and must be a valid UUID.' }),
|
|
65
74
|
__metadata("design:type", String)
|
|
66
|
-
], UpdateIngredientDto.prototype, "
|
|
75
|
+
], UpdateIngredientDto.prototype, "ingredientId", void 0);
|
|
67
76
|
__decorate([
|
|
68
77
|
IsString(),
|
|
69
|
-
IsMongoId(),
|
|
70
|
-
|
|
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
|
|
1
|
+
import type { OrderStatus } from "../../types/order-status.type.js";
|
|
2
2
|
/**
|
|
3
|
-
* DTO for changing an order
|
|
3
|
+
* Data Transfer Object (DTO) for changing the status of an order.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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
|
|
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
|
-
|
|
25
|
+
orderId: string;
|
|
18
26
|
/**
|
|
19
|
-
* New status for the order.
|
|
20
|
-
* Must be a valid OrderStatus enum
|
|
27
|
+
* New status value to set for the order.
|
|
28
|
+
* Must be a valid value from the OrderStatus enum.
|
|
21
29
|
*
|
|
22
|
-
* @
|
|
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 {
|
|
11
|
-
import {
|
|
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
|
|
13
|
+
* Data Transfer Object (DTO) for changing the status of an order.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
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
|
|
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
|
-
|
|
35
|
+
orderId;
|
|
28
36
|
/**
|
|
29
|
-
* New status for the order.
|
|
30
|
-
* Must be a valid OrderStatus enum
|
|
37
|
+
* New status value to set for the order.
|
|
38
|
+
* Must be a valid value from the OrderStatus enum.
|
|
31
39
|
*
|
|
32
|
-
* @
|
|
40
|
+
* @type {OrderStatus}
|
|
41
|
+
* @example "CONFIRMED"
|
|
33
42
|
*/
|
|
34
43
|
status;
|
|
35
44
|
}
|
|
36
45
|
__decorate([
|
|
37
|
-
IsUUID(4, { message:
|
|
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, "
|
|
50
|
+
], ChangeOrderStatusDto.prototype, "orderId", void 0);
|
|
40
51
|
__decorate([
|
|
41
|
-
|
|
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);
|
|
@@ -1,62 +1,72 @@
|
|
|
1
1
|
import { OrderItemDto } from './order-item.dto.js';
|
|
2
|
-
import {
|
|
2
|
+
import { type OrderMode } from '../../types/order-mode.type.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Data Transfer Object for creating a new order in QeHay.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* order
|
|
8
|
-
*
|
|
6
|
+
* This DTO defines the structure, validation and documentation for the data needed to create a restaurant order.
|
|
7
|
+
* It supports all main QeHay order flows (DINE_IN, PICKUP, DELIVERY) and enforces minimum business rules at field level.
|
|
8
|
+
*
|
|
9
|
+
* Each property is validated and documented for clear API contracts and seamless integration with client apps.
|
|
9
10
|
*
|
|
10
11
|
* @since 2.0.0
|
|
11
12
|
*/
|
|
12
13
|
export declare class CreateOrderDto {
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
-
* Must contain at least one item.
|
|
16
|
-
* Each
|
|
15
|
+
* List of items included in the order.
|
|
16
|
+
* - Must contain at least one item.
|
|
17
|
+
* - Each element is validated as OrderItemDto.
|
|
17
18
|
*
|
|
18
|
-
* @
|
|
19
|
+
* @type {OrderItemDto[]}
|
|
20
|
+
* @example [{ "productId": "651cb9...", "quantity": 2, "price": 19.98 }]
|
|
19
21
|
*/
|
|
20
22
|
items: OrderItemDto[];
|
|
21
23
|
/**
|
|
22
|
-
* Type of order (DINE_IN, PICKUP,
|
|
23
|
-
*
|
|
24
|
+
* Type of order (DINE_IN, PICKUP, DELIVERY).
|
|
25
|
+
* This determines the flow and required additional fields.
|
|
24
26
|
*
|
|
25
|
-
* @
|
|
27
|
+
* @type {OrderMode}
|
|
28
|
+
* @example "DELIVERY"
|
|
26
29
|
*/
|
|
27
|
-
mode:
|
|
30
|
+
mode: OrderMode;
|
|
28
31
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
32
|
+
* Table identifier for dine-in orders.
|
|
33
|
+
* - Required for DINE_IN orders.
|
|
34
|
+
* - Ignored for PICKUP and DELIVERY.
|
|
35
|
+
* - Must be at least 2 characters if provided.
|
|
31
36
|
*
|
|
37
|
+
* @type {string}
|
|
32
38
|
* @example "Table 5"
|
|
33
39
|
*/
|
|
34
40
|
tableId?: string;
|
|
35
41
|
/**
|
|
36
|
-
*
|
|
42
|
+
* Delivery address, required when mode is DELIVERY.
|
|
37
43
|
*
|
|
44
|
+
* @type {string}
|
|
38
45
|
* @example "123 Main St, Downtown"
|
|
39
46
|
*/
|
|
40
47
|
deliveryAddress?: string;
|
|
41
48
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
49
|
+
* Scheduled pickup time for pickup orders, as a valid ISO 8601 string.
|
|
50
|
+
* Only relevant for PICKUP mode.
|
|
44
51
|
*
|
|
52
|
+
* @type {string}
|
|
45
53
|
* @example "2024-01-15T18:30:00Z"
|
|
46
54
|
*/
|
|
47
55
|
pickupTime?: string;
|
|
48
56
|
/**
|
|
49
|
-
*
|
|
50
|
-
* Required for orders
|
|
57
|
+
* Identifier of the payment method selected by the customer.
|
|
58
|
+
* - Required for orders requiring pre-payment (typically DELIVERY and PICKUP).
|
|
51
59
|
*
|
|
60
|
+
* @type {string}
|
|
52
61
|
* @example "payment-method-uuid-123"
|
|
53
62
|
*/
|
|
54
63
|
paymentMethodId: string;
|
|
55
64
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
65
|
+
* User identifier (MongoDB ObjectId) of the customer who created the order.
|
|
66
|
+
* - Required. Used for user traceability and order ownership.
|
|
58
67
|
*
|
|
68
|
+
* @type {string}
|
|
59
69
|
* @example "507f1f77bcf86cd799439011"
|
|
60
70
|
*/
|
|
61
|
-
userId
|
|
71
|
+
userId: string;
|
|
62
72
|
}
|