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