@merkaly/api 0.2.4-1 → 0.2.4-10

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 (77) hide show
  1. package/.output/abstract/abstract.entity.d.ts +1 -1
  2. package/.output/abstract/abstract.exception.d.ts +11 -0
  3. package/.output/abstract/abstract.exception.js +53 -0
  4. package/.output/abstract/abstract.validator.d.ts +1 -1
  5. package/.output/abstract/abstract.validator.js +1 -0
  6. package/.output/exceptions/missing-identity.exception.d.ts +5 -0
  7. package/.output/{modules/setting/organization/organization.entity.js → exceptions/missing-identity.exception.js} +12 -10
  8. package/.output/exceptions/store-not-implemented.exception.d.ts +5 -0
  9. package/.output/exceptions/store-not-implemented.exception.js +31 -0
  10. package/.output/exceptions/store-not-recognized.exception.d.ts +5 -0
  11. package/.output/exceptions/store-not-recognized.exception.js +30 -0
  12. package/.output/modules/inventory/brands/brand.exception.d.ts +5 -0
  13. package/.output/modules/{setting/theme/theme.entity.js → inventory/brands/brand.exception.js} +15 -21
  14. package/.output/modules/inventory/categories/category.exception.d.ts +5 -0
  15. package/.output/modules/{setting/layout/layout.entity.js → inventory/categories/category.exception.js} +15 -21
  16. package/.output/modules/inventory/products/product.entity.d.ts +1 -0
  17. package/.output/modules/inventory/products/product.exception.d.ts +5 -0
  18. package/.output/modules/inventory/products/{entities/price.entity.js → product.exception.js} +15 -24
  19. package/.output/modules/inventory/products/product.validator.d.ts +2 -1
  20. package/.output/modules/inventory/products/product.validator.js +7 -0
  21. package/.output/modules/inventory/properties/property.exception.d.ts +5 -0
  22. package/.output/modules/inventory/{brands/brand.entity.js → properties/property.exception.js} +15 -25
  23. package/.output/modules/sales/clients/client.exception.d.ts +5 -0
  24. package/.output/modules/sales/clients/client.exception.js +40 -0
  25. package/.output/modules/sales/orders/billing/billing.entity.d.ts +8 -6
  26. package/.output/modules/sales/orders/billing/billing.types.d.ts +9 -0
  27. package/.output/modules/sales/orders/billing/billing.types.js +14 -0
  28. package/.output/modules/sales/orders/billing/billing.validator.d.ts +6 -10
  29. package/.output/modules/sales/orders/billing/billing.validator.js +10 -15
  30. package/.output/modules/sales/orders/{address → billing/entities}/address.entity.d.ts +2 -1
  31. package/.output/modules/sales/orders/billing/entities/customer.entity.d.ts +5 -0
  32. package/.output/modules/sales/orders/billing/entities/status.entity.d.ts +6 -0
  33. package/.output/modules/sales/orders/{address → billing/validators}/address.validator.d.ts +2 -1
  34. package/.output/modules/sales/orders/{address → billing/validators}/address.validator.js +12 -14
  35. package/.output/modules/sales/orders/billing/validators/customer.validator.d.ts +5 -0
  36. package/.output/modules/sales/orders/{status/status.entity.js → billing/validators/customer.validator.js} +20 -21
  37. package/.output/modules/sales/orders/customer/customer.validator.d.ts +1 -1
  38. package/.output/modules/sales/orders/customer/customer.validator.js +8 -8
  39. package/.output/modules/sales/orders/order.entity.d.ts +1 -1
  40. package/.output/modules/sales/orders/order.exception.d.ts +13 -0
  41. package/.output/modules/sales/orders/order.exception.js +46 -0
  42. package/.output/modules/sales/orders/order.validator.d.ts +2 -2
  43. package/.output/modules/sales/orders/order.validator.js +3 -4
  44. package/.output/modules/sales/orders/shipping/entities/address.entity.d.ts +10 -0
  45. package/.output/modules/sales/orders/shipping/entities/customer.entity.d.ts +5 -0
  46. package/.output/modules/sales/orders/shipping/entities/status.entity.d.ts +6 -0
  47. package/.output/modules/sales/orders/shipping/shipping.entity.d.ts +8 -6
  48. package/.output/modules/sales/orders/shipping/shipping.types.d.ts +11 -0
  49. package/.output/modules/sales/orders/shipping/shipping.types.js +16 -0
  50. package/.output/modules/sales/orders/shipping/shipping.validator.d.ts +6 -9
  51. package/.output/modules/sales/orders/shipping/shipping.validator.js +10 -14
  52. package/.output/modules/sales/orders/shipping/validators/address.validator.d.ts +10 -0
  53. package/.output/modules/sales/orders/shipping/validators/address.validator.js +56 -0
  54. package/.output/modules/sales/orders/shipping/validators/customer.validator.d.ts +5 -0
  55. package/.output/modules/sales/orders/shipping/validators/customer.validator.js +36 -0
  56. package/.output/services/logger.service.d.ts +11 -0
  57. package/.output/services/logger.service.js +54 -0
  58. package/.output/types.d.ts +4 -1
  59. package/README.md +14 -14
  60. package/package.json +7 -7
  61. package/.output/abstract/abstract.entity.js +0 -53
  62. package/.output/modules/assets/asset.entity.js +0 -69
  63. package/.output/modules/content/banners/banner.entity.js +0 -54
  64. package/.output/modules/content/pages/page.entity.js +0 -69
  65. package/.output/modules/inventory/categories/category.entity.js +0 -61
  66. package/.output/modules/inventory/products/entities/code.entity.js +0 -53
  67. package/.output/modules/inventory/products/entities/dimension.entity.js +0 -57
  68. package/.output/modules/inventory/products/entities/seo.entity.js +0 -53
  69. package/.output/modules/inventory/products/product.entity.js +0 -101
  70. package/.output/modules/inventory/properties/property.entity.js +0 -55
  71. package/.output/modules/sales/clients/client.entity.js +0 -64
  72. package/.output/modules/sales/orders/address/address.entity.js +0 -68
  73. package/.output/modules/sales/orders/billing/billing.entity.js +0 -59
  74. package/.output/modules/sales/orders/customer/customer.entity.js +0 -52
  75. package/.output/modules/sales/orders/item/item.entity.js +0 -58
  76. package/.output/modules/sales/orders/order.entity.js +0 -89
  77. package/.output/modules/sales/orders/shipping/shipping.entity.js +0 -63
