@merkaly/api 0.2.3-4 → 0.2.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 (48) hide show
  1. package/.output/abstract/abstract.entity.d.ts +1 -1
  2. package/.output/abstract/abstract.entity.js +53 -0
  3. package/.output/modules/assets/asset.entity.js +69 -0
  4. package/.output/modules/content/banners/banner.entity.js +54 -0
  5. package/.output/modules/content/pages/page.entity.js +69 -0
  6. package/.output/modules/inventory/brands/brand.entity.js +50 -0
  7. package/.output/modules/inventory/categories/category.entity.js +61 -0
  8. package/.output/modules/inventory/products/entities/code.entity.js +53 -0
  9. package/.output/modules/inventory/products/entities/dimension.entity.js +57 -0
  10. package/.output/modules/inventory/products/entities/price.entity.js +49 -0
  11. package/.output/modules/inventory/products/entities/seo.entity.js +53 -0
  12. package/.output/modules/inventory/products/product.entity.js +101 -0
  13. package/.output/modules/inventory/properties/property.entity.js +55 -0
  14. package/.output/modules/sales/clients/client.entity.js +64 -0
  15. package/.output/modules/sales/orders/address/address.entity.d.ts +4 -3
  16. package/.output/modules/sales/orders/address/address.entity.js +68 -0
  17. package/.output/modules/sales/orders/address/address.validator.d.ts +3 -2
  18. package/.output/modules/sales/orders/address/address.validator.js +19 -7
  19. package/.output/modules/sales/orders/billing/billing.entity.d.ts +5 -4
  20. package/.output/modules/sales/orders/billing/billing.entity.js +59 -0
  21. package/.output/modules/sales/orders/billing/billing.validator.d.ts +1 -1
  22. package/.output/modules/sales/orders/billing/billing.validator.js +4 -2
  23. package/.output/modules/sales/orders/customer/customer.entity.d.ts +1 -1
  24. package/.output/modules/sales/orders/customer/customer.entity.js +52 -0
  25. package/.output/modules/sales/orders/customer/customer.validator.js +5 -2
  26. package/.output/modules/sales/orders/item/item.entity.d.ts +1 -0
  27. package/.output/modules/sales/orders/item/item.entity.js +58 -0
  28. package/.output/modules/sales/orders/order.entity.d.ts +6 -8
  29. package/.output/modules/sales/orders/order.entity.js +89 -0
  30. package/.output/modules/sales/orders/order.validator.d.ts +2 -1
  31. package/.output/modules/sales/orders/order.validator.js +13 -7
  32. package/.output/modules/sales/orders/shipping/shipping.entity.d.ts +7 -4
  33. package/.output/modules/sales/orders/shipping/shipping.entity.js +63 -0
  34. package/.output/modules/sales/orders/shipping/shipping.validator.d.ts +1 -1
  35. package/.output/modules/sales/orders/shipping/shipping.validator.js +4 -2
  36. package/.output/modules/sales/orders/status/status.entity.js +37 -0
  37. package/.output/modules/setting/layout/layout.entity.js +46 -0
  38. package/.output/modules/setting/organization/organization.entity.js +28 -0
  39. package/.output/modules/setting/organization/organization.types.d.ts +4 -3
  40. package/.output/modules/setting/organization/organization.types.js +7 -2
  41. package/.output/modules/setting/theme/theme.entity.js +46 -0
  42. package/.output/modules/users/user.validator.d.ts +3 -3
  43. package/.output/modules/users/user.validator.js +6 -6
  44. package/.output/types.d.ts +5 -5
  45. package/package.json +2 -2
  46. package/.output/modules/sales/orders/payment/payment.entity.d.ts +0 -4
  47. package/.output/modules/sales/orders/payment/payment.validator.d.ts +0 -6
  48. package/.output/modules/sales/orders/payment/payment.validator.js +0 -10
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ 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;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.ProductEntity = void 0;
28
+ var mongoose_1 = require("@nestjs/mongoose");
29
+ var mongoose_2 = require("mongoose");
30
+ var abstract_entity_1 = require("../../../abstract/abstract.entity");
31
+ var asset_entity_1 = require("../../assets/asset.entity");
32
+ var brand_entity_1 = require("../brands/brand.entity");
33
+ var category_entity_1 = require("../categories/category.entity");
34
+ var code_entity_1 = require("./entities/code.entity");
35
+ var dimension_entity_1 = require("./entities/dimension.entity");
36
+ var price_entity_1 = require("./entities/price.entity");
37
+ var seo_entity_1 = require("./entities/seo.entity");
38
+ var ProductEntity = (function (_super) {
39
+ __extends(ProductEntity, _super);
40
+ function ProductEntity() {
41
+ var _this = _super !== null && _super.apply(this, arguments) || this;
42
+ _this.active = true;
43
+ _this.hashtags = [];
44
+ _this.files = [];
45
+ return _this;
46
+ }
47
+ ProductEntity.$index = 'inventory_products';
48
+ __decorate([
49
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true, length: 64 }),
50
+ __metadata("design:type", String)
51
+ ], ProductEntity.prototype, "name", void 0);
52
+ __decorate([
53
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, length: 256 }),
54
+ __metadata("design:type", String)
55
+ ], ProductEntity.prototype, "measurement", void 0);
56
+ __decorate([
57
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Boolean, default: true }),
58
+ __metadata("design:type", Object)
59
+ ], ProductEntity.prototype, "active", void 0);
60
+ __decorate([
61
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, nullable: true }),
62
+ __metadata("design:type", String)
63
+ ], ProductEntity.prototype, "description", void 0);
64
+ __decorate([
65
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Array, default: [] }),
66
+ __metadata("design:type", Array)
67
+ ], ProductEntity.prototype, "hashtags", void 0);
68
+ __decorate([
69
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: category_entity_1.CategoryEntity.$index }),
70
+ __metadata("design:type", category_entity_1.CategoryEntity)
71
+ ], ProductEntity.prototype, "category", void 0);
72
+ __decorate([
73
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: brand_entity_1.BrandEntity.$index }),
74
+ __metadata("design:type", brand_entity_1.BrandEntity)
75
+ ], ProductEntity.prototype, "brand", void 0);
76
+ __decorate([
77
+ (0, mongoose_1.Prop)({ type: [{ type: mongoose_2.Schema.Types.ObjectId, ref: asset_entity_1.AssetEntity.$index }] }),
78
+ __metadata("design:type", Array)
79
+ ], ProductEntity.prototype, "files", void 0);
80
+ __decorate([
81
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Map, ref: function () { return price_entity_1.PriceEntity; }, default: new Map() }),
82
+ __metadata("design:type", price_entity_1.PriceEntity)
83
+ ], ProductEntity.prototype, "price", void 0);
84
+ __decorate([
85
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Map, ref: function () { return code_entity_1.CodeEntity; }, default: new Map() }),
86
+ __metadata("design:type", code_entity_1.CodeEntity)
87
+ ], ProductEntity.prototype, "code", void 0);
88
+ __decorate([
89
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Map, ref: function () { return dimension_entity_1.DimensionEntity; }, default: new Map() }),
90
+ __metadata("design:type", dimension_entity_1.DimensionEntity)
91
+ ], ProductEntity.prototype, "dimension", void 0);
92
+ __decorate([
93
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Map, ref: function () { return seo_entity_1.SeoEntity; }, default: new Map() }),
94
+ __metadata("design:type", seo_entity_1.SeoEntity)
95
+ ], ProductEntity.prototype, "seo", void 0);
96
+ ProductEntity = __decorate([
97
+ (0, mongoose_1.Schema)({ timestamps: true, toJSON: { virtuals: true } })
98
+ ], ProductEntity);
99
+ return ProductEntity;
100
+ }(abstract_entity_1.AbstractEntity));
101
+ exports.ProductEntity = ProductEntity;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ 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;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.PropertyEntity = void 0;
28
+ var mongoose_1 = require("@nestjs/mongoose");
29
+ var mongoose_2 = require("mongoose");
30
+ var abstract_entity_1 = require("../../../abstract/abstract.entity");
31
+ var property_validator_1 = require("./property.validator");
32
+ var PropertyEntity = (function (_super) {
33
+ __extends(PropertyEntity, _super);
34
+ function PropertyEntity() {
35
+ return _super !== null && _super.apply(this, arguments) || this;
36
+ }
37
+ PropertyEntity.$index = 'inventory_properties';
38
+ __decorate([
39
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true, unique: true, length: 32 }),
40
+ __metadata("design:type", String)
41
+ ], PropertyEntity.prototype, "name", void 0);
42
+ __decorate([
43
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true, length: 64 }),
44
+ __metadata("design:type", String)
45
+ ], PropertyEntity.prototype, "title", void 0);
46
+ __decorate([
47
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, default: property_validator_1.PropertyType.STRING }),
48
+ __metadata("design:type", String)
49
+ ], PropertyEntity.prototype, "type", void 0);
50
+ PropertyEntity = __decorate([
51
+ (0, mongoose_1.Schema)({ timestamps: true })
52
+ ], PropertyEntity);
53
+ return PropertyEntity;
54
+ }(abstract_entity_1.AbstractEntity));
55
+ exports.PropertyEntity = PropertyEntity;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ 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;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.ClientEntity = void 0;
28
+ var mongoose_1 = require("@nestjs/mongoose");
29
+ var mongoose_2 = require("mongoose");
30
+ var abstract_entity_1 = require("../../../abstract/abstract.entity");
31
+ var ClientEntity = (function (_super) {
32
+ __extends(ClientEntity, _super);
33
+ function ClientEntity() {
34
+ var _this = _super !== null && _super.apply(this, arguments) || this;
35
+ _this.addresses = [];
36
+ return _this;
37
+ }
38
+ ClientEntity.$index = 'store_clients';
39
+ __decorate([
40
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true }),
41
+ __metadata("design:type", String)
42
+ ], ClientEntity.prototype, "name", void 0);
43
+ __decorate([
44
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, unique: true, required: true }),
45
+ __metadata("design:type", String)
46
+ ], ClientEntity.prototype, "email", void 0);
47
+ __decorate([
48
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, default: null }),
49
+ __metadata("design:type", String)
50
+ ], ClientEntity.prototype, "phone", void 0);
51
+ __decorate([
52
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, unique: true }),
53
+ __metadata("design:type", String)
54
+ ], ClientEntity.prototype, "identificationNumber", void 0);
55
+ __decorate([
56
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Array, default: [] }),
57
+ __metadata("design:type", Array)
58
+ ], ClientEntity.prototype, "addresses", void 0);
59
+ ClientEntity = __decorate([
60
+ (0, mongoose_1.Schema)({ timestamps: true })
61
+ ], ClientEntity);
62
+ return ClientEntity;
63
+ }(abstract_entity_1.AbstractEntity));
64
+ exports.ClientEntity = ClientEntity;
@@ -1,8 +1,9 @@
1
- export declare class AddressEntity {
1
+ export declare class AddressEntity extends Map {
2
2
  country: string;
3
3
  code: string;
4
- line1: string;
5
- line2: string;
4
+ street: string;
5
+ number: string;
6
+ complement: string;
6
7
  city: string;
7
8
  state: string;
8
9
  }
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ 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;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.AddressEntity = void 0;
28
+ var mongoose_1 = require("@nestjs/mongoose");
29
+ var mongoose_2 = require("mongoose");
30
+ var AddressEntity = (function (_super) {
31
+ __extends(AddressEntity, _super);
32
+ function AddressEntity() {
33
+ return _super !== null && _super.apply(this, arguments) || this;
34
+ }
35
+ __decorate([
36
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true }),
37
+ __metadata("design:type", String)
38
+ ], AddressEntity.prototype, "country", void 0);
39
+ __decorate([
40
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true }),
41
+ __metadata("design:type", String)
42
+ ], AddressEntity.prototype, "code", void 0);
43
+ __decorate([
44
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true }),
45
+ __metadata("design:type", String)
46
+ ], AddressEntity.prototype, "street", void 0);
47
+ __decorate([
48
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
49
+ __metadata("design:type", String)
50
+ ], AddressEntity.prototype, "number", void 0);
51
+ __decorate([
52
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
53
+ __metadata("design:type", String)
54
+ ], AddressEntity.prototype, "complement", void 0);
55
+ __decorate([
56
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
57
+ __metadata("design:type", String)
58
+ ], AddressEntity.prototype, "city", void 0);
59
+ __decorate([
60
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
61
+ __metadata("design:type", String)
62
+ ], AddressEntity.prototype, "state", void 0);
63
+ AddressEntity = __decorate([
64
+ (0, mongoose_1.Schema)()
65
+ ], AddressEntity);
66
+ return AddressEntity;
67
+ }(Map));
68
+ exports.AddressEntity = AddressEntity;
@@ -1,8 +1,9 @@
1
1
  export declare class AddressValidator {
2
2
  country: string;
3
3
  code: string;
4
- line1: string;
5
- line2?: string;
4
+ street: string;
5
+ number: string;
6
+ complement?: string;
6
7
  city: string;
7
8
  state: string;
8
9
  }
