@escapenavigator/types 2.1.29 → 2.1.30
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.
|
@@ -14,6 +14,16 @@ const class_transformer_1 = require("class-transformer");
|
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
15
|
const languages_enum_1 = require("../shared/enum/languages.enum");
|
|
16
16
|
const order_status_enum_1 = require("./enum/order-status.enum");
|
|
17
|
+
/**
|
|
18
|
+
* Таблица CRM хранит фильтры в URL с `arrayFormat: 'comma'`, и одиночный
|
|
19
|
+
* выбор восстанавливается скаляром (`?questroomsIds=5` → `5`). Без этого
|
|
20
|
+
* `/orders/count` отвечал 400 «must be an array» (ESCAPE-NAVIGATOR-APP-12).
|
|
21
|
+
*/
|
|
22
|
+
const toArray = (value) => {
|
|
23
|
+
if (value === undefined || value === null || value === '')
|
|
24
|
+
return undefined;
|
|
25
|
+
return typeof value === 'string' || typeof value === 'number' ? [value] : value;
|
|
26
|
+
};
|
|
17
27
|
class QueryOrderDto {
|
|
18
28
|
}
|
|
19
29
|
exports.QueryOrderDto = QueryOrderDto;
|
|
@@ -86,12 +96,14 @@ __decorate([
|
|
|
86
96
|
], QueryOrderDto.prototype, "players", void 0);
|
|
87
97
|
__decorate([
|
|
88
98
|
(0, class_validator_1.IsOptional)(),
|
|
99
|
+
(0, class_transformer_1.Transform)(({ value }) => toArray(value)),
|
|
89
100
|
(0, class_validator_1.IsArray)(),
|
|
90
101
|
(0, class_transformer_1.Expose)(),
|
|
91
102
|
__metadata("design:type", Array)
|
|
92
103
|
], QueryOrderDto.prototype, "questroomsIds", void 0);
|
|
93
104
|
__decorate([
|
|
94
105
|
(0, class_validator_1.IsOptional)(),
|
|
106
|
+
(0, class_transformer_1.Transform)(({ value }) => toArray(value)),
|
|
95
107
|
(0, class_validator_1.IsArray)(),
|
|
96
108
|
(0, class_transformer_1.Expose)(),
|
|
97
109
|
__metadata("design:type", Array)
|
|
@@ -103,6 +115,7 @@ __decorate([
|
|
|
103
115
|
], QueryOrderDto.prototype, "orderStatus", void 0);
|
|
104
116
|
__decorate([
|
|
105
117
|
(0, class_validator_1.IsOptional)(),
|
|
118
|
+
(0, class_transformer_1.Transform)(({ value }) => toArray(value)),
|
|
106
119
|
(0, class_validator_1.IsArray)(),
|
|
107
120
|
(0, class_transformer_1.Expose)(),
|
|
108
121
|
__metadata("design:type", Array)
|