@merkaly/api 0.2.1-0 → 0.2.1-3

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.
Files changed (41) hide show
  1. package/.output/app.d.ts +41 -22
  2. package/.output/app.js +33 -13
  3. package/.output/config/app.document.js +10 -0
  4. package/.output/config/app.entity.d.ts +8 -0
  5. package/.output/config/app.entity.js +35 -0
  6. package/.output/config/app.validator.d.ts +1 -1
  7. package/.output/src/auth/auth.validator.d.ts +0 -1
  8. package/.output/src/auth/auth.validator.js +8 -1
  9. package/.output/src/inventory/brands/brand.document.js +8 -0
  10. package/.output/src/inventory/brands/brand.entity.d.ts +7 -0
  11. package/.output/src/inventory/brands/brand.entity.js +30 -0
  12. package/.output/src/inventory/brands/brand.validator.d.ts +1 -1
  13. package/.output/src/inventory/brands/brand.validator.js +10 -0
  14. package/.output/src/inventory/categories/category.document.js +8 -0
  15. package/.output/src/inventory/categories/category.entity.d.ts +7 -0
  16. package/.output/src/inventory/categories/category.entity.js +30 -0
  17. package/.output/src/inventory/categories/category.validator.d.ts +1 -2
  18. package/.output/src/inventory/categories/category.validator.js +10 -1
  19. package/.output/src/inventory/media/media.document.js +8 -0
  20. package/.output/src/inventory/media/media.entity.d.ts +7 -0
  21. package/.output/src/inventory/media/media.entity.js +30 -0
  22. package/.output/src/inventory/media/media.validator.d.ts +1 -2
  23. package/.output/src/inventory/media/media.validator.js +8 -1
  24. package/.output/src/inventory/products/product.document.d.ts +1 -0
  25. package/.output/src/inventory/products/product.document.js +16 -0
  26. package/.output/src/inventory/products/product.entity.d.ts +19 -0
  27. package/.output/src/inventory/products/product.entity.js +67 -0
  28. package/.output/src/inventory/products/product.validator.d.ts +2 -3
  29. package/.output/src/inventory/products/product.validator.js +20 -7
  30. package/.output/src/inventory/variants/variant.document.js +10 -0
  31. package/.output/src/inventory/variants/variant.entity.d.ts +11 -0
  32. package/.output/src/inventory/variants/variant.entity.js +44 -0
  33. package/.output/src/inventory/variants/variant.validator.d.ts +0 -1
  34. package/.output/src/inventory/variants/variant.validator.js +14 -12
  35. package/.output/src/store/orders/order.document.js +8 -0
  36. package/.output/src/store/orders/order.entity.d.ts +5 -0
  37. package/.output/src/store/orders/order.entity.js +25 -0
  38. package/.output/src/store/orders/order.validator.d.ts +1 -2
  39. package/.output/src/store/orders/order.validator.js +0 -1
  40. package/index.ts +8 -10
  41. package/package.json +8 -4
