sigo-entities 1.2.465 → 1.2.466

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/index.js CHANGED
@@ -49285,6 +49285,35 @@ var itemsCanalizacion = [
49285
49285
  "47112939",
49286
49286
  "40266013"
49287
49287
  ];
49288
+ function IsValidCantidad(itemsCanalizacion2, validationOptions) {
49289
+ return function(object, propertyName) {
49290
+ (0, import_class_validator772.registerDecorator)({
49291
+ name: "isValidCantidad",
49292
+ target: object.constructor,
49293
+ propertyName,
49294
+ constraints: [itemsCanalizacion2],
49295
+ options: validationOptions,
49296
+ validator: {
49297
+ validate(value, args) {
49298
+ const [items] = args.constraints;
49299
+ const dto = args.object;
49300
+ if (items.includes(dto.codigo)) {
49301
+ return value >= 1;
49302
+ }
49303
+ return value === 1;
49304
+ },
49305
+ defaultMessage(args) {
49306
+ const [items] = args.constraints;
49307
+ const dto = args.object;
49308
+ if (items.includes(dto.codigo)) {
49309
+ return "La cantidad m\xEDnima es 1";
49310
+ }
49311
+ return "La cantidad debe ser exactamente 1";
49312
+ }
49313
+ }
49314
+ });
49315
+ };
49316
+ }
49288
49317
  var MaterialesAltasNVTDTO = class {
49289
49318
  codigo = "";
49290
49319
  descripcion = "";
@@ -49307,10 +49336,7 @@ __decorateClass([
49307
49336
  (0, import_class_validator772.IsDefined)({ message: "El campo quantity es obligatorio" }),
49308
49337
  (0, import_class_transformer795.Type)(() => Number),
49309
49338
  (0, import_class_validator772.IsNumber)(),
49310
- (0, import_class_validator772.ValidateIf)((o) => itemsCanalizacion.includes(o.codigo)),
49311
- (0, import_class_validator772.Min)(1, { message: "La cantidad m\xEDnima es 1" }),
49312
- (0, import_class_validator772.ValidateIf)((o) => !itemsCanalizacion.includes(o.codigo)),
49313
- (0, import_class_validator772.Equals)(1, { message: "La cantidad debe ser exactamente 1" })
49339
+ IsValidCantidad(itemsCanalizacion)
49314
49340
  ], MaterialesAltasNVTDTO.prototype, "cantidad", 2);
49315
49341
  __decorateClass([
49316
49342
  (0, import_class_transformer795.Expose)(),
package/dist/index.mjs CHANGED
@@ -48718,12 +48718,41 @@ __decorateClass([
48718
48718
 
48719
48719
  // src/operativa/procesos/altas_nvt_order/shared/dto/materiales-altas-nvt-dto.ts
48720
48720
  import { Expose as Expose768, Type as Type477 } from "class-transformer";
48721
- import { IsDefined as IsDefined263, IsString as IsString636, IsNumber as IsNumber506, Min as Min342, ValidateIf as ValidateIf7, Equals } from "class-validator";
48721
+ import { IsDefined as IsDefined263, IsString as IsString636, IsNumber as IsNumber506, registerDecorator } from "class-validator";
48722
48722
  var itemsCanalizacion = [
48723
48723
  "40261082",
48724
48724
  "47112939",
48725
48725
  "40266013"
48726
48726
  ];
48727
+ function IsValidCantidad(itemsCanalizacion2, validationOptions) {
48728
+ return function(object, propertyName) {
48729
+ registerDecorator({
48730
+ name: "isValidCantidad",
48731
+ target: object.constructor,
48732
+ propertyName,
48733
+ constraints: [itemsCanalizacion2],
48734
+ options: validationOptions,
48735
+ validator: {
48736
+ validate(value, args) {
48737
+ const [items] = args.constraints;
48738
+ const dto = args.object;
48739
+ if (items.includes(dto.codigo)) {
48740
+ return value >= 1;
48741
+ }
48742
+ return value === 1;
48743
+ },
48744
+ defaultMessage(args) {
48745
+ const [items] = args.constraints;
48746
+ const dto = args.object;
48747
+ if (items.includes(dto.codigo)) {
48748
+ return "La cantidad m\xEDnima es 1";
48749
+ }
48750
+ return "La cantidad debe ser exactamente 1";
48751
+ }
48752
+ }
48753
+ });
48754
+ };
48755
+ }
48727
48756
  var MaterialesAltasNVTDTO = class {
48728
48757
  codigo = "";
48729
48758
  descripcion = "";
@@ -48746,10 +48775,7 @@ __decorateClass([
48746
48775
  IsDefined263({ message: "El campo quantity es obligatorio" }),
48747
48776
  Type477(() => Number),
48748
48777
  IsNumber506(),
48749
- ValidateIf7((o) => itemsCanalizacion.includes(o.codigo)),
48750
- Min342(1, { message: "La cantidad m\xEDnima es 1" }),
48751
- ValidateIf7((o) => !itemsCanalizacion.includes(o.codigo)),
48752
- Equals(1, { message: "La cantidad debe ser exactamente 1" })
48778
+ IsValidCantidad(itemsCanalizacion)
48753
48779
  ], MaterialesAltasNVTDTO.prototype, "cantidad", 2);
48754
48780
  __decorateClass([
48755
48781
  Expose768(),
@@ -49043,7 +49069,7 @@ __decorateClass([
49043
49069
  ], BitacoraAltasNVTDTO.prototype, "usuario", 2);
49044
49070
 
49045
49071
  // src/operativa/procesos/altas_nvt_order/shared/dto/mo-altas-nvt-dto.ts
49046
- import { IsDefined as IsDefined270, IsNotEmpty as IsNotEmpty461, IsNumber as IsNumber510, IsString as IsString642, Min as Min343 } from "class-validator";
49072
+ import { IsDefined as IsDefined270, IsNotEmpty as IsNotEmpty461, IsNumber as IsNumber510, IsString as IsString642, Min as Min342 } from "class-validator";
49047
49073
  import { Expose as Expose776, Type as Type480 } from "class-transformer";
49048
49074
  var MOAltasNVTDTO = class {
49049
49075
  code;
@@ -49067,14 +49093,14 @@ __decorateClass([
49067
49093
  Expose776(),
49068
49094
  IsDefined270(),
49069
49095
  IsNumber510(),
49070
- Min343(0),
49096
+ Min342(0),
49071
49097
  Type480(() => Number)
49072
49098
  ], MOAltasNVTDTO.prototype, "price", 2);
49073
49099
  __decorateClass([
49074
49100
  Expose776(),
49075
49101
  IsDefined270(),
49076
49102
  IsNumber510(),
49077
- Min343(0),
49103
+ Min342(0),
49078
49104
  Type480(() => Number)
49079
49105
  ], MOAltasNVTDTO.prototype, "quantity", 2);
49080
49106
 
@@ -50338,7 +50364,7 @@ import {
50338
50364
  IsNumber as IsNumber514,
50339
50365
  IsDate as IsDate185,
50340
50366
  IsEnum as IsEnum50,
50341
- Min as Min344
50367
+ Min as Min343
50342
50368
  } from "class-validator";
50343
50369
  import "reflect-metadata";
50344
50370
  var UbicacionBantelDTO = class {
@@ -50438,7 +50464,7 @@ __decorateClass([
50438
50464
  IsDefined274({ message: "El campo quantity es obligatorio" }),
50439
50465
  Type484(() => Number),
50440
50466
  IsNumber514(),
50441
- Min344(1, { message: "La cantidad minima es $constraint1" })
50467
+ Min343(1, { message: "La cantidad minima es $constraint1" })
50442
50468
  ], MaterialesBantelDTO.prototype, "cantidad", 2);
50443
50469
  __decorateClass([
50444
50470
  Expose782(),
@@ -51547,7 +51573,7 @@ __decorateClass([
51547
51573
 
51548
51574
  // src/operativa/procesos/claro_peru9112/shared/dto/materiales-peru9112-claro-dto.ts
51549
51575
  import { Expose as Expose790, Type as Type487 } from "class-transformer";
51550
- import { IsDefined as IsDefined280, IsString as IsString656, IsNumber as IsNumber519, Min as Min345, IsEnum as IsEnum53 } from "class-validator";
51576
+ import { IsDefined as IsDefined280, IsString as IsString656, IsNumber as IsNumber519, Min as Min344, IsEnum as IsEnum53 } from "class-validator";
51551
51577
  import "reflect-metadata";
51552
51578
  var MaterialesPeru9112ClaroDTO = class {
51553
51579
  codigo = "";
@@ -51572,7 +51598,7 @@ __decorateClass([
51572
51598
  IsDefined280({ message: "El campo quantity es obligatorio" }),
51573
51599
  Type487(() => Number),
51574
51600
  IsNumber519(),
51575
- Min345(1, { message: "La cantidad minima es $constraint1" })
51601
+ Min344(1, { message: "La cantidad minima es $constraint1" })
51576
51602
  ], MaterialesPeru9112ClaroDTO.prototype, "cantidad", 2);
51577
51603
  __decorateClass([
51578
51604
  Expose790(),
@@ -52207,7 +52233,7 @@ import { IsDefined as IsDefined288, IsEnum as IsEnum56, IsObject as IsObject15,
52207
52233
  import { Expose as Expose800, Type as Type490 } from "class-transformer";
52208
52234
 
52209
52235
  // src/v2/dtos/AuthUser.ts
52210
- import { IsBoolean as IsBoolean68, IsDefined as IsDefined286, IsEmail as IsEmail6, IsString as IsString662, IsUUID as IsUUID23, ValidateIf as ValidateIf8 } from "class-validator";
52236
+ import { IsBoolean as IsBoolean68, IsDefined as IsDefined286, IsEmail as IsEmail6, IsString as IsString662, IsUUID as IsUUID23, ValidateIf as ValidateIf7 } from "class-validator";
52211
52237
  import { Expose as Expose798, Transform as Transform114 } from "class-transformer";
52212
52238
  var AuthUserDto = class {
52213
52239
  email;
@@ -52255,7 +52281,7 @@ __decorateClass([
52255
52281
  ], AuthUserDto.prototype, "root", 2);
52256
52282
  __decorateClass([
52257
52283
  IsDefined286({ message: "El campo Perfil es obligatorio" }),
52258
- ValidateIf8((_, value) => value !== ""),
52284
+ ValidateIf7((_, value) => value !== ""),
52259
52285
  IsUUID23("4", { message: "El campo Perfil debe ser un UUID v4 v\xE1lido." }),
52260
52286
  Expose798()
52261
52287
  ], AuthUserDto.prototype, "profileId", 2);
@@ -52548,7 +52574,7 @@ __decorateClass([
52548
52574
  ], CompanyDto.prototype, "countryId", 2);
52549
52575
 
52550
52576
  // src/v2/dtos/UpdateUser.ts
52551
- import { IsDefined as IsDefined295, IsUUID as IsUUID29, ValidateIf as ValidateIf9 } from "class-validator";
52577
+ import { IsDefined as IsDefined295, IsUUID as IsUUID29, ValidateIf as ValidateIf8 } from "class-validator";
52552
52578
  import { Expose as Expose808 } from "class-transformer";
52553
52579
  var UpdateUserDto = class {
52554
52580
  _id;
@@ -52561,7 +52587,7 @@ __decorateClass([
52561
52587
  ], UpdateUserDto.prototype, "_id", 2);
52562
52588
  __decorateClass([
52563
52589
  IsDefined295({ message: "El campo Perfil es obligatorio" }),
52564
- ValidateIf9((_, value) => value !== ""),
52590
+ ValidateIf8((_, value) => value !== ""),
52565
52591
  IsUUID29("4", { message: "El campo Perfil debe ser un UUID v4 v\xE1lido." }),
52566
52592
  Expose808()
52567
52593
  ], UpdateUserDto.prototype, "profileId", 2);
@@ -52576,7 +52602,7 @@ import {
52576
52602
  IsNotEmpty as IsNotEmpty465,
52577
52603
  IsNumber as IsNumber523,
52578
52604
  IsString as IsString670,
52579
- Min as Min346,
52605
+ Min as Min345,
52580
52606
  ValidateNested as ValidateNested426
52581
52607
  } from "class-validator";
52582
52608
 
@@ -52631,13 +52657,13 @@ __decorateClass([
52631
52657
  __decorateClass([
52632
52658
  IsDefined296({ message: "El n\xFAmero m\xEDnimo de archivos es requerido" }),
52633
52659
  IsNumber523({}, { message: "El n\xFAmero m\xEDnimo de archivos debe ser un n\xFAmero" }),
52634
- Min346(0, { message: "El n\xFAmero m\xEDnimo de archivos debe ser mayor o igual a $constraint1" }),
52660
+ Min345(0, { message: "El n\xFAmero m\xEDnimo de archivos debe ser mayor o igual a $constraint1" }),
52635
52661
  Expose809()
52636
52662
  ], _DocumentRequirementDto.prototype, "minFiles", 2);
52637
52663
  __decorateClass([
52638
52664
  IsDefined296({ message: "El n\xFAmero m\xE1ximo de archivos es requerido" }),
52639
52665
  IsNumber523({}, { message: "El n\xFAmero m\xE1ximo de archivos debe ser un n\xFAmero" }),
52640
- Min346(1, { message: "El n\xFAmero m\xE1ximo de archivos debe ser mayor o igual a $constraint1" }),
52666
+ Min345(1, { message: "El n\xFAmero m\xE1ximo de archivos debe ser mayor o igual a $constraint1" }),
52641
52667
  Expose809()
52642
52668
  ], _DocumentRequirementDto.prototype, "maxFiles", 2);
52643
52669
  __decorateClass([
@@ -52648,7 +52674,7 @@ __decorateClass([
52648
52674
  __decorateClass([
52649
52675
  IsDefined296({ message: "El tama\xF1o m\xE1ximo de archivo es requerido" }),
52650
52676
  IsNumber523({}, { message: "El tama\xF1o m\xE1ximo de archivo debe ser un n\xFAmero" }),
52651
- Min346(0, { message: "El tama\xF1o m\xE1ximo de archivo debe ser mayor o igual a $constraint1" }),
52677
+ Min345(0, { message: "El tama\xF1o m\xE1ximo de archivo debe ser mayor o igual a $constraint1" }),
52652
52678
  Expose809()
52653
52679
  ], _DocumentRequirementDto.prototype, "maxFileSize", 2);
52654
52680
  var DocumentRequirementDto = _DocumentRequirementDto;
@@ -52937,7 +52963,7 @@ __decorateClass([
52937
52963
  ], UpdateCompanyDto.prototype, "countryId", 2);
52938
52964
 
52939
52965
  // src/v2/dtos/CreateUser.ts
52940
- import { IsArray as IsArray259, IsBoolean as IsBoolean77, IsDefined as IsDefined304, IsEmail as IsEmail11, IsString as IsString678, IsUUID as IsUUID36, ValidateIf as ValidateIf10, ValidateNested as ValidateNested427 } from "class-validator";
52966
+ import { IsArray as IsArray259, IsBoolean as IsBoolean77, IsDefined as IsDefined304, IsEmail as IsEmail11, IsString as IsString678, IsUUID as IsUUID36, ValidateIf as ValidateIf9, ValidateNested as ValidateNested427 } from "class-validator";
52941
52967
  import { Expose as Expose817, Transform as Transform121, Type as Type494 } from "class-transformer";
52942
52968
 
52943
52969
  // src/v2/dtos/ResourceSystemDto.ts
@@ -53061,7 +53087,7 @@ __decorateClass([
53061
53087
  ], CreateUserDto.prototype, "root", 2);
53062
53088
  __decorateClass([
53063
53089
  IsDefined304({ message: "El campo Perfil es obligatorio" }),
53064
- ValidateIf10((_, value) => value !== ""),
53090
+ ValidateIf9((_, value) => value !== ""),
53065
53091
  IsUUID36("4", { message: "El campo Perfil debe ser un UUID v4 v\xE1lido." }),
53066
53092
  Expose817()
53067
53093
  ], CreateUserDto.prototype, "profileId", 2);
@@ -53460,7 +53486,7 @@ __decorateClass([
53460
53486
  ], DelegationEntity.prototype, "name", 2);
53461
53487
 
53462
53488
  // src/v2/entities/User.ts
53463
- import { IsArray as IsArray262, IsBoolean as IsBoolean79, IsDefined as IsDefined311, IsEmail as IsEmail12, IsString as IsString689, IsUUID as IsUUID41, ValidateIf as ValidateIf11, ValidateNested as ValidateNested433 } from "class-validator";
53489
+ import { IsArray as IsArray262, IsBoolean as IsBoolean79, IsDefined as IsDefined311, IsEmail as IsEmail12, IsString as IsString689, IsUUID as IsUUID41, ValidateIf as ValidateIf10, ValidateNested as ValidateNested433 } from "class-validator";
53464
53490
  import { Expose as Expose829, Transform as Transform122, Type as Type500 } from "class-transformer";
53465
53491
  var UserEntity = class extends BaseEntity {
53466
53492
  email;
@@ -53531,7 +53557,7 @@ __decorateClass([
53531
53557
  ], UserEntity.prototype, "root", 2);
53532
53558
  __decorateClass([
53533
53559
  IsDefined311({ message: "El campo Perfil es obligatorio" }),
53534
- ValidateIf11((_, value) => value !== ""),
53560
+ ValidateIf10((_, value) => value !== ""),
53535
53561
  IsUUID41("4", { message: "El campo Perfil debe ser un UUID v4 v\xE1lido." }),
53536
53562
  Expose829()
53537
53563
  ], UserEntity.prototype, "profileId", 2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigo-entities",
3
- "version": "1.2.465",
3
+ "version": "1.2.466",
4
4
  "description": "Desarrollo de modelos de datos SIGO",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",