@@ -1,4 +1,5 @@
1
- export declare class AddressEntity extends Map {
1
+ import { MetaAddress } from "../../../../../types";
2
+ export declare class BillingAddressEntity extends Map implements MetaAddress {
2
3
  country: string;
3
4
  code: string;
4
5
  street: string;
@@ -0,0 +1,5 @@
1
+ export declare class BillingCustomerEntity extends Map {
2
+ name: string;
3
+ email: string;
4
+ phone: string;
5
+ }
@@ -0,0 +1,6 @@
1
+ import { BillingStatus } from "../billing.types";
2
+ export declare class BillingStatusEntity {
3
+ name: BillingStatus;
4
+ user: string;
5
+ date: any;
6
+ }
@@ -1,4 +1,5 @@
1
- export declare class AddressValidator {
1
+ import { MetaAddress } from "../../../../../types";
2
+ export declare class BillingAddressValidator implements MetaAddress {
2
3
  country: string;
3
4
  code: string;
4
5
  street: string;
@@ -9,10 +9,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.AddressValidator = void 0;
12
+ exports.BillingAddressValidator = void 0;
13
13
  var class_validator_1 = require("class-validator");
14
- var AddressValidator = (function () {
15
- function AddressValidator() {
14
+ var BillingAddressValidator = (function () {
15
+ function BillingAddressValidator() {
16
16
  this.country = String();
17
17
  this.code = String();
18
18
  this.street = String();
@@ -24,35 +24,33 @@ var AddressValidator = (function () {
24
24
  __decorate([
25
25
  (0, class_validator_1.IsISO31661Alpha2)(),
26
26
  __metadata("design:type", Object)
27
- ], AddressValidator.prototype, "country", void 0);
27
+ ], BillingAddressValidator.prototype, "country", void 0);
28
28
  __decorate([
29
29
  (0, class_validator_1.IsString)(),
30
30
  __metadata("design:type", Object)
31
- ], AddressValidator.prototype, "code", void 0);
31
+ ], BillingAddressValidator.prototype, "code", void 0);
32
32
  __decorate([
33
33
  (0, class_validator_1.IsString)(),
34
34
  __metadata("design:type", Object)
35
- ], AddressValidator.prototype, "street", void 0);
35
+ ], BillingAddressValidator.prototype, "street", void 0);
36
36
  __decorate([
37
37
  (0, class_validator_1.IsString)(),
38
38
  (0, class_validator_1.IsOptional)(),
39
39
  __metadata("design:type", Object)
40
- ], AddressValidator.prototype, "number", void 0);
40
+ ], BillingAddressValidator.prototype, "number", void 0);
41
41
  __decorate([
42
42
  (0, class_validator_1.IsString)(),
43
43
  (0, class_validator_1.IsOptional)(),
44
44
  __metadata("design:type", String)
45
- ], AddressValidator.prototype, "complement", void 0);
45
+ ], BillingAddressValidator.prototype, "complement", void 0);
46
46
  __decorate([
47
47
  (0, class_validator_1.IsString)(),
48
- (0, class_validator_1.IsOptional)(),
49
48
  __metadata("design:type", Object)
50
- ], AddressValidator.prototype, "city", void 0);
49
+ ], BillingAddressValidator.prototype, "city", void 0);
51
50
  __decorate([
52
51
  (0, class_validator_1.IsString)(),
53
- (0, class_validator_1.IsOptional)(),
54
52
  __metadata("design:type", Object)
55
- ], AddressValidator.prototype, "state", void 0);
56
- return AddressValidator;
53
+ ], BillingAddressValidator.prototype, "state", void 0);
54
+ return BillingAddressValidator;
57
55
  }());
