@escapenavigator/types 1.6.93 → 1.6.95

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.
@@ -16,24 +16,24 @@ const class_validator_1 = require("class-validator");
16
16
  const ins_minor_1 = require("../../shared/ins-minor");
17
17
  const is_not_blank_1 = require("../../shared/is-not-blank");
18
18
  const is_uniq_email_1 = require("../../shared/is-uniq-email");
19
- class Child {
19
+ class Minor {
20
20
  }
21
21
  __decorate([
22
22
  (0, is_not_blank_1.IsNotBlank)(),
23
23
  (0, class_transformer_1.Expose)(),
24
24
  __metadata("design:type", String)
25
- ], Child.prototype, "name", void 0);
25
+ ], Minor.prototype, "name", void 0);
26
26
  __decorate([
27
27
  (0, is_not_blank_1.IsNotBlank)(),
28
28
  (0, class_transformer_1.Expose)(),
29
29
  __metadata("design:type", String)
30
- ], Child.prototype, "surname", void 0);
30
+ ], Minor.prototype, "surname", void 0);
31
31
  __decorate([
32
32
  (0, is_not_blank_1.IsNotBlank)(),
33
33
  (0, ins_minor_1.IsMinor)(),
34
34
  (0, class_transformer_1.Expose)(),
35
35
  __metadata("design:type", String)
36
- ], Child.prototype, "birthday", void 0);
36
+ ], Minor.prototype, "birthday", void 0);
37
37
  class SignOrderDTO {
38
38
  }
39
39
  __decorate([
@@ -69,31 +69,51 @@ __decorate([
69
69
  __metadata("design:type", Boolean)
70
70
  ], SignOrderDTO.prototype, "isParticipant", void 0);
71
71
  __decorate([
72
+ (0, class_validator_1.IsOptional)(),
73
+ (0, class_transformer_1.Expose)(),
74
+ __metadata("design:type", Number)
75
+ ], SignOrderDTO.prototype, "existingParticipantId", void 0);
76
+ __decorate([
77
+ (0, class_validator_1.ValidateIf)(({ existingParticipantId }) => !existingParticipantId),
72
78
  (0, is_not_blank_1.IsNotBlank)(),
73
79
  (0, class_transformer_1.Expose)(),
74
80
  __metadata("design:type", String)
75
81
  ], SignOrderDTO.prototype, "name", void 0);
76
82
  __decorate([
83
+ (0, class_validator_1.ValidateIf)(({ existingParticipantId }) => !existingParticipantId),
77
84
  (0, is_not_blank_1.IsNotBlank)(),
78
85
  (0, class_transformer_1.Expose)(),
79
86
  __metadata("design:type", String)
80
87
  ], SignOrderDTO.prototype, "surname", void 0);
81
88
  __decorate([
89
+ (0, class_validator_1.IsBoolean)(),
90
+ (0, class_transformer_1.Transform)(({ value }) => value !== null && value !== void 0 ? value : false),
91
+ (0, class_transformer_1.Expose)(),
92
+ __metadata("design:type", Boolean)
93
+ ], SignOrderDTO.prototype, "sendAds", void 0);
94
+ __decorate([
95
+ (0, class_validator_1.ValidateIf)(({ existingParticipantId }) => !existingParticipantId),
82
96
  (0, class_validator_1.IsEmail)(),
83
97
  (0, is_uniq_email_1.IsEmailUnique)(),
84
98
  (0, class_transformer_1.Expose)(),
85
99
  __metadata("design:type", String)
86
100
  ], SignOrderDTO.prototype, "email", void 0);
87
101
  __decorate([
102
+ (0, class_validator_1.ValidateIf)(({ existingParticipantId }) => !existingParticipantId),
88
103
  (0, is_not_blank_1.IsNotBlank)(),
89
104
  (0, class_transformer_1.Expose)(),
90
105
  __metadata("design:type", String)
91
106
  ], SignOrderDTO.prototype, "phone", void 0);
107
+ __decorate([
108
+ (0, class_validator_1.IsArray)(),
109
+ (0, class_transformer_1.Expose)(),
110
+ __metadata("design:type", Array)
111
+ ], SignOrderDTO.prototype, "existingChilds", void 0);
92
112
  __decorate([
93
113
  (0, class_validator_1.IsArray)(),
94
114
  (0, class_transformer_1.Expose)(),
95
115
  (0, class_validator_1.ValidateNested)(),
96
- (0, class_transformer_1.Type)(() => Child),
116
+ (0, class_transformer_1.Type)(() => Minor),
97
117
  __metadata("design:type", Array)
98
- ], SignOrderDTO.prototype, "children", void 0);
118
+ ], SignOrderDTO.prototype, "childs", void 0);
99
119
  exports.SignOrderDTO = SignOrderDTO;
@@ -22,9 +22,8 @@ function IsMinor(validationOptions) {
22
22
  const age = today.getFullYear() - birthday.getFullYear();
23
23
  const monthDifference = today.getMonth() - birthday.getMonth();
24
24
  const dayDifference = today.getDate() - birthday.getDate();
25
- if (monthDifference < 0 ||
26
- (monthDifference === 0 && dayDifference < 0)) {
27
- return age - 1 >= 18;
25
+ if (monthDifference < 0 || (monthDifference === 0 && dayDifference < 0)) {
26
+ return age - 1 < 18;
28
27
  }
29
28
  return age < 18;
30
29
  },