@@ -13,33 +13,45 @@ exports.AddressValidator = void 0;
13
13
  var class_validator_1 = require("class-validator");
14
14
  var AddressValidator = (function () {
15
15
  function AddressValidator() {
16
+ this.country = String();
17
+ this.code = String();
18
+ this.street = String();
19
+ this.number = String();
20
+ this.complement = undefined;
21
+ this.city = String();
22
+ this.state = String();
16
23
  }
17
24
  __decorate([
18
25
  (0, class_validator_1.IsISO31661Alpha2)(),
19
- __metadata("design:type", String)
26
+ __metadata("design:type", Object)
20
27
  ], AddressValidator.prototype, "country", void 0);
21
28
  __decorate([
22
29
  (0, class_validator_1.IsString)(),
23
- __metadata("design:type", String)
30
+ __metadata("design:type", Object)
24
31
  ], AddressValidator.prototype, "code", void 0);
25
32
  __decorate([
26
33
  (0, class_validator_1.IsString)(),
27
- __metadata("design:type", String)
28
- ], AddressValidator.prototype, "line1", void 0);
34
+ __metadata("design:type", Object)
35
+ ], AddressValidator.prototype, "street", void 0);
29
36
  __decorate([
30
37
  (0, class_validator_1.IsString)(),
31
38
  (0, class_validator_1.IsOptional)(),
32
- __metadata("design:type", String)
33
- ], AddressValidator.prototype, "line2", void 0);
39
+ __metadata("design:type", Object)
40
+ ], AddressValidator.prototype, "number", void 0);
34
41
  __decorate([
35
42
  (0, class_validator_1.IsString)(),
36
43
  (0, class_validator_1.IsOptional)(),
37
44
  __metadata("design:type", String)
45
+ ], AddressValidator.prototype, "complement", void 0);
46
+ __decorate([
47
+ (0, class_validator_1.IsString)(),
48
+ (0, class_validator_1.IsOptional)(),
49
+ __metadata("design:type", Object)
38
50
  ], AddressValidator.prototype, "city", void 0);