58
- exports.AddressValidator = AddressValidator;
56
+ exports.BillingAddressValidator = BillingAddressValidator;
@@ -0,0 +1,5 @@
1
+ export declare class BillingCustomerValidator {
2
+ name: string;
3
+ email: string;
4
+ phone?: string;
5
+ }
@@ -9,29 +9,28 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.StatusEntity = void 0;
13
- var mongoose_1 = require("@nestjs/mongoose");
14
- var schema_decorator_1 = require("@nestjs/mongoose/dist/decorators/schema.decorator");
15
- var mongoose_2 = require("mongoose");
16
- var status_validator_1 = require("./status.validator");
17
- var StatusEntity = (function () {
18
- function StatusEntity() {
12
+ exports.BillingCustomerValidator = void 0;
13
+ var class_validator_1 = require("class-validator");
14
+ var BillingCustomerValidator = (function () {
15
+ function BillingCustomerValidator() {
16
+ this.name = String();
17
+ this.email = String();
18
+ this.phone = undefined;
19
19
  }
20
20
  __decorate([
21
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, enum: status_validator_1.StatusType, required: true }),
22
- __metadata("design:type", String)
23
- ], StatusEntity.prototype, "name", void 0);
24
- __decorate([
25
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
26
- __metadata("design:type", String)
27
- ], StatusEntity.prototype, "user", void 0);
21
+ (0, class_validator_1.IsString)(),
22
+ (0, class_validator_1.IsNotEmpty)(),
23
+ __metadata("design:type", Object)
24
+ ], BillingCustomerValidator.prototype, "name", void 0);
28
25
  __decorate([
29
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date }),
26
+ (0, class_validator_1.IsEmail)(),
30
27
  __metadata("design:type", Object)
31
- ], StatusEntity.prototype, "date", void 0);
32
- StatusEntity = __decorate([
33
- (0, schema_decorator_1.Schema)({ timestamps: true })
34
- ], StatusEntity);
35
- return StatusEntity;
28
+ ], BillingCustomerValidator.prototype, "email", void 0);
29
+ __decorate([
30
+ (0, class_validator_1.IsString)(),
31
+ (0, class_validator_1.IsOptional)(),
32
+ __metadata("design:type", String)
33
+ ], BillingCustomerValidator.prototype, "phone", void 0);
34
+ return BillingCustomerValidator;
36
35
  }());