package/.output/app.d.ts CHANGED
@@ -1,28 +1,47 @@
1
- export declare namespace Inventory {
2
- const brand: {
3
- document: any;
4
- validators: any;
1
+ import { BrandDocument } from './src/inventory/brands/brand.document';
2
+ import * as BrandValidators from './src/inventory/brands/brand.validator';
3
+ import { CategoryDocument } from './src/inventory/categories/category.document';
4
+ import * as CategoryValidators from './src/inventory/categories/category.validator';
5
+ import { MediaDocument } from './src/inventory/media/media.document';
6
+ import * as MediaValidators from './src/inventory/media/media.validator';
7
+ import { ProductDocument } from './src/inventory/products/product.document';
8
+ import * as ProductValidators from './src/inventory/products/product.validator';
9
+ import { VariantDocument } from './src/inventory/variants/variant.document';
10
+ import * as VariantValidators from './src/inventory/variants/variant.validator';
11
+ import { OrderDocument } from './src/store/orders/order.document';
12
+ import * as OrderValidators from './src/store/orders/order.validator';
13
+ export declare const Inventory: {
14
+ Brand: {
15
+ CreateBrandValidator: typeof BrandValidators.CreateBrandValidator;
16
+ UpdateBrandValidator: typeof BrandValidators.UpdateBrandValidator;
17
+ BrandDocument: typeof BrandDocument;
5
18
  };
6
- const category: {
7
- document: any;
8
- validators: any;
19
+ Category: {
20
+ FindCategoryValidator: typeof CategoryValidators.FindCategoryValidator;
21
+ CreateCategoryValidator: typeof CategoryValidators.CreateCategoryValidator;
22
+ UpdateCategoryValidator: typeof CategoryValidators.UpdateCategoryValidator;
23
+ CategoryDocument: typeof CategoryDocument;
9
24
  };
10
- const product: {
11
- document: any;
12
- validators: any;
25
+ Product: {
26
+ CreateProductValidator: typeof ProductValidators.CreateProductValidator;
27
+ UpdateProductValidator: typeof ProductValidators.UpdateProductValidator;
28
+ ProductDocument: typeof ProductDocument;
13
29
  };
14
- const media: {
15
- document: any;
16
- validators: any;
30
+ Media: {
31
+ CreateMediaValidator: typeof MediaValidators.CreateMediaValidator;
32
+ UpdateMediaValidator: typeof MediaValidators.UpdateMediaValidator;
33
+ MediaDocument: typeof MediaDocument;
17
34
  };
18
- const variant: {
19
- document: any;
20
- validators: any;
35
+ Variant: {
36
+ CreateVariantValidator: typeof VariantValidators.CreateVariantValidator;
37
+ UpdateVariantValidator: typeof VariantValidators.UpdateVariantValidator;
38
+ VariantDocument: typeof VariantDocument;
21
39
  };
22
- }
23
- export declare namespace Store {
24
- const order: {
25
- document: any;
26
- validators: any;
40
+ };
41
+ export declare const Store: {
42
+ Order: {
43
+ CreateOrderValidator: typeof OrderValidators.CreateOrderValidator;
44
+ UpdateOrderValidator: typeof OrderValidators.UpdateOrderValidator;
45
+ OrderDocument: typeof OrderDocument;
27
46
  };
28
- }
47
+ };
package/.output/app.js CHANGED
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.Store = exports.Inventory = void 0;
4
27
  const brand_document_1 = require("./src/inventory/brands/brand.document");
@@ -13,16 +36,13 @@ const variant_document_1 = require("./src/inventory/variants/variant.document");
13
36
  const VariantValidators = __importStar(require("./src/inventory/variants/variant.validator"));
14
37
  const order_document_1 = require("./src/store/orders/order.document");
15
38
  const OrderValidators = __importStar(require("./src/store/orders/order.validator"));
16
- const create = (document, validators) => ({ document, validators });
17
- var Inventory;
18
- (function (Inventory) {
19
- Inventory.brand = create(brand_document_1.BrandDocument, BrandValidators);
20
- Inventory.category = create(category_document_1.CategoryDocument, CategoryValidators);
21
- Inventory.product = create(product_document_1.ProductDocument, ProductValidators);
22
- Inventory.media = create(media_document_1.MediaDocument, MediaValidators);
23
- Inventory.variant = create(variant_document_1.VariantDocument, VariantValidators);
24
- })(Inventory = exports.Inventory || (exports.Inventory = {}));
25
- var Store;
26
- (function (Store) {
27
- Store.order = create(order_document_1.OrderDocument, OrderValidators);
28
- })(Store = exports.Store || (exports.Store = {}));
39
+ exports.Inventory = {
40
+ Brand: { BrandDocument: brand_document_1.BrandDocument, ...BrandValidators },
41
+ Category: { CategoryDocument: category_document_1.CategoryDocument, ...CategoryValidators },
42
+ Product: { ProductDocument: product_document_1.ProductDocument, ...ProductValidators },
43
+ Media: { MediaDocument: media_document_1.MediaDocument, ...MediaValidators },
44
+ Variant: { VariantDocument: variant_document_1.VariantDocument, ...VariantValidators }
45
+ };
46
+ exports.Store = {
47
+ Order: { OrderDocument: order_document_1.OrderDocument, ...OrderValidators }
48
+ };
@@ -1,9 +1,19 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.AppDocument = void 0;
4
10
  const class_transformer_1 = require("class-transformer");
5
11
  const es_mapping_ts_1 = require("es-mapping-ts");
6
12
  class AppDocument {
13
+ $id;
14
+ $createdAt;
15
+ $updatedAt;
16
+ $deletedAt;
7
17
  serialize(entity) {
8
18
  this.$id = entity.id;
9
19
  this.$createdAt = entity.createdAt;
@@ -0,0 +1,8 @@
1
+ import { Id } from '@elastic/elasticsearch/lib/api/types';
2
+ export declare abstract class AppEntity {
3
+ constructor(id?: Id);
4
+ readonly id: Id;
5
+ readonly createdAt: Date;
6
+ readonly updatedAt?: Date;
7
+ readonly deletedAt?: Date;
8
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AppEntity = void 0;
10
+ const typeorm_1 = require("typeorm");
11
+ let AppEntity = class AppEntity {
12
+ constructor(id) {
13
+ this.id = id;
14
+ }
15
+ id;
16
+ createdAt = new Date();
17
+ updatedAt;
18
+ deletedAt;
19
+ };
20
+ __decorate([
21
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid')
22
+ ], AppEntity.prototype, "id", void 0);
23
+ __decorate([
24
+ (0, typeorm_1.CreateDateColumn)({ type: 'datetime', nullable: false })
25
+ ], AppEntity.prototype, "createdAt", void 0);
26
+ __decorate([
27
+ (0, typeorm_1.UpdateDateColumn)({ type: 'datetime', nullable: true })
28
+ ], AppEntity.prototype, "updatedAt", void 0);
29
+ __decorate([
30
+ (0, typeorm_1.DeleteDateColumn)({ type: 'datetime', nullable: true })
31
+ ], AppEntity.prototype, "deletedAt", void 0);
32
+ AppEntity = __decorate([
33
+ (0, typeorm_1.Entity)()
34
+ ], AppEntity);
35
+ exports.AppEntity = AppEntity;
@@ -1,6 +1,6 @@
1
1
  import { SearchRequest } from '@elastic/elasticsearch/lib/api/types';
2
2
  import { AppEntity } from './app.entity';
3
3
  export declare abstract class AppValidator<E extends AppEntity> {
4
- abstract toEntity(...variadic: unknown[]): E;
4
+ abstract toEntity?(...variadic: unknown[]): E;
5
5
  }
6
6
  export declare type SearchQuery = Omit<SearchRequest, 'index' | 'routing'>;
@@ -1,4 +1,3 @@
1
- import 'reflect-metadata';
2
1
  export declare class LoginValidator {
3
2
  username: string;
4
3
  password: string;
@@ -1,9 +1,16 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.LoginValidator = void 0;
4
10
  const class_validator_1 = require("class-validator");
5
- require("reflect-metadata");
6
11
  class LoginValidator {
12
+ username;
13
+ password;
7
14
  }
8
15
  __decorate([
9
16
  (0, class_validator_1.IsEmail)()
@@ -1,9 +1,17 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.BrandDocument = void 0;
4
10
  const es_mapping_ts_1 = require("es-mapping-ts");
5
11
  const app_document_1 = require("../../../config/app.document");
6
12
  let BrandDocument = class BrandDocument extends app_document_1.AppDocument {
13
+ name;
14
+ description;
7
15
  transform(entity) {
8
16
  this.name = entity.name;
9
17
  this.description = entity.description;
@@ -0,0 +1,7 @@
1
+ import { AppEntity } from '../../../config/app.entity';
2
+ import { ProductEntity } from '../products/product.entity';
3
+ export declare class BrandEntity extends AppEntity {
4
+ name: string;
5
+ description: string;
6
+ products: ProductEntity[];
7
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.BrandEntity = void 0;
10
+ const typeorm_1 = require("typeorm");
11
+ const app_entity_1 = require("../../../config/app.entity");
12
+ const product_entity_1 = require("../products/product.entity");
13
+ let BrandEntity = class BrandEntity extends app_entity_1.AppEntity {
14
+ name;
15
+ description;
16
+ products;
17
+ };
18
+ __decorate([
19
+ (0, typeorm_1.Column)({ length: 32, unique: true })
20
+ ], BrandEntity.prototype, "name", void 0);
21
+ __decorate([
22
+ (0, typeorm_1.Column)({ type: 'text', nullable: true })
23
+ ], BrandEntity.prototype, "description", void 0);
24
+ __decorate([
25
+ (0, typeorm_1.OneToMany)(() => product_entity_1.ProductEntity, ({ brand }) => brand)
26
+ ], BrandEntity.prototype, "products", void 0);
27
+ BrandEntity = __decorate([
28
+ (0, typeorm_1.Entity)('inventory_brands')
29
+ ], BrandEntity);
30
+ exports.BrandEntity = BrandEntity;
@@ -3,7 +3,7 @@ import { BrandEntity } from './brand.entity';
3
3
  export declare class CreateBrandValidator extends AppValidator<BrandEntity> {
4
4
  name: string;
5
5
  description?: string;
6
- toEntity(): BrandEntity;
6
+ toEntity?(): BrandEntity;
7
7
  }
8
8
  export declare class UpdateBrandValidator extends AppValidator<BrandEntity> {
9
9
  name?: string;
@@ -1,10 +1,18 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.UpdateBrandValidator = exports.CreateBrandValidator = void 0;
4
10
  const class_validator_1 = require("class-validator");
5
11
  const app_validator_1 = require("../../../config/app.validator");
6
12
  const brand_entity_1 = require("./brand.entity");
7
13
  class CreateBrandValidator extends app_validator_1.AppValidator {
14
+ name;
15
+ description;
8
16
  toEntity() {
9
17
  const entity = new brand_entity_1.BrandEntity();
10
18
  entity.name = this.name;
@@ -22,6 +30,8 @@ __decorate([
22
30
  ], CreateBrandValidator.prototype, "description", void 0);
23
31
  exports.CreateBrandValidator = CreateBrandValidator;
24
32
  class UpdateBrandValidator extends app_validator_1.AppValidator {
33
+ name;
34
+ description;
25
35
  toEntity(entity) {
26
36
  if (this.name) {
27
37
  entity.name = this.name;
@@ -1,9 +1,17 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.CategoryDocument = void 0;
4
10
  const es_mapping_ts_1 = require("es-mapping-ts");
5
11
  const app_document_1 = require("../../../config/app.document");
6
12
  let CategoryDocument = class CategoryDocument extends app_document_1.AppDocument {
13
+ name;
14
+ description;
7
15
  transform(entity) {
8
16
  this.name = entity.name;
9
17
  this.description = entity.description;
@@ -0,0 +1,7 @@
1
+ import { AppEntity } from '../../../config/app.entity';
2
+ import { ProductEntity } from '../products/product.entity';
3
+ export declare class CategoryEntity extends AppEntity {
4
+ name: string;
5
+ description: string;
6
+ products: ProductEntity[];
7
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.CategoryEntity = void 0;
10
+ const typeorm_1 = require("typeorm");
11
+ const app_entity_1 = require("../../../config/app.entity");
12
+ const product_entity_1 = require("../products/product.entity");
13
+ let CategoryEntity = class CategoryEntity extends app_entity_1.AppEntity {
14
+ name;
15
+ description;
16
+ products;
17
+ };
18
+ __decorate([
19
+ (0, typeorm_1.Column)({ length: 32, unique: true })
20
+ ], CategoryEntity.prototype, "name", void 0);
21
+ __decorate([
22
+ (0, typeorm_1.Column)({ type: 'text', nullable: true })
23
+ ], CategoryEntity.prototype, "description", void 0);
24
+ __decorate([
25
+ (0, typeorm_1.OneToMany)(() => product_entity_1.ProductEntity, ({ category }) => category)
26
+ ], CategoryEntity.prototype, "products", void 0);
27
+ CategoryEntity = __decorate([
28
+ (0, typeorm_1.Entity)('inventory_categories')
29
+ ], CategoryEntity);
30
+ exports.CategoryEntity = CategoryEntity;
@@ -1,4 +1,3 @@
1
- import 'reflect-metadata';
2
1
  import { AppValidator } from '../../../config/app.validator';
3
2
  import { CategoryEntity } from './category.entity';
4
3
  export declare class FindCategoryValidator {
@@ -6,7 +5,7 @@ export declare class FindCategoryValidator {
6
5
  export declare class CreateCategoryValidator extends AppValidator<CategoryEntity> {
7
6
  name: string;
8
7
  description?: string;
9
- toEntity(): CategoryEntity;
8
+ toEntity?(): CategoryEntity;
10
9
  }
11
10
  export declare class UpdateCategoryValidator extends AppValidator<CategoryEntity> {
12
11
  name: string;
@@ -1,14 +1,21 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.UpdateCategoryValidator = exports.CreateCategoryValidator = exports.FindCategoryValidator = void 0;
4
10
  const class_validator_1 = require("class-validator");
5
- require("reflect-metadata");
6
11
  const app_validator_1 = require("../../../config/app.validator");
7
12
  const category_entity_1 = require("./category.entity");
8
13
  class FindCategoryValidator {
9
14
  }
10
15
  exports.FindCategoryValidator = FindCategoryValidator;
11
16
  class CreateCategoryValidator extends app_validator_1.AppValidator {
17
+ name;
18
+ description;
12
19
  toEntity() {
13
20
  const entity = new category_entity_1.CategoryEntity();
14
21
  entity.name = this.name;
@@ -26,6 +33,8 @@ __decorate([
26
33
  ], CreateCategoryValidator.prototype, "description", void 0);
27
34
  exports.CreateCategoryValidator = CreateCategoryValidator;
28
35
  class UpdateCategoryValidator extends app_validator_1.AppValidator {
36
+ name;
37
+ description;
29
38
  toEntity(entity) {
30
39
  if (this.name) {
31
40
  entity.name = this.name;
@@ -1,9 +1,17 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.MediaDocument = void 0;
4
10
  const es_mapping_ts_1 = require("es-mapping-ts");
5
11
  const app_document_1 = require("../../../config/app.document");
6
12
  let MediaDocument = class MediaDocument extends app_document_1.AppDocument {
13
+ name;
14
+ url;
7
15
  transform(entity) {
8
16
  this.name = entity.name;
9
17
  this.url = entity.url;
@@ -0,0 +1,7 @@
1
+ import { AppEntity } from '../../../config/app.entity';
2
+ import { ProductEntity } from '../products/product.entity';
3
+ export declare class MediaEntity extends AppEntity {
4
+ name: string;
5
+ url: string;
6
+ product?: ProductEntity;
7
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.MediaEntity = void 0;
10
+ const typeorm_1 = require("typeorm");
11
+ const app_entity_1 = require("../../../config/app.entity");
12
+ const product_entity_1 = require("../products/product.entity");
13
+ let MediaEntity = class MediaEntity extends app_entity_1.AppEntity {
14
+ name;
15
+ url;
16
+ product;
17
+ };
18
+ __decorate([
19
+ (0, typeorm_1.Column)({ length: 64 })
20
+ ], MediaEntity.prototype, "name", void 0);
21
+ __decorate([
22
+ (0, typeorm_1.Column)({ length: 2048 })
23
+ ], MediaEntity.prototype, "url", void 0);
24
+ __decorate([
25
+ (0, typeorm_1.ManyToOne)(() => product_entity_1.ProductEntity, ({ media }) => media)
26
+ ], MediaEntity.prototype, "product", void 0);
27
+ MediaEntity = __decorate([
28
+ (0, typeorm_1.Entity)('inventory_media')
29
+ ], MediaEntity);
30
+ exports.MediaEntity = MediaEntity;
@@ -1,9 +1,8 @@
1
- import 'reflect-metadata';
2
1
  import { AppValidator } from '../../../config/app.validator';
3
2
  import { MediaEntity } from './media.entity';
4
3
  export declare class CreateMediaValidator extends AppValidator<MediaEntity> {
5
4
  name: string;
6
- toEntity(): MediaEntity;
5
+ toEntity?(): MediaEntity;
7
6
  }
8
7
  export declare class UpdateMediaValidator extends AppValidator<MediaEntity> {
9
8
  name: string;
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.UpdateMediaValidator = exports.CreateMediaValidator = void 0;
4
10
  const class_validator_1 = require("class-validator");
5
- require("reflect-metadata");
6
11
  const app_validator_1 = require("../../../config/app.validator");
7
12
  const media_entity_1 = require("./media.entity");
8
13
  class CreateMediaValidator extends app_validator_1.AppValidator {
14
+ name;
9
15
  toEntity() {
10
16
  const entity = new media_entity_1.MediaEntity();
11
17
  entity.name = this.name;
@@ -17,6 +23,7 @@ __decorate([
17
23
  ], CreateMediaValidator.prototype, "name", void 0);
18
24
  exports.CreateMediaValidator = CreateMediaValidator;
19
25
  class UpdateMediaValidator extends app_validator_1.AppValidator {
26
+ name;
20
27
  toEntity(entity) {
21
28
  if (this.name) {
22
29
  entity.name = this.name;
@@ -5,6 +5,7 @@ export declare class ProductDocument extends AppDocument<ProductEntity> {
5
5
  name: string;
6
6
  description: string;
7
7
  availableFrom: Date;
8
+ hashtags: string[];
8
9
  active: boolean;
9
10
  category: Id;
10
11
  brand: Id;
@@ -1,9 +1,22 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.ProductDocument = void 0;
4
10
  const es_mapping_ts_1 = require("es-mapping-ts");
5
11
  const app_document_1 = require("../../../config/app.document");
6
12
  let ProductDocument = class ProductDocument extends app_document_1.AppDocument {
13
+ name;
14
+ description;
15
+ availableFrom;
16
+ hashtags;
17
+ active;
18
+ category;
19
+ brand;
7
20
  transform(entity) {
8
21
  this.name = entity.name;
9
22
  this.description = entity.description;
@@ -23,6 +36,9 @@ __decorate([
23
36
  __decorate([
24
37
  (0, es_mapping_ts_1.EsField)({ type: 'date' })
25
38
  ], ProductDocument.prototype, "availableFrom", void 0);
39
+ __decorate([
40
+ (0, es_mapping_ts_1.EsField)({ type: 'nested' })
41
+ ], ProductDocument.prototype, "hashtags", void 0);
26
42
  __decorate([
27
43
  (0, es_mapping_ts_1.EsField)({ type: 'boolean' })
28
44
  ], ProductDocument.prototype, "active", void 0);
@@ -0,0 +1,19 @@
1
+ import { AppEntity } from '../../../config/app.entity';
2
+ import { BrandEntity } from '../brands/brand.entity';
3
+ import { CategoryEntity } from '../categories/category.entity';
4
+ import { MediaEntity } from '../media/media.entity';
5
+ import { VariantEntity } from '../variants/variant.entity';
6
+ export declare class ProductEntity extends AppEntity {
7
+ name: string;
8
+ description?: string;
9
+ active: boolean;
10
+ availableFrom: Date;
11
+ hashtags: string[];
12
+ category?: CategoryEntity;
13
+ brand?: BrandEntity;
14
+ variant: VariantEntity;
15
+ variants: VariantEntity[];
16
+ media: MediaEntity[];
17
+ get isOutOfStock(): boolean;
18
+ get isDraft(): boolean;
19
+ }
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ProductEntity = void 0;
10
+ const typeorm_1 = require("typeorm");
11
+ const app_entity_1 = require("../../../config/app.entity");
12
+ const brand_entity_1 = require("../brands/brand.entity");
13
+ const category_entity_1 = require("../categories/category.entity");
14
+ const media_entity_1 = require("../media/media.entity");
15
+ const variant_entity_1 = require("../variants/variant.entity");
16
+ let ProductEntity = class ProductEntity extends app_entity_1.AppEntity {
17
+ name;
18
+ description;
19
+ active = true;
20
+ availableFrom = new Date();
21
+ hashtags = [];
22
+ category;
23
+ brand;
24
+ variant;
25
+ variants;
26
+ media;
27
+ get isOutOfStock() {
28
+ return this.variants.every(variant => variant.isOutOfStock);
29
+ }
30
+ get isDraft() {
31
+ return this.active === true;
32
+ }
33
+ };
34
+ __decorate([
35
+ (0, typeorm_1.Column)({ length: 64 })
36
+ ], ProductEntity.prototype, "name", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.Column)({ type: 'text', nullable: true })
39
+ ], ProductEntity.prototype, "description", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.Column)({ type: 'boolean', default: true })
42
+ ], ProductEntity.prototype, "active", void 0);
43
+ __decorate([
44
+ (0, typeorm_1.Column)({ type: 'datetime', nullable: true })
45
+ ], ProductEntity.prototype, "availableFrom", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)({ type: 'simple-array', nullable: true })
48
+ ], ProductEntity.prototype, "hashtags", void 0);
49
+ __decorate([
50
+ (0, typeorm_1.ManyToOne)(() => category_entity_1.CategoryEntity, ({ products }) => products)
51
+ ], ProductEntity.prototype, "category", void 0);
52
+ __decorate([
53
+ (0, typeorm_1.ManyToOne)(() => brand_entity_1.BrandEntity, ({ products }) => products)
54
+ ], ProductEntity.prototype, "brand", void 0);
55
+ __decorate([
56
+ (0, typeorm_1.ManyToOne)(() => variant_entity_1.VariantEntity, ({ product }) => product)
57
+ ], ProductEntity.prototype, "variant", void 0);
58
+ __decorate([
59
+ (0, typeorm_1.OneToMany)(() => variant_entity_1.VariantEntity, ({ product }) => product)
60
+ ], ProductEntity.prototype, "variants", void 0);
61
+ __decorate([
62
+ (0, typeorm_1.OneToMany)(() => media_entity_1.MediaEntity, ({ product }) => product)
63
+ ], ProductEntity.prototype, "media", void 0);
64
+ ProductEntity = __decorate([
65
+ (0, typeorm_1.Entity)('inventory_products')
66
+ ], ProductEntity);
67
+ exports.ProductEntity = ProductEntity;
@@ -1,5 +1,4 @@
1
1
  import { Id } from '@elastic/elasticsearch/lib/api/types';
2
- import 'reflect-metadata';
3
2
  import { AppValidator } from '../../../config/app.validator';
4
3
  import { CreateVariantValidator } from '../variants/variant.validator';
5
4
  import { ProductEntity } from './product.entity';
@@ -11,8 +10,8 @@ export declare class CreateProductValidator extends AppValidator<ProductEntity>
11
10
  category?: Id;
12
11
  brand?: Id;
13
12
  hashtags: string[];
14
- variants: CreateVariantValidator[];
15
- toEntity(): ProductEntity;
13
+ variants?: CreateVariantValidator[];
14
+ toEntity?(): ProductEntity;
16
15
  }
17
16
  export declare class UpdateProductValidator extends AppValidator<ProductEntity> {
18
17
  name?: string;
@@ -1,21 +1,28 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.UpdateProductValidator = exports.CreateProductValidator = void 0;
4
10
  const class_transformer_1 = require("class-transformer");
5
11
  const class_validator_1 = require("class-validator");
6
- require("reflect-metadata");
7
12
  const app_validator_1 = require("../../../config/app.validator");
8
13
  const brand_entity_1 = require("../brands/brand.entity");
9
14
  const category_entity_1 = require("../categories/category.entity");
10
15
  const variant_validator_1 = require("../variants/variant.validator");
11
16
  const product_entity_1 = require("./product.entity");
12
17
  class CreateProductValidator extends app_validator_1.AppValidator {
13
- constructor() {
14
- super(...arguments);
15
- this.active = true;
16
- this.hashtags = [];
17
- this.variants = [];
18
- }
18
+ name;
19
+ description;
20
+ availableFrom;
21
+ active = true;
22
+ category;
23
+ brand;
24
+ hashtags = [];
25
+ variants = [];
19
26
  toEntity() {
20
27
  const entity = new product_entity_1.ProductEntity();
21
28
  entity.name = this.name;
@@ -62,6 +69,12 @@ __decorate([
62
69
  ], CreateProductValidator.prototype, "variants", void 0);
63
70
  exports.CreateProductValidator = CreateProductValidator;
64
71
  class UpdateProductValidator extends app_validator_1.AppValidator {
72
+ name;
73
+ description;
74
+ category;
75
+ brand;
76
+ hashtags;
77
+ active;
65
78
  toEntity(entity) {
66
79
  if (this.brand) {
67
80
  entity.brand = new brand_entity_1.BrandEntity(this.brand);
@@ -1,9 +1,19 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.VariantDocument = void 0;
4
10
  const es_mapping_ts_1 = require("es-mapping-ts");
5
11
  const app_document_1 = require("../../../config/app.document");
6
12
  let VariantDocument = class VariantDocument extends app_document_1.AppDocument {
13
+ sku;
14
+ quantity;
15
+ price;
16
+ active;
7
17
  transform(entity) {
8
18
  this.sku = entity.sku;
9
19
  this.quantity = entity.quantity;
@@ -0,0 +1,11 @@
1
+ import { AppEntity } from '../../../config/app.entity';
2
+ import { ProductEntity } from '../products/product.entity';
3
+ export declare class VariantEntity extends AppEntity {
4
+ sku: string;
5
+ price: number;
6
+ quantity: number;
7
+ active: boolean;
8
+ product: ProductEntity;
9
+ get isOutOfStock(): boolean;
10
+ get isDraft(): boolean;
11
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.VariantEntity = void 0;
10
+ const typeorm_1 = require("typeorm");
11
+ const app_entity_1 = require("../../../config/app.entity");
12
+ const product_entity_1 = require("../products/product.entity");
13
+ let VariantEntity = class VariantEntity extends app_entity_1.AppEntity {
14
+ sku;
15
+ price = 0;
16
+ quantity = 1;
17
+ active = true;
18
+ product;
19
+ get isOutOfStock() {
20
+ return this.quantity === 0;
21
+ }
22
+ get isDraft() {
23
+ return this.active === true;
24
+ }
25
+ };
26
+ __decorate([
27
+ (0, typeorm_1.Column)({ length: 32, unique: true })
28
+ ], VariantEntity.prototype, "sku", void 0);
29
+ __decorate([
30
+ (0, typeorm_1.Column)({ type: 'int', default: 0 })
31
+ ], VariantEntity.prototype, "price", void 0);
32
+ __decorate([
33
+ (0, typeorm_1.Column)({ type: 'float', default: 1 })
34
+ ], VariantEntity.prototype, "quantity", void 0);
35
+ __decorate([
36
+ (0, typeorm_1.Column)({ type: 'boolean', default: true })
37
+ ], VariantEntity.prototype, "active", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.ManyToOne)(() => product_entity_1.ProductEntity, ({ variants }) => variants)
40
+ ], VariantEntity.prototype, "product", void 0);
41
+ VariantEntity = __decorate([
42
+ (0, typeorm_1.Entity)('inventory_variants')
43
+ ], VariantEntity);
44
+ exports.VariantEntity = VariantEntity;
@@ -1,4 +1,3 @@
1
- import 'reflect-metadata';
2
1
  import { AppValidator } from '../../../config/app.validator';
3
2
  import { ProductEntity } from '../products/product.entity';
4
3
  import { VariantEntity } from './variant.entity';
@@ -1,17 +1,20 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.UpdateVariantValidator = exports.CreateVariantValidator = void 0;
4
10
  const class_validator_1 = require("class-validator");
5
- require("reflect-metadata");
6
11
  const app_validator_1 = require("../../../config/app.validator");
7
12
  const variant_entity_1 = require("./variant.entity");
8
13
  class CreateVariantValidator extends app_validator_1.AppValidator {
9
- constructor() {
10
- super(...arguments);
11
- this.price = 0;
12
- this.quantity = 1;
13
- this.active = true;
14
- }
14
+ price = 0;
15
+ sku;
16
+ quantity = 1;
17
+ active = true;
15
18
  toEntity(product) {
16
19
  const entity = new variant_entity_1.VariantEntity();
17
20
  entity.sku = this.sku;
@@ -41,11 +44,10 @@ __decorate([
41
44
  ], CreateVariantValidator.prototype, "active", void 0);
42
45
  exports.CreateVariantValidator = CreateVariantValidator;
43
46
  class UpdateVariantValidator extends app_validator_1.AppValidator {
44
- constructor() {
45
- super(...arguments);
46
- this.price = 0;
47
- this.quantity = 1;
48
- }
47
+ price = 0;
48
+ sku;
49
+ quantity = 1;
50
+ active;
49
51
  toEntity(entity) {
50
52
  if (this.sku) {
51
53
  entity.sku = this.sku;
@@ -1,9 +1,17 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.OrderDocument = void 0;
4
10
  const es_mapping_ts_1 = require("es-mapping-ts");
5
11
  const app_document_1 = require("../../../config/app.document");
6
12
  let OrderDocument = class OrderDocument extends app_document_1.AppDocument {
13
+ number;
14
+ price;
7
15
  transform(entity) {
8
16
  this.number = entity.number;
9
17
  this.price = entity.price;
@@ -0,0 +1,5 @@
1
+ import { AppEntity } from '../../../config/app.entity';
2
+ export declare class OrderEntity extends AppEntity {
3
+ number: string;
4
+ price: number;
5
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.OrderEntity = void 0;
10
+ const typeorm_1 = require("typeorm");
11
+ const app_entity_1 = require("../../../config/app.entity");
12
+ let OrderEntity = class OrderEntity extends app_entity_1.AppEntity {
13
+ number;
14
+ price;
15
+ };
16
+ __decorate([
17
+ (0, typeorm_1.Column)({ type: 'varchar', length: 16 })
18
+ ], OrderEntity.prototype, "number", void 0);
19
+ __decorate([
20
+ (0, typeorm_1.Column)({ type: 'int' })
21
+ ], OrderEntity.prototype, "price", void 0);
22
+ OrderEntity = __decorate([
23
+ (0, typeorm_1.Entity)('store_orders')
24
+ ], OrderEntity);
25
+ exports.OrderEntity = OrderEntity;
@@ -1,8 +1,7 @@
1
- import 'reflect-metadata';
2
1
  import { AppValidator } from '../../../config/app.validator';
3
2
  import { OrderEntity } from './order.entity';
4
3
  export declare class CreateOrderValidator extends AppValidator<OrderEntity> {
5
- toEntity(): OrderEntity;
4
+ toEntity?(): OrderEntity;
6
5
  }
7
6
  export declare class UpdateOrderValidator extends AppValidator<OrderEntity> {
8
7
  toEntity(entity: OrderEntity): OrderEntity;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UpdateOrderValidator = exports.CreateOrderValidator = void 0;
4
- require("reflect-metadata");
5
4
  const app_validator_1 = require("../../../config/app.validator");
6
5
  const order_entity_1 = require("./order.entity");
7
6
  class CreateOrderValidator extends app_validator_1.AppValidator {
package/index.ts CHANGED
@@ -11,16 +11,14 @@ import * as VariantValidators from './src/inventory/variants/variant.validator'
11
11
  import { OrderDocument } from './src/store/orders/order.document'
12
12
  import * as OrderValidators from './src/store/orders/order.validator'
13
13
 
14
- const create = (document, validators) => ({ document, validators })
15
-
16
- export namespace Inventory {
17
- export const brand = create(BrandDocument, BrandValidators)
18
- export const category = create(CategoryDocument, CategoryValidators)
19
- export const product = create(ProductDocument, ProductValidators)
20
- export const media = create(MediaDocument, MediaValidators)
21
- export const variant = create(VariantDocument, VariantValidators)
14
+ export const Inventory = {
15
+ Brand: { BrandDocument, ...BrandValidators },
16
+ Category: { CategoryDocument, ...CategoryValidators },
17
+ Product: { ProductDocument, ...ProductValidators },
18
+ Media: { MediaDocument, ...MediaValidators },
19
+ Variant: { VariantDocument, ...VariantValidators }
22
20
  }
23
21
 
24
- export namespace Store {
25
- export const order = create(OrderDocument, OrderValidators)
22
+ export const Store = {
23
+ Order: { OrderDocument, ...OrderValidators }
26
24
  }
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@merkaly/api",
3
- "version": "0.2.1-0",
3
+ "version": "0.2.1-3",
4
4
  "description": "NestJS Backend ApiRest Service",
5
5
  "author": "Randy Tellez Galan <kronhyx@gmail.com>",
6
6
  "license": "UNLICENSED",
7
7
  "main": "./.output/app.js",
8
8
  "types": "./.output/app.d.ts",
9
+ "files": [
10
+ ".output",
11
+ "index.ts"
12
+ ],
9
13
  "scripts": {
10
14
  "prebuild": "yarn run clean",
11
15
  "prepack": ".bin/package.sh",
@@ -28,8 +32,8 @@
28
32
  "auth0": "^2.35.0",
29
33
  "class-transformer": "^0.5.1",
30
34
  "class-validator": "^0.13.1",
31
- "reflect-metadata": "^0.1.13",
32
- "typeorm": "^0.3.6"
35
+ "es-mapping-ts": "^1.0.1",
36
+ "reflect-metadata": "^0.1.13"
33
37
  },
34
38
  "devDependencies": {
35
39
  "@commitlint/config-conventional": "^17.0.0",
@@ -60,7 +64,6 @@
60
64
  "@typescript-eslint/eslint-plugin": "4.33.0",
61
65
  "@typescript-eslint/parser": "4.33.0",
62
66
  "commitlint": "^17.0.1",
63
- "es-mapping-ts": "^1.0.1",
64
67
  "eslint": "7.32.0",
65
68
  "eslint-plugin-import": "^2.23.4",
66
69
  "express": "^4.17.3",
@@ -79,6 +82,7 @@
79
82
  "ts-loader": "^9.2.3",
80
83
  "ts-node": "^10.0.0",
81
84
  "tsconfig-paths": "^4.0.0",
85
+ "typeorm": "^0.3.7",
82
86
  "typeorm-naming-strategies": "^4.0.0",
83
87
  "typescript": "^4.6.2",
84
88
  "webpack": "^5"