39
51
  __decorate([
40
52
  (0, class_validator_1.IsString)(),
41
53
  (0, class_validator_1.IsOptional)(),
42
- __metadata("design:type", String)
54
+ __metadata("design:type", Object)
43
55
  ], AddressValidator.prototype, "state", void 0);
44
56
  return AddressValidator;
45
57
  }());
@@ -1,7 +1,8 @@
1
- import { Types } from 'mongoose';
1
+ import { AddressEntity } from "../address/address.entity";
2
+ import { CustomerEntity } from "../customer/customer.entity";
2
3
  import { BillingType } from "./billing.validator";
3
- export declare class BillingEntity {
4
- address?: Types.Map<any>;
5
- customer: Types.Map<any>;
4
+ export declare class BillingEntity extends Map {
5
+ address: AddressEntity;
6
+ customer: CustomerEntity;
6
7
  type: BillingType;
7
8
  }
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ 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;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.BillingEntity = void 0;
28
+ var mongoose_1 = require("@nestjs/mongoose");
29
+ var schema_decorator_1 = require("@nestjs/mongoose/dist/decorators/schema.decorator");
30
+ var mongoose_2 = require("mongoose");
31
+ var address_entity_1 = require("../address/address.entity");
32
+ var customer_entity_1 = require("../customer/customer.entity");
33
+ var billing_validator_1 = require("./billing.validator");
34
+ var BillingEntity = (function (_super) {
35
+ __extends(BillingEntity, _super);
36
+ function BillingEntity() {
37
+ var _this = _super !== null && _super.apply(this, arguments) || this;
38
+ _this.address = new address_entity_1.AddressEntity();
39
+ _this.customer = new customer_entity_1.CustomerEntity();
40
+ return _this;
41
+ }
42
+ __decorate([
43
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Map, ref: function () { return address_entity_1.AddressEntity; }, default: new address_entity_1.AddressEntity() }),
44
+ __metadata("design:type", Object)
45
+ ], BillingEntity.prototype, "address", void 0);
46
+ __decorate([
47
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Map, ref: function () { return customer_entity_1.CustomerEntity; }, default: new customer_entity_1.CustomerEntity() }),
48
+ __metadata("design:type", Object)
49
+ ], BillingEntity.prototype, "customer", void 0);
50
+ __decorate([
51
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, enum: billing_validator_1.BillingType, required: true }),
52
+ __metadata("design:type", String)
53
+ ], BillingEntity.prototype, "type", void 0);
54
+ BillingEntity = __decorate([
55
+ (0, schema_decorator_1.Schema)({})
56
+ ], BillingEntity);
57
+ return BillingEntity;
58
+ }(Map));
59
+ exports.BillingEntity = BillingEntity;
@@ -8,6 +8,6 @@ export declare enum BillingType {
8
8
  }