37
- exports.StatusEntity = StatusEntity;
36
+ exports.BillingCustomerValidator = BillingCustomerValidator;
@@ -1,4 +1,4 @@
1
- export declare class CreateCustomerValidator {
1
+ export declare class CustomerValidator {
2
2
  name: string;
3
3
  email: string;
4
4
  phone?: string;
@@ -9,10 +9,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CreateCustomerValidator = void 0;
12
+ exports.CustomerValidator = void 0;
13
13
  var class_validator_1 = require("class-validator");
14
- var CreateCustomerValidator = (function () {
15
- function CreateCustomerValidator() {
14
+ var CustomerValidator = (function () {
15
+ function CustomerValidator() {
16
16
  this.name = String();
17
17
  this.email = String();
18
18
  this.phone = undefined;
@@ -21,16 +21,16 @@ var CreateCustomerValidator = (function () {
21
21
  (0, class_validator_1.IsString)(),
22
22
  (0, class_validator_1.IsNotEmpty)(),
23
23
  __metadata("design:type", Object)
24
- ], CreateCustomerValidator.prototype, "name", void 0);
24
+ ], CustomerValidator.prototype, "name", void 0);
25
25
  __decorate([
26
26
  (0, class_validator_1.IsEmail)(),
27
27
  __metadata("design:type", Object)
28
- ], CreateCustomerValidator.prototype, "email", void 0);
28
+ ], CustomerValidator.prototype, "email", void 0);
29
29
  __decorate([
30
30
  (0, class_validator_1.IsString)(),
31
31
  (0, class_validator_1.IsOptional)(),
32
32
  __metadata("design:type", String)
33
- ], CreateCustomerValidator.prototype, "phone", void 0);
34
- return CreateCustomerValidator;
33
+ ], CustomerValidator.prototype, "phone", void 0);
34
+ return CustomerValidator;
35
35
  }());
