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.
- 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 +14 -16
- package/dist/dtos/chain/create-chain.dto.js +24 -22
- 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 +30 -20
- package/dist/dtos/chain/update-chain.dto.js +39 -26
- 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 +2 -2
- package/dist/dtos/products/create-product.dto.js +12 -9
- 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 +5 -5
- package/dist/dtos/products/update-product.dto.js +10 -7
- 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 -4
- package/dist/enums/index.js +0 -4
- package/dist/interfaces/auth/account.interface.d.ts +4 -4
- package/dist/interfaces/auth/user.interface.d.ts +1 -1
- package/dist/interfaces/categories/category.interface.d.ts +5 -5
- package/dist/interfaces/chains/chain.interface.d.ts +2 -2
- package/dist/interfaces/ingredients/ingredient.interface.d.ts +4 -4
- package/dist/interfaces/orders/order-item.interface.d.ts +4 -4
- package/dist/interfaces/orders/order.interface.d.ts +9 -9
- package/dist/interfaces/products/product.interface.d.ts +11 -8
- package/dist/interfaces/products/response/sub-resources/create-tag-response.interface.d.ts +1 -1
- package/dist/interfaces/products/response/sub-resources/recipe-relationship.interface.d.ts +0 -2
- package/dist/interfaces/questions/question.interface.d.ts +8 -6
- package/dist/interfaces/restaurants/restaurant.interface.d.ts +7 -7
- package/dist/interfaces/translations/translation.interface.d.ts +4 -4
- package/dist/types/currency.type.d.ts +26 -0
- package/dist/types/currency.type.js +18 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +3 -0
- package/dist/types/order-mode.type.d.ts +12 -3
- package/dist/types/order-mode.type.js +16 -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/dist/types/product-status.type.d.ts +25 -0
- package/dist/types/product-status.type.js +17 -0
- 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/currency.enum.d.ts +0 -21
- package/dist/enums/currency.enum.js +0 -22
- 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
- package/dist/enums/product-status.enum.d.ts +0 -55
- package/dist/enums/product-status.enum.js +0 -56
|
@@ -7,7 +7,7 @@ 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 { IsEmail, IsString, IsStrongPassword } from 'class-validator';
|
|
10
|
+
import { IsEmail, IsNotEmpty, IsString, IsStrongPassword, MinLength } from 'class-validator';
|
|
11
11
|
/**
|
|
12
12
|
* DTO for user registration requests.
|
|
13
13
|
*
|
|
@@ -40,6 +40,8 @@ export class RegisterUserDto {
|
|
|
40
40
|
}
|
|
41
41
|
__decorate([
|
|
42
42
|
IsString(),
|
|
43
|
+
IsNotEmpty(),
|
|
44
|
+
MinLength(3),
|
|
43
45
|
__metadata("design:type", String)
|
|
44
46
|
], RegisterUserDto.prototype, "name", void 0);
|
|
45
47
|
__decorate([
|
|
@@ -48,6 +50,7 @@ __decorate([
|
|
|
48
50
|
__metadata("design:type", String)
|
|
49
51
|
], RegisterUserDto.prototype, "email", void 0);
|
|
50
52
|
__decorate([
|
|
53
|
+
IsNotEmpty(),
|
|
51
54
|
IsString(),
|
|
52
55
|
IsStrongPassword({
|
|
53
56
|
minLength: 8,
|
|
@@ -7,7 +7,7 @@ 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, IsBoolean,
|
|
10
|
+
import { IsString, IsOptional, IsBoolean, IsNotEmpty, MinLength, MaxLength, IsUUID } from 'class-validator';
|
|
11
11
|
/**
|
|
12
12
|
* DTO for creating a new category.
|
|
13
13
|
*
|
|
@@ -49,11 +49,14 @@ export class CreateCategoryDto {
|
|
|
49
49
|
__decorate([
|
|
50
50
|
IsString(),
|
|
51
51
|
IsNotEmpty({ message: 'Category name is required' }),
|
|
52
|
+
MinLength(3),
|
|
52
53
|
__metadata("design:type", String)
|
|
53
54
|
], CreateCategoryDto.prototype, "name", void 0);
|
|
54
55
|
__decorate([
|
|
55
56
|
IsOptional(),
|
|
56
57
|
IsString(),
|
|
58
|
+
MinLength(10),
|
|
59
|
+
MaxLength(200),
|
|
57
60
|
__metadata("design:type", String)
|
|
58
61
|
], CreateCategoryDto.prototype, "description", void 0);
|
|
59
62
|
__decorate([
|
|
@@ -62,8 +65,8 @@ __decorate([
|
|
|
62
65
|
__metadata("design:type", Boolean)
|
|
63
66
|
], CreateCategoryDto.prototype, "status", void 0);
|
|
64
67
|
__decorate([
|
|
65
|
-
IsOptional(),
|
|
66
68
|
IsString(),
|
|
67
|
-
|
|
69
|
+
IsUUID(),
|
|
70
|
+
IsNotEmpty(),
|
|
68
71
|
__metadata("design:type", String)
|
|
69
72
|
], CreateCategoryDto.prototype, "createdBy", void 0);
|
|
@@ -7,7 +7,7 @@ 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 a category.
|
|
13
13
|
*
|
|
@@ -23,7 +23,7 @@ export class DeleteCategoryDto {
|
|
|
23
23
|
*
|
|
24
24
|
* @example "550e8400-e29b-41d4-a716-446655440000"
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
categoryId;
|
|
27
27
|
/**
|
|
28
28
|
* User who deleted the category.
|
|
29
29
|
* Must be a valid MongoDB ObjectId.
|
|
@@ -35,10 +35,12 @@ export class DeleteCategoryDto {
|
|
|
35
35
|
__decorate([
|
|
36
36
|
IsString(),
|
|
37
37
|
IsUUID(),
|
|
38
|
+
IsNotEmpty(),
|
|
38
39
|
__metadata("design:type", String)
|
|
39
|
-
], DeleteCategoryDto.prototype, "
|
|
40
|
+
], DeleteCategoryDto.prototype, "categoryId", void 0);
|
|
40
41
|
__decorate([
|
|
41
42
|
IsString(),
|
|
42
43
|
IsMongoId(),
|
|
44
|
+
IsNotEmpty(),
|
|
43
45
|
__metadata("design:type", String)
|
|
44
46
|
], DeleteCategoryDto.prototype, "deletedBy", void 0);
|
|
@@ -1,43 +1,45 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DTO for updating an existing category.
|
|
3
3
|
*
|
|
4
|
-
* All fields
|
|
5
|
-
* Used by the Products microservice to
|
|
4
|
+
* Allows partial updates of category details. All fields except `categoryId` and `updatedBy` are optional,
|
|
5
|
+
* permitting fine-grained modifications. Used by the Products microservice to apply changes to product categories.
|
|
6
6
|
*
|
|
7
7
|
* @since 2.0.0
|
|
8
8
|
*/
|
|
9
9
|
export declare class UpdateCategoryDto {
|
|
10
10
|
/**
|
|
11
11
|
* Category name.
|
|
12
|
-
*
|
|
12
|
+
* Optional. If provided, must be a string.
|
|
13
13
|
*
|
|
14
14
|
* @example "Beverages"
|
|
15
15
|
*/
|
|
16
16
|
name?: string;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Category description.
|
|
19
|
+
* Optional. If provided, must be a string.
|
|
19
20
|
*
|
|
20
21
|
* @example "All types of drinks and beverages"
|
|
21
22
|
*/
|
|
22
23
|
description?: string;
|
|
23
24
|
/**
|
|
24
25
|
* Category status (active/inactive).
|
|
26
|
+
* Optional. If provided, must be a boolean.
|
|
25
27
|
*
|
|
26
28
|
* @example true
|
|
27
29
|
*/
|
|
28
30
|
status?: boolean;
|
|
29
31
|
/**
|
|
30
|
-
*
|
|
31
|
-
* Must be a valid UUID.
|
|
32
|
+
* Unique identifier of the category to update.
|
|
33
|
+
* Required. Must be a valid UUID string.
|
|
32
34
|
*
|
|
33
35
|
* @example "550e8400-e29b-41d4-a716-446655440000"
|
|
34
36
|
*/
|
|
35
|
-
|
|
37
|
+
categoryId: string;
|
|
36
38
|
/**
|
|
37
|
-
*
|
|
38
|
-
* Must be a valid MongoDB ObjectId
|
|
39
|
+
* Unique identifier of the user performing the update.
|
|
40
|
+
* Required. Must be a valid MongoDB ObjectId.
|
|
39
41
|
*
|
|
40
42
|
* @example "507f1f77bcf86cd799439011"
|
|
41
43
|
*/
|
|
42
|
-
updatedBy
|
|
44
|
+
updatedBy: string;
|
|
43
45
|
}
|
|
@@ -7,45 +7,47 @@ 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, IsBoolean } from 'class-validator';
|
|
10
|
+
import { IsString, IsOptional, IsMongoId, IsUUID, IsBoolean, IsNotEmpty } from 'class-validator';
|
|
11
11
|
/**
|
|
12
12
|
* DTO for updating an existing category.
|
|
13
13
|
*
|
|
14
|
-
* All fields
|
|
15
|
-
* Used by the Products microservice to
|
|
14
|
+
* Allows partial updates of category details. All fields except `categoryId` and `updatedBy` are optional,
|
|
15
|
+
* permitting fine-grained modifications. Used by the Products microservice to apply changes to product categories.
|
|
16
16
|
*
|
|
17
17
|
* @since 2.0.0
|
|
18
18
|
*/
|
|
19
19
|
export class UpdateCategoryDto {
|
|
20
20
|
/**
|
|
21
21
|
* Category name.
|
|
22
|
-
*
|
|
22
|
+
* Optional. If provided, must be a string.
|
|
23
23
|
*
|
|
24
24
|
* @example "Beverages"
|
|
25
25
|
*/
|
|
26
26
|
name;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Category description.
|
|
29
|
+
* Optional. If provided, must be a string.
|
|
29
30
|
*
|
|
30
31
|
* @example "All types of drinks and beverages"
|
|
31
32
|
*/
|
|
32
33
|
description;
|
|
33
34
|
/**
|
|
34
35
|
* Category status (active/inactive).
|
|
36
|
+
* Optional. If provided, must be a boolean.
|
|
35
37
|
*
|
|
36
38
|
* @example true
|
|
37
39
|
*/
|
|
38
40
|
status;
|
|
39
41
|
/**
|
|
40
|
-
*
|
|
41
|
-
* Must be a valid UUID.
|
|
42
|
+
* Unique identifier of the category to update.
|
|
43
|
+
* Required. Must be a valid UUID string.
|
|
42
44
|
*
|
|
43
45
|
* @example "550e8400-e29b-41d4-a716-446655440000"
|
|
44
46
|
*/
|
|
45
|
-
|
|
47
|
+
categoryId;
|
|
46
48
|
/**
|
|
47
|
-
*
|
|
48
|
-
* Must be a valid MongoDB ObjectId
|
|
49
|
+
* Unique identifier of the user performing the update.
|
|
50
|
+
* Required. Must be a valid MongoDB ObjectId.
|
|
49
51
|
*
|
|
50
52
|
* @example "507f1f77bcf86cd799439011"
|
|
51
53
|
*/
|
|
@@ -67,14 +69,14 @@ __decorate([
|
|
|
67
69
|
__metadata("design:type", Boolean)
|
|
68
70
|
], UpdateCategoryDto.prototype, "status", void 0);
|
|
69
71
|
__decorate([
|
|
70
|
-
IsOptional(),
|
|
71
72
|
IsString(),
|
|
72
73
|
IsUUID(),
|
|
74
|
+
IsNotEmpty({ message: 'categoryId is required and must be a valid UUID.' }),
|
|
73
75
|
__metadata("design:type", String)
|
|
74
|
-
], UpdateCategoryDto.prototype, "
|
|
76
|
+
], UpdateCategoryDto.prototype, "categoryId", void 0);
|
|
75
77
|
__decorate([
|
|
76
|
-
IsOptional(),
|
|
77
78
|
IsString(),
|
|
78
79
|
IsMongoId(),
|
|
80
|
+
IsNotEmpty({ message: 'updatedBy is required and must be a valid MongoId.' }),
|
|
79
81
|
__metadata("design:type", String)
|
|
80
82
|
], UpdateCategoryDto.prototype, "updatedBy", void 0);
|
|
@@ -1,43 +1,41 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type CurrencyCode } from "../../types/currency.type.js";
|
|
2
2
|
/**
|
|
3
3
|
* DTO for creating a new chain.
|
|
4
4
|
*
|
|
5
5
|
* Used by the Products microservice to create new restaurant chains.
|
|
6
|
-
* Chains represent restaurant brands that
|
|
6
|
+
* Chains represent restaurant brands that may operate multiple locations.
|
|
7
7
|
*
|
|
8
8
|
* @since 2.0.0
|
|
9
9
|
*/
|
|
10
10
|
export declare class CreateChainDto {
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
* Must
|
|
12
|
+
* Name of the chain.
|
|
13
|
+
* Required. Must be a string of at least 3 characters.
|
|
14
14
|
*
|
|
15
15
|
* @example "McDonald's"
|
|
16
16
|
*/
|
|
17
17
|
name: string;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* Defaults to PEN if not provided.
|
|
19
|
+
* The currency code for the chain.
|
|
20
|
+
* Optional. If provided, must be one of the supported currency codes (see CurrencyCode type).
|
|
22
21
|
*
|
|
23
|
-
* @example
|
|
24
|
-
* @default
|
|
22
|
+
* @example "PEN"
|
|
23
|
+
* @default "PEN"
|
|
25
24
|
*/
|
|
26
|
-
currency?:
|
|
25
|
+
currency?: CurrencyCode;
|
|
27
26
|
/**
|
|
28
|
-
* Global tax percentage
|
|
29
|
-
* Must be between 0 and 100
|
|
30
|
-
* Defaults to 0 if not provided.
|
|
27
|
+
* Global tax percentage to apply across the whole chain.
|
|
28
|
+
* Optional. Must be a number between 0 and 100. Defaults to 0.0 (no tax).
|
|
31
29
|
*
|
|
32
30
|
* @example 8.5
|
|
33
31
|
* @default 0.0
|
|
34
32
|
*/
|
|
35
33
|
taxPercent?: number;
|
|
36
34
|
/**
|
|
37
|
-
*
|
|
38
|
-
* Must be a valid MongoDB ObjectId
|
|
35
|
+
* Unique identifier of the user who is creating the chain.
|
|
36
|
+
* Required. Must be a valid MongoDB ObjectId.
|
|
39
37
|
*
|
|
40
38
|
* @example "507f1f77bcf86cd799439011"
|
|
41
39
|
*/
|
|
42
|
-
createdBy
|
|
40
|
+
createdBy: string;
|
|
43
41
|
}
|
|
@@ -7,45 +7,43 @@ 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, IsNumber, Min, Max,
|
|
11
|
-
import {
|
|
10
|
+
import { IsString, IsOptional, IsNumber, Min, Max, IsMongoId, IsNotEmpty, MinLength, IsIn, } from "class-validator";
|
|
11
|
+
import { CURRENCIES } from "../../types/currency.type.js";
|
|
12
12
|
/**
|
|
13
13
|
* DTO for creating a new chain.
|
|
14
14
|
*
|
|
15
15
|
* Used by the Products microservice to create new restaurant chains.
|
|
16
|
-
* Chains represent restaurant brands that
|
|
16
|
+
* Chains represent restaurant brands that may operate multiple locations.
|
|
17
17
|
*
|
|
18
18
|
* @since 2.0.0
|
|
19
19
|
*/
|
|
20
20
|
export class CreateChainDto {
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
* Must
|
|
22
|
+
* Name of the chain.
|
|
23
|
+
* Required. Must be a string of at least 3 characters.
|
|
24
24
|
*
|
|
25
25
|
* @example "McDonald's"
|
|
26
26
|
*/
|
|
27
27
|
name;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* Defaults to PEN if not provided.
|
|
29
|
+
* The currency code for the chain.
|
|
30
|
+
* Optional. If provided, must be one of the supported currency codes (see CurrencyCode type).
|
|
32
31
|
*
|
|
33
|
-
* @example
|
|
34
|
-
* @default
|
|
32
|
+
* @example "PEN"
|
|
33
|
+
* @default "PEN"
|
|
35
34
|
*/
|
|
36
|
-
currency =
|
|
35
|
+
currency = "PEN";
|
|
37
36
|
/**
|
|
38
|
-
* Global tax percentage
|
|
39
|
-
* Must be between 0 and 100
|
|
40
|
-
* Defaults to 0 if not provided.
|
|
37
|
+
* Global tax percentage to apply across the whole chain.
|
|
38
|
+
* Optional. Must be a number between 0 and 100. Defaults to 0.0 (no tax).
|
|
41
39
|
*
|
|
42
40
|
* @example 8.5
|
|
43
41
|
* @default 0.0
|
|
44
42
|
*/
|
|
45
43
|
taxPercent = 0.0;
|
|
46
44
|
/**
|
|
47
|
-
*
|
|
48
|
-
* Must be a valid MongoDB ObjectId
|
|
45
|
+
* Unique identifier of the user who is creating the chain.
|
|
46
|
+
* Required. Must be a valid MongoDB ObjectId.
|
|
49
47
|
*
|
|
50
48
|
* @example "507f1f77bcf86cd799439011"
|
|
51
49
|
*/
|
|
@@ -53,23 +51,27 @@ export class CreateChainDto {
|
|
|
53
51
|
}
|
|
54
52
|
__decorate([
|
|
55
53
|
IsString(),
|
|
54
|
+
IsNotEmpty({ message: "Chain name is required" }),
|
|
55
|
+
MinLength(3),
|
|
56
56
|
__metadata("design:type", String)
|
|
57
57
|
], CreateChainDto.prototype, "name", void 0);
|
|
58
58
|
__decorate([
|
|
59
59
|
IsOptional(),
|
|
60
|
-
|
|
60
|
+
IsIn(CURRENCIES, { message: "Currency must be a valid currency code" }),
|
|
61
61
|
__metadata("design:type", String)
|
|
62
62
|
], CreateChainDto.prototype, "currency", void 0);
|
|
63
63
|
__decorate([
|
|
64
64
|
IsOptional(),
|
|
65
|
-
IsNumber({}, { message:
|
|
66
|
-
Min(0, { message:
|
|
67
|
-
Max(100, { message:
|
|
65
|
+
IsNumber({}, { message: "Tax percentage must be a number" }),
|
|
66
|
+
Min(0, { message: "Tax percentage must be at least 0" }),
|
|
67
|
+
Max(100, { message: "Tax percentage must be at most 100" }),
|
|
68
68
|
__metadata("design:type", Number)
|
|
69
69
|
], CreateChainDto.prototype, "taxPercent", void 0);
|
|
70
70
|
__decorate([
|
|
71
|
-
IsOptional(),
|
|
72
71
|
IsString(),
|
|
73
|
-
IsMongoId(),
|
|
72
|
+
IsMongoId({ message: "createdBy must be a valid MongoDB ObjectId" }),
|
|
73
|
+
IsNotEmpty({
|
|
74
|
+
message: "createdBy is required and must be a valid MongoDB ObjectId",
|
|
75
|
+
}),
|
|
74
76
|
__metadata("design:type", String)
|
|
75
77
|
], CreateChainDto.prototype, "createdBy", void 0);
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
* DTO for deleting a chain.
|
|
3
3
|
*
|
|
4
4
|
* Used by the Products microservice to soft-delete chains.
|
|
5
|
-
*
|
|
5
|
+
* Holds the chain unique identifier and the user who performed the deletion.
|
|
6
6
|
*
|
|
7
7
|
* @since 2.0.0
|
|
8
8
|
*/
|
|
9
9
|
export declare class DeleteChainDto {
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* Must be a valid UUID.
|
|
11
|
+
* Unique identifier of the chain to delete.
|
|
12
|
+
* Required. Must be a valid UUID format.
|
|
13
13
|
*
|
|
14
14
|
* @example "550e8400-e29b-41d4-a716-446655440000"
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
chainId: string;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
* Must be a valid MongoDB ObjectId.
|
|
18
|
+
* Unique identifier of the user performing the deletion.
|
|
19
|
+
* Required. Must be a valid MongoDB ObjectId.
|
|
20
20
|
*
|
|
21
21
|
* @example "507f1f77bcf86cd799439011"
|
|
22
22
|
*/
|
|
@@ -7,26 +7,26 @@ 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
|
|
10
|
+
import { IsString, IsMongoId, IsUUID, IsNotEmpty } from "class-validator";
|
|
11
11
|
/**
|
|
12
12
|
* DTO for deleting a chain.
|
|
13
13
|
*
|
|
14
14
|
* Used by the Products microservice to soft-delete chains.
|
|
15
|
-
*
|
|
15
|
+
* Holds the chain unique identifier and the user who performed the deletion.
|
|
16
16
|
*
|
|
17
17
|
* @since 2.0.0
|
|
18
18
|
*/
|
|
19
19
|
export class DeleteChainDto {
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
* Must be a valid UUID.
|
|
21
|
+
* Unique identifier of the chain to delete.
|
|
22
|
+
* Required. Must be a valid UUID format.
|
|
23
23
|
*
|
|
24
24
|
* @example "550e8400-e29b-41d4-a716-446655440000"
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
chainId;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
* Must be a valid MongoDB ObjectId.
|
|
28
|
+
* Unique identifier of the user performing the deletion.
|
|
29
|
+
* Required. Must be a valid MongoDB ObjectId.
|
|
30
30
|
*
|
|
31
31
|
* @example "507f1f77bcf86cd799439011"
|
|
32
32
|
*/
|
|
@@ -35,10 +35,12 @@ export class DeleteChainDto {
|
|
|
35
35
|
__decorate([
|
|
36
36
|
IsString(),
|
|
37
37
|
IsUUID(),
|
|
38
|
+
IsNotEmpty({ message: 'chainId is required and must be a valid UUID.' }),
|
|
38
39
|
__metadata("design:type", String)
|
|
39
|
-
], DeleteChainDto.prototype, "
|
|
40
|
+
], DeleteChainDto.prototype, "chainId", void 0);
|
|
40
41
|
__decorate([
|
|
41
42
|
IsString(),
|
|
42
|
-
IsMongoId(),
|
|
43
|
+
IsMongoId({ message: 'deletedBy must be a valid MongoDB ObjectId.' }),
|
|
44
|
+
IsNotEmpty({ message: 'deletedBy is required and must be a valid MongoDB ObjectId.' }),
|
|
43
45
|
__metadata("design:type", String)
|
|
44
46
|
], DeleteChainDto.prototype, "deletedBy", void 0);
|
|
@@ -1,50 +1,60 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type CurrencyCode } from "../../types/currency.type.js";
|
|
2
2
|
/**
|
|
3
3
|
* DTO for updating an existing chain.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Provides structure and validation for payloads to update a chain (restaurant brand)
|
|
6
|
+
* in the system. All fields related to chain details are optional to allow partial updates,
|
|
7
|
+
* but identifiers (chainId, updatedBy) are required for correct auditing and entity targeting.
|
|
8
|
+
*
|
|
9
|
+
* Used by the Products microservice to apply modifications to the properties of an existing chain.
|
|
7
10
|
*
|
|
8
11
|
* @since 2.0.0
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* {
|
|
15
|
+
* "chainId": "550e8400-e29b-41d4-a716-446655440000",
|
|
16
|
+
* "name": "McDonald's",
|
|
17
|
+
* "currency": "PEN",
|
|
18
|
+
* "taxPercent": 8.5,
|
|
19
|
+
* "updatedBy": "507f1f77bcf86cd799439011"
|
|
20
|
+
* }
|
|
9
21
|
*/
|
|
10
22
|
export declare class UpdateChainDto {
|
|
11
23
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
24
|
+
* The name of the chain (brand).
|
|
25
|
+
* Optional. If provided, must have at least 3 characters.
|
|
14
26
|
*
|
|
15
27
|
* @example "McDonald's"
|
|
16
28
|
*/
|
|
17
29
|
name?: string;
|
|
18
30
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* Defaults to PEN if not provided.
|
|
31
|
+
* The currency code for the chain.
|
|
32
|
+
* Optional. If provided, must be one of the supported currency codes (see CurrencyCode type).
|
|
22
33
|
*
|
|
23
|
-
* @example
|
|
24
|
-
* @default
|
|
34
|
+
* @example "PEN"
|
|
35
|
+
* @default "PEN"
|
|
25
36
|
*/
|
|
26
|
-
currency?:
|
|
37
|
+
currency?: CurrencyCode;
|
|
27
38
|
/**
|
|
28
|
-
* Global tax percentage
|
|
29
|
-
* Must be between 0 and 100 if provided.
|
|
30
|
-
* Defaults to 0 if not provided.
|
|
39
|
+
* Global tax percentage applied across the chain.
|
|
40
|
+
* Optional. Must be a number between 0 and 100 if provided.
|
|
31
41
|
*
|
|
32
42
|
* @example 8.5
|
|
33
43
|
* @default 0.0
|
|
34
44
|
*/
|
|
35
45
|
taxPercent?: number;
|
|
36
46
|
/**
|
|
37
|
-
*
|
|
38
|
-
* Must be a valid UUID.
|
|
47
|
+
* Unique identifier of the chain to update.
|
|
48
|
+
* Required. Must be a valid UUID string.
|
|
39
49
|
*
|
|
40
50
|
* @example "550e8400-e29b-41d4-a716-446655440000"
|
|
41
51
|
*/
|
|
42
|
-
|
|
52
|
+
chainId: string;
|
|
43
53
|
/**
|
|
44
|
-
*
|
|
45
|
-
* Must be a valid MongoDB ObjectId
|
|
54
|
+
* Unique identifier of the user performing the update.
|
|
55
|
+
* Required. Must be a valid MongoDB ObjectId.
|
|
46
56
|
*
|
|
47
57
|
* @example "507f1f77bcf86cd799439011"
|
|
48
58
|
*/
|
|
49
|
-
updatedBy
|
|
59
|
+
updatedBy: string;
|
|
50
60
|
}
|