@merkaly/api 0.2.5-4 → 0.2.5-5

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.
@@ -1,5 +1,7 @@
1
1
  import { PropertyEntity } from '../../properties/property.entity';
2
+ import { ProductVariantValidator } from "../validators/variant.validator";
2
3
  export declare class VariantEntity {
4
+ active?: boolean;
3
5
  title?: string;
4
6
  price?: number;
5
7
  stock?: number;
@@ -7,4 +9,5 @@ export declare class VariantEntity {
7
9
  property: PropertyEntity;
8
10
  value: string;
9
11
  }[];
12
+ static validatorToEntity?(validator: ProductVariantValidator): VariantEntity;
10
13
  }
@@ -154,7 +154,7 @@ var UpdateProductValidator = (function () {
154
154
  stock: variant.stock,
155
155
  title: variant.title,
156
156
  combinations: variant.combinations.map(function (combination) { return ({
157
- property: combination.property._id,
157
+ property: combination.property,
158
158
  value: combination.value
159
159
  }); }),
160
160
  }); });
@@ -1,4 +1,5 @@
1
1
  export declare class ProductVariantValidator {
2
+ active?: boolean;
2
3
  title?: string;
3
4
  stock?: number;
4
5
  price?: number;
@@ -11,9 +11,15 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ProductVariantValidator = void 0;
13
13
  var class_validator_1 = require("class-validator");
14
+ var class_transformer_1 = require("class-transformer");
14
15
  var ProductVariantValidator = (function () {
15
16
  function ProductVariantValidator() {
16
17
  }
18
+ __decorate([
19
+ (0, class_validator_1.IsBoolean)(),
20
+ (0, class_validator_1.IsOptional)(),
21
+ __metadata("design:type", Boolean)
22
+ ], ProductVariantValidator.prototype, "active", void 0);
17
23
  __decorate([
18
24
  (0, class_validator_1.IsString)(),
19
25
  (0, class_validator_1.IsOptional)(),
@@ -22,6 +28,10 @@ var ProductVariantValidator = (function () {
22
28
  __decorate([
23
29
  (0, class_validator_1.IsNumber)(),
24
30
  (0, class_validator_1.IsOptional)(),
31
+ (0, class_transformer_1.Transform)(function (_a) {
32
+ var value = _a.value;
33
+ return Number.isFinite(value) ? value : null;
34
+ }),
25
35
  __metadata("design:type", Number)
26
36
  ], ProductVariantValidator.prototype, "stock", void 0);
27
37
  __decorate([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@merkaly/api",
3
- "version": "0.2.5-4",
3
+ "version": "0.2.5-5",
4
4
  "description": "NestJS Backend ApiRest Service",
5
5
  "repository": {
6
6
  "type": "git",