36
- exports.CreateCustomerValidator = CreateCustomerValidator;
36
+ exports.CustomerValidator = CustomerValidator;
@@ -10,7 +10,7 @@ export declare class OrderEntity extends AbstractEntity {
10
10
  number: number;
11
11
  status: StatusEntity[];
12
12
  items: ItemEntity[];
13
- client: ClientEntity;
13
+ client?: ClientEntity;
14
14
  billing: BillingEntity;
15
15
  shipping: ShippingEntity;
16
16
  customer: CustomerEntity;
@@ -0,0 +1,13 @@
1
+ import { NotAcceptableException } from '@nestjs/common/exceptions/not-acceptable.exception';
2
+ import { ItemEntity } from './item/item.entity';
3
+ export declare class OrderWithUnavailableProduct extends NotAcceptableException {
4
+ readonly items: ItemEntity[];
5
+ readonly message = "Some products are not available";
6
+ readonly name: string;
7
+ constructor(items: ItemEntity[]);
8
+ getResponse(): {
9
+ items: ItemEntity[];
10
+ message: string;
11
+ name: string;
12
+ };
13
+ }
@@ -0,0 +1,46 @@
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 __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.OrderWithUnavailableProduct = void 0;
30
+ var not_acceptable_exception_1 = require("@nestjs/common/exceptions/not-acceptable.exception");
31
+ var OrderWithUnavailableProduct = (function (_super) {
32
+ __extends(OrderWithUnavailableProduct, _super);
33
+ function OrderWithUnavailableProduct(items) {
34
+ var _this = _super.call(this) || this;
35
+ _this.items = [];
36
+ _this.message = 'Some products are not available';
37
+ _this.name = OrderWithUnavailableProduct.name;
38
+ _this.items = items;
39
+ return _this;
40
+ }
41
+ OrderWithUnavailableProduct.prototype.getResponse = function () {
42
+ return __assign(__assign({}, _super.prototype.getResponse.call(this)), { items: this.items, message: this.message, name: this.name });
43
+ };
44
+ return OrderWithUnavailableProduct;
45
+ }(not_acceptable_exception_1.NotAcceptableException));
46
+ exports.OrderWithUnavailableProduct = OrderWithUnavailableProduct;
@@ -2,14 +2,14 @@ import { CreateBillingValidator } from './billing/billing.validator';
2
2
  import { CreateItemValidator } from './item/item.validator';
3
3
  import { CreateShippingValidator } from './shipping/shipping.validator';
4
4
  import { StatusType } from './status/status.validator';
5
- import { CreateCustomerValidator } from "./customer/customer.validator";
5
+ import { CustomerValidator } from "./customer/customer.validator";
6
6
  import { AbstractValidator } from "../../../abstract/abstract.validator";
7
7
  export declare class CreateOrderValidator extends AbstractValidator {
8
8
  client?: string;
9
9
  items: CreateItemValidator[];
10
10
  billing: CreateBillingValidator;
11
11
  shipping: CreateShippingValidator;
12
- customer: CreateCustomerValidator;
12
+ customer?: CustomerValidator;
13
13
  notes?: string;
14
14
  }
15
15
  export declare class UpdateOrderValidator extends CreateOrderValidator {
@@ -40,7 +40,6 @@ var CreateOrderValidator = (function (_super) {
40
40
  _this.items = [];
41
41
  _this.billing = new billing_validator_1.CreateBillingValidator();
42
42
  _this.shipping = new shipping_validator_1.CreateShippingValidator();
43
- _this.customer = new customer_validator_1.CreateCustomerValidator();
44
43
  return _this;
45
44
  }
46
45
  __decorate([
@@ -68,9 +67,9 @@ var CreateOrderValidator = (function (_super) {
68
67
  ], CreateOrderValidator.prototype, "shipping", void 0);
69
68
  __decorate([
70
69
  (0, class_validator_1.ValidateNested)(),
71
- (0, class_transformer_1.Type)(function () { return customer_validator_1.CreateCustomerValidator; }),
72
- (0, class_validator_1.IsNotEmptyObject)(),
73
- __metadata("design:type", Object)
70
+ (0, class_transformer_1.Type)(function () { return customer_validator_1.CustomerValidator; }),
71
+ (0, class_validator_1.IsOptional)(),
72
+ __metadata("design:type", customer_validator_1.CustomerValidator)
74
73
  ], CreateOrderValidator.prototype, "customer", void 0);
75
74
  __decorate([
76
75
  (0, class_validator_1.IsOptional)(),
@@ -0,0 +1,10 @@
1
+ import { MetaAddress } from "../../../../../types";
2
+ export declare class ShippingAddressEntity extends Map implements MetaAddress {
3
+ country: string;
4
+ code: string;
5
+ street: string;
6
+ number: string;
7
+ complement: string;
8
+ city: string;
9
+ state: string;
10
+ }
@@ -0,0 +1,5 @@
1
+ export declare class ShippingCustomerEntity extends Map {
2
+ name: string;
3
+ email: string;
4
+ phone: string;
5
+ }
@@ -0,0 +1,6 @@
1
+ import { ShippingStatus } from "../shipping.types";
2
+ export declare class ShippingStatusEntity {
3
+ name: ShippingStatus;
4
+ user: string;
5
+ date: any;
6
+ }
@@ -1,9 +1,11 @@
1
- import { CustomerEntity } from "../customer/customer.entity";
2
- import { AddressEntity } from "../address/address.entity";
3
- import { ShippingType } from "./shipping.validator";
1
+ import { ShippingMethod } from "./shipping.types";
2
+ import { ShippingAddressEntity } from "./entities/address.entity";
3
+ import { ShippingCustomerEntity } from "./entities/customer.entity";
4
+ import { ShippingStatusEntity } from "./entities/status.entity";
4
5
  export declare class ShippingEntity extends Map {
5
- address: AddressEntity;
6
- customer: CustomerEntity;
7
- type: ShippingType;
6
+ address: ShippingAddressEntity;
7
+ customer: ShippingCustomerEntity;
8
+ method: ShippingMethod;
8
9
  price: number;
10
+ status: ShippingStatusEntity[];
9
11
  }
@@ -0,0 +1,11 @@
1
+ export declare enum ShippingMethod {
2
+ RETIRE_ON_SITE = "RETIRE ON SITE",
3
+ DIRECT_DELIVERY = "DIRECT DELIVERY"
4
+ }
5
+ export declare enum ShippingStatus {
6
+ ORDERED = "ORDERED",
7
+ PACKED = "PACKED",
8
+ IN_TRANSIT = "IN_TRANSIT",
9
+ FAILED = "FAILED",
10
+ DELIVERED = "DELIVERED"
11
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ShippingStatus = exports.ShippingMethod = void 0;
4
+ var ShippingMethod;
5
+ (function (ShippingMethod) {
6
+ ShippingMethod["RETIRE_ON_SITE"] = "RETIRE ON SITE";
7
+ ShippingMethod["DIRECT_DELIVERY"] = "DIRECT DELIVERY";
8
+ })(ShippingMethod = exports.ShippingMethod || (exports.ShippingMethod = {}));
9
+ var ShippingStatus;
10
+ (function (ShippingStatus) {
11
+ ShippingStatus["ORDERED"] = "ORDERED";
12
+ ShippingStatus["PACKED"] = "PACKED";
13
+ ShippingStatus["IN_TRANSIT"] = "IN_TRANSIT";
14
+ ShippingStatus["FAILED"] = "FAILED";
15
+ ShippingStatus["DELIVERED"] = "DELIVERED";
16
+ })(ShippingStatus = exports.ShippingStatus || (exports.ShippingStatus = {}));
@@ -1,13 +1,10 @@
1
- import { AddressValidator } from "../address/address.validator";
2
- import { CreateCustomerValidator } from "../customer/customer.validator";
1
+ import { ShippingMethod } from "./shipping.types";
3
2
  import 'reflect-metadata';
4
- export declare enum ShippingType {
5
- RETIRE_ON_SITE = "RETIRE ON SITE",
6
- DIRECT_DELIVERY = "DIRECT DELIVERY"
7
- }
3
+ import { ShippingAddressValidator } from "./validators/address.validator";
4
+ import { ShippingCustomerValidator } from "./validators/customer.validator";
8
5
  export declare class CreateShippingValidator {
9
- customer: CreateCustomerValidator;
10
- address: AddressValidator;
11
- type: ShippingType;
6
+ customer: ShippingCustomerValidator;
7
+ address: ShippingAddressValidator;
8
+ method: ShippingMethod;
12
9
  price: number;
13
10
  }
@@ -9,39 +9,35 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CreateShippingValidator = exports.ShippingType = void 0;
12
+ exports.CreateShippingValidator = void 0;
13
13
  var class_transformer_1 = require("class-transformer");
14
14
  var class_validator_1 = require("class-validator");
15
- var address_validator_1 = require("../address/address.validator");
16
- var customer_validator_1 = require("../customer/customer.validator");
15
+ var shipping_types_1 = require("./shipping.types");
17
16
  require("reflect-metadata");
18
- var ShippingType;
19
- (function (ShippingType) {
20
- ShippingType["RETIRE_ON_SITE"] = "RETIRE ON SITE";
21
- ShippingType["DIRECT_DELIVERY"] = "DIRECT DELIVERY";
22
- })(ShippingType = exports.ShippingType || (exports.ShippingType = {}));
17
+ var address_validator_1 = require("./validators/address.validator");
18
+ var customer_validator_1 = require("./validators/customer.validator");
23
19
  var CreateShippingValidator = (function () {
24
20
  function CreateShippingValidator() {
25
- this.customer = new customer_validator_1.CreateCustomerValidator();
26
- this.address = new address_validator_1.AddressValidator();
21
+ this.customer = new customer_validator_1.ShippingCustomerValidator();
22
+ this.address = new address_validator_1.ShippingAddressValidator();
27
23
  this.price = 0;
28
24
  }
29
25
  __decorate([
30
26
  (0, class_validator_1.ValidateNested)(),
31
- (0, class_transformer_1.Type)(function () { return customer_validator_1.CreateCustomerValidator; }),
27
+ (0, class_transformer_1.Type)(function () { return customer_validator_1.ShippingCustomerValidator; }),
32
28
  (0, class_validator_1.IsNotEmptyObject)(),
33
29
  __metadata("design:type", Object)
34
30
  ], CreateShippingValidator.prototype, "customer", void 0);
35
31
  __decorate([
36
32
  (0, class_validator_1.ValidateNested)(),
37
- (0, class_transformer_1.Type)(function () { return address_validator_1.AddressValidator; }),
33
+ (0, class_transformer_1.Type)(function () { return address_validator_1.ShippingAddressValidator; }),
38
34
  (0, class_validator_1.IsNotEmptyObject)(),
39
35
  __metadata("design:type", Object)
40
36
  ], CreateShippingValidator.prototype, "address", void 0);
41
37
  __decorate([
42
- (0, class_validator_1.IsEnum)(ShippingType),
38
+ (0, class_validator_1.IsEnum)(shipping_types_1.ShippingMethod),
43
39
  __metadata("design:type", String)
44
- ], CreateShippingValidator.prototype, "type", void 0);
40
+ ], CreateShippingValidator.prototype, "method", void 0);
45
41
  __decorate([
46
42
  (0, class_validator_1.IsNumber)(),
47
43
  (0, class_validator_1.Min)(0),
@@ -0,0 +1,10 @@
1
+ import { MetaAddress } from "../../../../../types";
2
+ export declare class ShippingAddressValidator implements MetaAddress {
3
+ country: string;
4
+ code: string;
5
+ street: string;
6
+ number: string;
7
+ complement?: string;
8
+ city: string;
9
+ state: string;
10
+ }
@@ -0,0 +1,56 @@
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
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ShippingAddressValidator = void 0;
13
+ var class_validator_1 = require("class-validator");
14
+ var ShippingAddressValidator = (function () {
15
+ function ShippingAddressValidator() {
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();
23
+ }
24
+ __decorate([
25
+ (0, class_validator_1.IsISO31661Alpha2)(),
26
+ __metadata("design:type", Object)
27
+ ], ShippingAddressValidator.prototype, "country", void 0);
28
+ __decorate([
29
+ (0, class_validator_1.IsString)(),
30
+ __metadata("design:type", Object)
31
+ ], ShippingAddressValidator.prototype, "code", void 0);
32
+ __decorate([
33
+ (0, class_validator_1.IsString)(),
34
+ __metadata("design:type", Object)
35
+ ], ShippingAddressValidator.prototype, "street", void 0);
36
+ __decorate([
37
+ (0, class_validator_1.IsString)(),
38
+ (0, class_validator_1.IsOptional)(),
39
+ __metadata("design:type", Object)
40
+ ], ShippingAddressValidator.prototype, "number", void 0);
41
+ __decorate([
42
+ (0, class_validator_1.IsString)(),
43
+ (0, class_validator_1.IsOptional)(),
44
+ __metadata("design:type", String)
45
+ ], ShippingAddressValidator.prototype, "complement", void 0);
46
+ __decorate([
47
+ (0, class_validator_1.IsString)(),
48
+ __metadata("design:type", Object)
49
+ ], ShippingAddressValidator.prototype, "city", void 0);
50
+ __decorate([
51
+ (0, class_validator_1.IsString)(),
52
+ __metadata("design:type", Object)
53
+ ], ShippingAddressValidator.prototype, "state", void 0);
54
+ return ShippingAddressValidator;
55
+ }());
56
+ exports.ShippingAddressValidator = ShippingAddressValidator;
@@ -0,0 +1,5 @@
1
+ export declare class ShippingCustomerValidator {
2
+ name: string;
3
+ email: string;
4
+ phone?: string;
5
+ }
@@ -0,0 +1,36 @@
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
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ShippingCustomerValidator = void 0;
13
+ var class_validator_1 = require("class-validator");
14
+ var ShippingCustomerValidator = (function () {
15
+ function ShippingCustomerValidator() {
16
+ this.name = String();
17
+ this.email = String();
18
+ this.phone = undefined;
19
+ }
20
+ __decorate([
21
+ (0, class_validator_1.IsString)(),
22
+ (0, class_validator_1.IsNotEmpty)(),
23
+ __metadata("design:type", Object)
24
+ ], ShippingCustomerValidator.prototype, "name", void 0);
25
+ __decorate([
26
+ (0, class_validator_1.IsEmail)(),
27
+ __metadata("design:type", Object)
28
+ ], ShippingCustomerValidator.prototype, "email", void 0);
29
+ __decorate([
30
+ (0, class_validator_1.IsString)(),
31
+ (0, class_validator_1.IsOptional)(),
32
+ __metadata("design:type", String)
33
+ ], ShippingCustomerValidator.prototype, "phone", void 0);
34
+ return ShippingCustomerValidator;
35
+ }());
36
+ exports.ShippingCustomerValidator = ShippingCustomerValidator;
@@ -0,0 +1,11 @@
1
+ import { LoggerService as NestLogger } from '@nestjs/common';
2
+ import { Request } from 'express';
3
+ export declare class LoggerService implements NestLogger {
4
+ protected readonly $request: Request;
5
+ protected get organization(): any;
6
+ log(message: string): void;
7
+ error(reason: Error): void;
8
+ warn(message: string, scope?: string): void;
9
+ debug(message: string, scope?: string): void;
10
+ verbose(message: string, scope?: string): void;
11
+ }
@@ -0,0 +1,54 @@
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
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.LoggerService = void 0;
13
+ var common_1 = require("@nestjs/common");
14
+ var core_1 = require("@nestjs/core");
15
+ var LoggerService = (function () {
16
+ function LoggerService() {
17
+ }
18
+ Object.defineProperty(LoggerService.prototype, "organization", {
19
+ get: function () {
20
+ var _a;
21
+ var session = this.$request.session;
22
+ if (!session) {
23
+ return;
24
+ }
25
+ return ((_a = session.organization) === null || _a === void 0 ? void 0 : _a.name) || '';
26
+ },
27
+ enumerable: false,
28
+ configurable: true
29
+ });
30
+ LoggerService.prototype.log = function (message) {
31
+ return common_1.Logger.log(message, this.organization);
32
+ };
33
+ LoggerService.prototype.error = function (reason) {
34
+ return common_1.Logger.error("[" + reason.name + "]: " + reason.message, this.organization);
35
+ };
36
+ LoggerService.prototype.warn = function (message, scope) {
37
+ return common_1.Logger.warn("[" + scope + "]: " + message, this.organization);
38
+ };
39
+ LoggerService.prototype.debug = function (message, scope) {
40
+ return common_1.Logger.debug("[" + scope + "]: " + message, this.organization);
41
+ };
42
+ LoggerService.prototype.verbose = function (message, scope) {
43
+ return common_1.Logger.verbose("[" + scope + "]: " + message, this.organization);
44
+ };
45
+ __decorate([
46
+ (0, common_1.Inject)(core_1.REQUEST),
47
+ __metadata("design:type", Object)
48
+ ], LoggerService.prototype, "$request", void 0);
49
+ LoggerService = __decorate([
50
+ (0, common_1.Injectable)()
51
+ ], LoggerService);
52
+ return LoggerService;
53
+ }());
54
+ exports.LoggerService = LoggerService;