9
9
  export declare class CreateBillingValidator {
10
10
  customer: CreateCustomerValidator;
11
- address?: AddressValidator;
11
+ address: AddressValidator;
12
12
  type: BillingType;
13
13
  }
@@ -23,18 +23,20 @@ var BillingType;
23
23
  })(BillingType = exports.BillingType || (exports.BillingType = {}));
24
24
  var CreateBillingValidator = (function () {
25
25
  function CreateBillingValidator() {
26
+ this.customer = new customer_validator_1.CreateCustomerValidator();
27
+ this.address = new address_validator_1.AddressValidator();
26
28
  }
27
29
  __decorate([
28
30
  (0, class_validator_1.ValidateNested)(),
29
31
  (0, class_transformer_1.Type)(function () { return customer_validator_1.CreateCustomerValidator; }),
30
32
  (0, class_validator_1.IsNotEmptyObject)(),
31
- __metadata("design:type", customer_validator_1.CreateCustomerValidator)
33
+ __metadata("design:type", Object)
32
34
  ], CreateBillingValidator.prototype, "customer", void 0);
33
35
  __decorate([
34
36
  (0, class_validator_1.ValidateNested)(),
35
37
  (0, class_transformer_1.Type)(function () { return address_validator_1.AddressValidator; }),
36
38
  (0, class_validator_1.IsNotEmptyObject)(),
37
- __metadata("design:type", address_validator_1.AddressValidator)
39
+ __metadata("design:type", Object)
38
40
  ], CreateBillingValidator.prototype, "address", void 0);
39
41
  __decorate([
40
42
  (0, class_validator_1.IsEnum)(BillingType),
@@ -1,4 +1,4 @@
1
- export declare class CustomerEntity {
1
+ export declare class CustomerEntity extends Map {
2
2
  name: string;
3
3
  email: string;
4
4
  phone: string;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ 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;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.CustomerEntity = void 0;
28
+ var mongoose_1 = require("@nestjs/mongoose");
29
+ var mongoose_2 = require("mongoose");
30
+ var CustomerEntity = (function (_super) {
31
+ __extends(CustomerEntity, _super);
32
+ function CustomerEntity() {
33
+ return _super !== null && _super.apply(this, arguments) || this;
34
+ }
35
+ __decorate([
36
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true }),
37
+ __metadata("design:type", String)
38
+ ], CustomerEntity.prototype, "name", void 0);
39
+ __decorate([
40
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
41
+ __metadata("design:type", String)
42
+ ], CustomerEntity.prototype, "email", void 0);
43
+ __decorate([
44
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
45
+ __metadata("design:type", String)
46
+ ], CustomerEntity.prototype, "phone", void 0);
47
+ CustomerEntity = __decorate([
48
+ (0, mongoose_1.Schema)()
49
+ ], CustomerEntity);
50
+ return CustomerEntity;
51
+ }(Map));
52
+ exports.CustomerEntity = CustomerEntity;
@@ -13,15 +13,18 @@ exports.CreateCustomerValidator = void 0;
13
13
  var class_validator_1 = require("class-validator");
14
14
  var CreateCustomerValidator = (function () {
15
15
  function CreateCustomerValidator() {
16
+ this.name = String();
17
+ this.email = String();
18
+ this.phone = undefined;
16
19
  }
17
20
  __decorate([
18
21
  (0, class_validator_1.IsString)(),
19
22
  (0, class_validator_1.IsNotEmpty)(),
20
- __metadata("design:type", String)
23
+ __metadata("design:type", Object)
21
24
  ], CreateCustomerValidator.prototype, "name", void 0);
22
25
  __decorate([
23
26
  (0, class_validator_1.IsEmail)(),
24
- __metadata("design:type", String)
27
+ __metadata("design:type", Object)
25
28
  ], CreateCustomerValidator.prototype, "email", void 0);
26
29
  __decorate([
27
30
  (0, class_validator_1.IsString)(),
@@ -3,6 +3,7 @@ import { ProductEntity } from '../../../inventory/products/product.entity';
3
3
  export declare class ItemEntity extends AbstractEntity {
4
4
  quantity: number;
5
5
  price: number;
6
+ refund: number;
6
7
  product: ProductEntity;
7
8
  readonly total: number;
8
9
  }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ 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;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.ItemEntity = void 0;
28
+ var mongoose_1 = require("@nestjs/mongoose");
29
+ var mongoose_2 = require("mongoose");
30
+ var abstract_entity_1 = require("../../../../abstract/abstract.entity");
31
+ var product_entity_1 = require("../../../inventory/products/product.entity");
32
+ var ItemEntity = (function (_super) {
33
+ __extends(ItemEntity, _super);
34
+ function ItemEntity() {
35
+ return _super !== null && _super.apply(this, arguments) || this;
36
+ }
37
+ __decorate([
38
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Number, default: 1 }),
39
+ __metadata("design:type", Number)
40
+ ], ItemEntity.prototype, "quantity", void 0);
41
+ __decorate([
42
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Number, default: 0 }),
43
+ __metadata("design:type", Number)
44
+ ], ItemEntity.prototype, "price", void 0);
45
+ __decorate([
46
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Number, default: 0 }),
47
+ __metadata("design:type", Number)
48
+ ], ItemEntity.prototype, "refund", void 0);
49
+ __decorate([
50
+ (0, mongoose_1.Prop)({ type: mongoose_2.Types.ObjectId, ref: product_entity_1.ProductEntity.$index, required: true }),
51
+ __metadata("design:type", product_entity_1.ProductEntity)
52
+ ], ItemEntity.prototype, "product", void 0);
53
+ ItemEntity = __decorate([
54
+ (0, mongoose_1.Schema)({ timestamps: true, toJSON: { virtuals: true } })
55
+ ], ItemEntity);
56
+ return ItemEntity;
57
+ }(abstract_entity_1.AbstractEntity));
58
+ exports.ItemEntity = ItemEntity;