@merkaly/api 0.17.0 → 0.18.0

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.
@@ -4,6 +4,7 @@ import { CatalogProductEntity } from '../product';
4
4
  export declare class CatalogCategoryEntity extends AbstractEntity {
5
5
  name: string;
6
6
  description?: string;
7
+ icon?: string;
7
8
  parent?: CatalogCategoryEntity;
8
9
  readonly children?: CatalogCategoryEntity[];
9
10
  readonly products?: CatalogProductEntity[];
@@ -3,6 +3,8 @@ import type { CatalogCategoryEntity } from './category.entity.js';
3
3
  export declare class CreateCategoryRequestValidator extends AbstractRequestValidator {
4
4
  name: string;
5
5
  description?: string;
6
+ icon?: string;
7
+ parent?: string | null;
6
8
  constructor(category?: CatalogCategoryEntity);
7
9
  }
8
10
  export declare class UpdateCategoryRequestValidator extends CreateCategoryRequestValidator {
@@ -13,6 +13,8 @@ import * as abstract_validator_1 from '../../../abstract.validator.js';
13
13
  export class CreateCategoryRequestValidator extends abstract_validator_1.AbstractRequestValidator {
14
14
  name;
15
15
  description;
16
+ icon;
17
+ parent;
16
18
  constructor(category) {
17
19
  super();
18
20
  if (!category) {
@@ -20,6 +22,8 @@ export class CreateCategoryRequestValidator extends abstract_validator_1.Abstrac
20
22
  }
21
23
  this.name = category.name;
22
24
  this.description = category.description;
25
+ this.icon = category.icon;
26
+ this.parent = category.parent ? String(category.parent._id ?? category.parent) : null;
23
27
  }
24
28
  }
25
29
  __decorate([
@@ -34,6 +38,18 @@ __decorate([
34
38
  (0, class_validator_1.IsOptional)(),
35
39
  __metadata("design:type", String)
36
40
  ], CreateCategoryRequestValidator.prototype, "description", void 0);
41
+ __decorate([
42
+ (0, class_validator_1.IsString)(),
43
+ (0, class_validator_1.Length)(1, 40),
44
+ (0, class_validator_1.Matches)(/^[a-z0-9-]+$/),
45
+ (0, class_validator_1.IsOptional)(),
46
+ __metadata("design:type", String)
47
+ ], CreateCategoryRequestValidator.prototype, "icon", void 0);
48
+ __decorate([
49
+ (0, class_validator_1.IsMongoId)(),
50
+ (0, class_validator_1.IsOptional)(),
51
+ __metadata("design:type", String)
52
+ ], CreateCategoryRequestValidator.prototype, "parent", void 0);
37
53
  export class UpdateCategoryRequestValidator extends CreateCategoryRequestValidator {
38
54
  }
39
55
  __decorate([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@merkaly/api",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "type": "module",
5
5
  "description": "Shared TypeScript interfaces and enums for Merkaly API",
6
6
  "repository": {