@merkaly/api 0.2.4-4 → 0.2.4-6

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 (38) hide show
  1. package/.output/abstract/abstract.validator.d.ts +1 -1
  2. package/.output/modules/sales/orders/billing/billing.entity.d.ts +8 -6
  3. package/.output/modules/sales/orders/billing/billing.entity.js +14 -9
  4. package/.output/modules/sales/orders/billing/billing.types.d.ts +9 -0
  5. package/.output/modules/sales/orders/billing/billing.types.js +14 -0
  6. package/.output/modules/sales/orders/billing/billing.validator.d.ts +6 -10
  7. package/.output/modules/sales/orders/billing/billing.validator.js +10 -15
  8. package/.output/modules/sales/orders/{address → billing/entities}/address.entity.d.ts +2 -1
  9. package/.output/modules/sales/orders/{address → billing/entities}/address.entity.js +17 -17
  10. package/.output/modules/sales/orders/billing/entities/customer.entity.d.ts +5 -0
  11. package/.output/modules/sales/orders/billing/entities/customer.entity.js +52 -0
  12. package/.output/modules/sales/orders/billing/entities/status.entity.d.ts +6 -0
  13. package/.output/modules/sales/orders/billing/entities/status.entity.js +37 -0
  14. package/.output/modules/sales/orders/{address → billing/validators}/address.validator.d.ts +2 -1
  15. package/.output/modules/sales/orders/{address → billing/validators}/address.validator.js +12 -14
  16. package/.output/modules/sales/orders/billing/validators/customer.validator.d.ts +5 -0
  17. package/.output/modules/sales/orders/billing/validators/customer.validator.js +36 -0
  18. package/.output/modules/sales/orders/customer/customer.validator.d.ts +1 -1
  19. package/.output/modules/sales/orders/customer/customer.validator.js +8 -8
  20. package/.output/modules/sales/orders/order.validator.d.ts +2 -2
  21. package/.output/modules/sales/orders/order.validator.js +2 -2
  22. package/.output/modules/sales/orders/shipping/entities/address.entity.d.ts +10 -0
  23. package/.output/modules/sales/orders/shipping/entities/address.entity.js +68 -0
  24. package/.output/modules/sales/orders/shipping/entities/customer.entity.d.ts +5 -0
  25. package/.output/modules/sales/orders/shipping/entities/customer.entity.js +52 -0
  26. package/.output/modules/sales/orders/shipping/entities/status.entity.d.ts +6 -0
  27. package/.output/modules/sales/orders/shipping/entities/status.entity.js +37 -0
  28. package/.output/modules/sales/orders/shipping/shipping.entity.d.ts +8 -6
  29. package/.output/modules/sales/orders/shipping/shipping.entity.js +14 -9
  30. package/.output/modules/sales/orders/shipping/shipping.types.d.ts +11 -0
  31. package/.output/modules/sales/orders/shipping/shipping.types.js +16 -0
  32. package/.output/modules/sales/orders/shipping/shipping.validator.d.ts +6 -9
  33. package/.output/modules/sales/orders/shipping/shipping.validator.js +10 -14
  34. package/.output/modules/sales/orders/shipping/validators/address.validator.d.ts +10 -0
  35. package/.output/modules/sales/orders/shipping/validators/address.validator.js +56 -0
  36. package/.output/modules/sales/orders/shipping/validators/customer.validator.d.ts +5 -0
  37. package/.output/modules/sales/orders/shipping/validators/customer.validator.js +36 -0
  38. package/package.json +1 -1
@@ -9,7 +9,7 @@ export interface SearchResults<I> {
9
9
  export declare abstract class AbstractValidator {
10
10
  }
11
11
  export declare type KeyOfType<T, V> = keyof {
12
- [P in keyof T as T[P] extends V ? P : never]: any;
12
+ [P in keyof T as T[P] extends V ? P : string]: any;
13
13
  };
14
14
  export declare class FindValidator<E extends AbstractEntity> extends AbstractValidator {
15
15
  limit?: number;
@@ -1,8 +1,10 @@
1
- import { AddressEntity } from "../address/address.entity";
2
- import { CustomerEntity } from "../customer/customer.entity";
3
- import { BillingType } from "./billing.validator";
1
+ import { BillingMethod } from "./billing.types";
2
+ import { BillingStatusEntity } from "./entities/status.entity";
3
+ import { BillingAddressEntity } from "./entities/address.entity";
4
+ import { BillingCustomerEntity } from "./entities/customer.entity";
4
5
  export declare class BillingEntity extends Map {
5
- address: AddressEntity;
6
- customer: CustomerEntity;
7
- type: BillingType;
6
+ address: BillingAddressEntity;
7
+ customer: BillingCustomerEntity;
8
+ method: BillingMethod;
9
+ status: BillingStatusEntity[];
8
10
  }
@@ -28,29 +28,34 @@ exports.BillingEntity = void 0;
28
28
  var mongoose_1 = require("@nestjs/mongoose");
29
29
  var schema_decorator_1 = require("@nestjs/mongoose/dist/decorators/schema.decorator");
30
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");
31
+ var billing_types_1 = require("./billing.types");
32
+ var address_entity_1 = require("./entities/address.entity");
33
+ var customer_entity_1 = require("./entities/customer.entity");
34
34
  var BillingEntity = (function (_super) {
35
35
  __extends(BillingEntity, _super);
36
36
  function BillingEntity() {
37
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();
38
+ _this.address = new address_entity_1.BillingAddressEntity();
39
+ _this.customer = new customer_entity_1.BillingCustomerEntity();
40
+ _this.status = [];
40
41
  return _this;
41
42
  }
42
43
  __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
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Map, ref: function () { return address_entity_1.BillingAddressEntity; }, default: new address_entity_1.BillingAddressEntity() }),
44
45
  __metadata("design:type", Object)
45
46
  ], BillingEntity.prototype, "address", void 0);
46
47
  __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
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Map, ref: function () { return customer_entity_1.BillingCustomerEntity; }, default: new customer_entity_1.BillingCustomerEntity() }),
48
49
  __metadata("design:type", Object)
49
50
  ], BillingEntity.prototype, "customer", void 0);
50
51
  __decorate([
51
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, enum: billing_validator_1.BillingType, required: true }),
52
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, enum: billing_types_1.BillingMethod, required: true }),
52
53
  __metadata("design:type", String)
53
- ], BillingEntity.prototype, "type", void 0);
54
+ ], BillingEntity.prototype, "method", void 0);
55
+ __decorate([
56
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Array, default: [] }),
57
+ __metadata("design:type", Array)
58
+ ], BillingEntity.prototype, "status", void 0);
54
59
  BillingEntity = __decorate([
55
60
  (0, schema_decorator_1.Schema)({})
56
61
  ], BillingEntity);
@@ -0,0 +1,9 @@
1
+ export declare enum BillingMethod {
2
+ CASH = "CASH",
3
+ CARD = "CARD",
4
+ TRANSFER = "TRANSFER"
5
+ }
6
+ export declare enum BillingStatus {
7
+ UNPAID = "UNPAID",
8
+ PAID = "PAID"
9
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BillingStatus = exports.BillingMethod = void 0;
4
+ var BillingMethod;
5
+ (function (BillingMethod) {
6
+ BillingMethod["CASH"] = "CASH";
7
+ BillingMethod["CARD"] = "CARD";
8
+ BillingMethod["TRANSFER"] = "TRANSFER";
9
+ })(BillingMethod = exports.BillingMethod || (exports.BillingMethod = {}));
10
+ var BillingStatus;
11
+ (function (BillingStatus) {
12
+ BillingStatus["UNPAID"] = "UNPAID";
13
+ BillingStatus["PAID"] = "PAID";
14
+ })(BillingStatus = exports.BillingStatus || (exports.BillingStatus = {}));
@@ -1,13 +1,9 @@
1
- import { AddressValidator } from "../address/address.validator";
2
- import { CreateCustomerValidator } from "../customer/customer.validator";
3
1
  import 'reflect-metadata';
4
- export declare enum BillingType {
5
- CASH = "CASH",
6
- CARD = "CARD",
7
- TRANSFER = "TRANSFER"
8
- }
2
+ import { BillingMethod } from "./billing.types";
3
+ import { BillingCustomerValidator } from "./validators/customer.validator";
4
+ import { BillingAddressValidator } from "./validators/address.validator";
9
5
  export declare class CreateBillingValidator {
10
- customer: CreateCustomerValidator;
11
- address: AddressValidator;
12
- type: BillingType;
6
+ customer: BillingCustomerValidator;
7
+ address: BillingAddressValidator;
8
+ method: BillingMethod;
13
9
  }
@@ -9,39 +9,34 @@ 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.CreateBillingValidator = exports.BillingType = void 0;
12
+ exports.CreateBillingValidator = 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");
17
15
  require("reflect-metadata");
18
- var BillingType;
19
- (function (BillingType) {
20
- BillingType["CASH"] = "CASH";
21
- BillingType["CARD"] = "CARD";
22
- BillingType["TRANSFER"] = "TRANSFER";
23
- })(BillingType = exports.BillingType || (exports.BillingType = {}));
16
+ var billing_types_1 = require("./billing.types");
17
+ var customer_validator_1 = require("./validators/customer.validator");
18
+ var address_validator_1 = require("./validators/address.validator");
24
19
  var CreateBillingValidator = (function () {
25
20
  function CreateBillingValidator() {
26
- this.customer = new customer_validator_1.CreateCustomerValidator();
27
- this.address = new address_validator_1.AddressValidator();
21
+ this.customer = new customer_validator_1.BillingCustomerValidator();
22
+ this.address = new address_validator_1.BillingAddressValidator();
28
23
  }
29
24
  __decorate([
30
25
  (0, class_validator_1.ValidateNested)(),
31
- (0, class_transformer_1.Type)(function () { return customer_validator_1.CreateCustomerValidator; }),
26
+ (0, class_transformer_1.Type)(function () { return customer_validator_1.BillingCustomerValidator; }),
32
27
  (0, class_validator_1.IsNotEmptyObject)(),
33
28
  __metadata("design:type", Object)
34
29
  ], CreateBillingValidator.prototype, "customer", void 0);
35
30
  __decorate([
36
31
  (0, class_validator_1.ValidateNested)(),
37
- (0, class_transformer_1.Type)(function () { return address_validator_1.AddressValidator; }),
32
+ (0, class_transformer_1.Type)(function () { return address_validator_1.BillingAddressValidator; }),
38
33
  (0, class_validator_1.IsNotEmptyObject)(),
39
34
  __metadata("design:type", Object)
40
35
  ], CreateBillingValidator.prototype, "address", void 0);
41
36
  __decorate([
42
- (0, class_validator_1.IsEnum)(BillingType),
37
+ (0, class_validator_1.IsEnum)(billing_types_1.BillingMethod),
43
38
  __metadata("design:type", String)
44
- ], CreateBillingValidator.prototype, "type", void 0);
39
+ ], CreateBillingValidator.prototype, "method", void 0);
45
40
  return CreateBillingValidator;
46
41
  }());
47
42
  exports.CreateBillingValidator = CreateBillingValidator;
@@ -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;
@@ -24,45 +24,45 @@ var __metadata = (this && this.__metadata) || function (k, v) {
24
24
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.AddressEntity = void 0;
27
+ exports.BillingAddressEntity = void 0;
28
28
  var mongoose_1 = require("@nestjs/mongoose");
29
29
  var mongoose_2 = require("mongoose");
30
- var AddressEntity = (function (_super) {
31
- __extends(AddressEntity, _super);
32
- function AddressEntity() {
30
+ var BillingAddressEntity = (function (_super) {
31
+ __extends(BillingAddressEntity, _super);
32
+ function BillingAddressEntity() {
33
33
  return _super !== null && _super.apply(this, arguments) || this;
34
34
  }
35
35
  __decorate([
36
36
  (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true }),
37
37
  __metadata("design:type", String)
38
- ], AddressEntity.prototype, "country", void 0);
38
+ ], BillingAddressEntity.prototype, "country", void 0);
39
39
  __decorate([
40
40
  (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true }),
41
41
  __metadata("design:type", String)
42
- ], AddressEntity.prototype, "code", void 0);
42
+ ], BillingAddressEntity.prototype, "code", void 0);
43
43
  __decorate([
44
44
  (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true }),
45
45
  __metadata("design:type", String)
46
- ], AddressEntity.prototype, "street", void 0);
46
+ ], BillingAddressEntity.prototype, "street", void 0);
47
47
  __decorate([
48
48
  (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
49
49
  __metadata("design:type", String)
50
- ], AddressEntity.prototype, "number", void 0);
50
+ ], BillingAddressEntity.prototype, "number", void 0);
51
51
  __decorate([
52
52
  (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
53
53
  __metadata("design:type", String)
54
- ], AddressEntity.prototype, "complement", void 0);
54
+ ], BillingAddressEntity.prototype, "complement", void 0);
55
55
  __decorate([
56
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
56
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true }),
57
57
  __metadata("design:type", String)
58
- ], AddressEntity.prototype, "city", void 0);
58
+ ], BillingAddressEntity.prototype, "city", void 0);
59
59
  __decorate([
60
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
60
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true }),
61
61
  __metadata("design:type", String)
62
- ], AddressEntity.prototype, "state", void 0);
63
- AddressEntity = __decorate([
62
+ ], BillingAddressEntity.prototype, "state", void 0);
63
+ BillingAddressEntity = __decorate([
64
64
  (0, mongoose_1.Schema)()
65
- ], AddressEntity);
66
- return AddressEntity;
65
+ ], BillingAddressEntity);
66
+ return BillingAddressEntity;
67
67
  }(Map));
68
- exports.AddressEntity = AddressEntity;
68
+ exports.BillingAddressEntity = BillingAddressEntity;
@@ -0,0 +1,5 @@
1
+ export declare class BillingCustomerEntity extends Map {
2
+ name: string;
3
+ email: string;
4
+ phone: string;
5
+ }
@@ -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.BillingCustomerEntity = void 0;
28
+ var mongoose_1 = require("@nestjs/mongoose");
29
+ var mongoose_2 = require("mongoose");
30
+ var BillingCustomerEntity = (function (_super) {
31
+ __extends(BillingCustomerEntity, _super);
32
+ function BillingCustomerEntity() {
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
+ ], BillingCustomerEntity.prototype, "name", void 0);
39
+ __decorate([
40
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
41
+ __metadata("design:type", String)
42
+ ], BillingCustomerEntity.prototype, "email", void 0);
43
+ __decorate([
44
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
45
+ __metadata("design:type", String)
46
+ ], BillingCustomerEntity.prototype, "phone", void 0);
47
+ BillingCustomerEntity = __decorate([
48
+ (0, mongoose_1.Schema)({})
49
+ ], BillingCustomerEntity);
50
+ return BillingCustomerEntity;
51
+ }(Map));
52
+ exports.BillingCustomerEntity = BillingCustomerEntity;
@@ -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
+ }
@@ -0,0 +1,37 @@
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.BillingStatusEntity = 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 billing_types_1 = require("../billing.types");
17
+ var BillingStatusEntity = (function () {
18
+ function BillingStatusEntity() {
19
+ }
20
+ __decorate([
21
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, enum: billing_types_1.BillingStatus, required: true }),
22
+ __metadata("design:type", String)
23
+ ], BillingStatusEntity.prototype, "name", void 0);
24
+ __decorate([
25
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
26
+ __metadata("design:type", String)
27
+ ], BillingStatusEntity.prototype, "user", void 0);
28
+ __decorate([
29
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date }),
30
+ __metadata("design:type", Object)
31
+ ], BillingStatusEntity.prototype, "date", void 0);
32
+ BillingStatusEntity = __decorate([
33
+ (0, schema_decorator_1.Schema)({ timestamps: true })
34
+ ], BillingStatusEntity);
35
+ return BillingStatusEntity;
36
+ }());
37
+ exports.BillingStatusEntity = BillingStatusEntity;
@@ -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
+ }
@@ -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.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
+ }
20
+ __decorate([
21
+ (0, class_validator_1.IsString)(),
22
+ (0, class_validator_1.IsNotEmpty)(),
23
+ __metadata("design:type", Object)
24
+ ], BillingCustomerValidator.prototype, "name", void 0);
25
+ __decorate([
26
+ (0, class_validator_1.IsEmail)(),
27
+ __metadata("design:type", Object)
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;
35
+ }());
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;
@@ -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,7 @@ 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();
43
+ _this.customer = new customer_validator_1.CustomerValidator();
44
44
  return _this;
45
45
  }
46
46
  __decorate([
@@ -68,7 +68,7 @@ var CreateOrderValidator = (function (_super) {
68
68
  ], CreateOrderValidator.prototype, "shipping", void 0);
69
69
  __decorate([
70
70
  (0, class_validator_1.ValidateNested)(),
71
- (0, class_transformer_1.Type)(function () { return customer_validator_1.CreateCustomerValidator; }),
71
+ (0, class_transformer_1.Type)(function () { return customer_validator_1.CustomerValidator; }),
72
72
  (0, class_validator_1.IsNotEmptyObject)(),
73
73
  __metadata("design:type", Object)
74
74
  ], CreateOrderValidator.prototype, "customer", void 0);
@@ -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,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.ShippingAddressEntity = void 0;
28
+ var mongoose_1 = require("@nestjs/mongoose");
29
+ var mongoose_2 = require("mongoose");
30
+ var ShippingAddressEntity = (function (_super) {
31
+ __extends(ShippingAddressEntity, _super);
32
+ function ShippingAddressEntity() {
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
+ ], ShippingAddressEntity.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
+ ], ShippingAddressEntity.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
+ ], ShippingAddressEntity.prototype, "street", void 0);
47
+ __decorate([
48
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
49
+ __metadata("design:type", String)
50
+ ], ShippingAddressEntity.prototype, "number", void 0);
51
+ __decorate([
52
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
53
+ __metadata("design:type", String)
54
+ ], ShippingAddressEntity.prototype, "complement", void 0);
55
+ __decorate([
56
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true }),
57
+ __metadata("design:type", String)
58
+ ], ShippingAddressEntity.prototype, "city", void 0);
59
+ __decorate([
60
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true }),
61
+ __metadata("design:type", String)
62
+ ], ShippingAddressEntity.prototype, "state", void 0);
63
+ ShippingAddressEntity = __decorate([
64
+ (0, mongoose_1.Schema)()
65
+ ], ShippingAddressEntity);
66
+ return ShippingAddressEntity;
67
+ }(Map));
68
+ exports.ShippingAddressEntity = ShippingAddressEntity;
@@ -0,0 +1,5 @@
1
+ export declare class ShippingCustomerEntity extends Map {
2
+ name: string;
3
+ email: string;
4
+ phone: string;
5
+ }
@@ -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.ShippingCustomerEntity = void 0;
28
+ var mongoose_1 = require("@nestjs/mongoose");
29
+ var mongoose_2 = require("mongoose");
30
+ var ShippingCustomerEntity = (function (_super) {
31
+ __extends(ShippingCustomerEntity, _super);
32
+ function ShippingCustomerEntity() {
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
+ ], ShippingCustomerEntity.prototype, "name", void 0);
39
+ __decorate([
40
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
41
+ __metadata("design:type", String)
42
+ ], ShippingCustomerEntity.prototype, "email", void 0);
43
+ __decorate([
44
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
45
+ __metadata("design:type", String)
46
+ ], ShippingCustomerEntity.prototype, "phone", void 0);
47
+ ShippingCustomerEntity = __decorate([
48
+ (0, mongoose_1.Schema)()
49
+ ], ShippingCustomerEntity);
50
+ return ShippingCustomerEntity;
51
+ }(Map));
52
+ exports.ShippingCustomerEntity = ShippingCustomerEntity;
@@ -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
+ }
@@ -0,0 +1,37 @@
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.ShippingStatusEntity = 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 shipping_types_1 = require("../shipping.types");
17
+ var ShippingStatusEntity = (function () {
18
+ function ShippingStatusEntity() {
19
+ }
20
+ __decorate([
21
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, enum: shipping_types_1.ShippingStatus, required: true }),
22
+ __metadata("design:type", String)
23
+ ], ShippingStatusEntity.prototype, "name", void 0);
24
+ __decorate([
25
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
26
+ __metadata("design:type", String)
27
+ ], ShippingStatusEntity.prototype, "user", void 0);
28
+ __decorate([
29
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date }),
30
+ __metadata("design:type", Object)
31
+ ], ShippingStatusEntity.prototype, "date", void 0);
32
+ ShippingStatusEntity = __decorate([
33
+ (0, schema_decorator_1.Schema)({ timestamps: true })
34
+ ], ShippingStatusEntity);
35
+ return ShippingStatusEntity;
36
+ }());
37
+ exports.ShippingStatusEntity = ShippingStatusEntity;
@@ -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
  }
@@ -28,33 +28,38 @@ exports.ShippingEntity = void 0;
28
28
  var mongoose_1 = require("@nestjs/mongoose");
29
29
  var schema_decorator_1 = require("@nestjs/mongoose/dist/decorators/schema.decorator");
30
30
  var mongoose_2 = require("mongoose");
31
- var customer_entity_1 = require("../customer/customer.entity");
32
- var address_entity_1 = require("../address/address.entity");
33
- var shipping_validator_1 = require("./shipping.validator");
31
+ var shipping_types_1 = require("./shipping.types");
32
+ var address_entity_1 = require("./entities/address.entity");
33
+ var customer_entity_1 = require("./entities/customer.entity");
34
34
  var ShippingEntity = (function (_super) {
35
35
  __extends(ShippingEntity, _super);
36
36
  function ShippingEntity() {
37
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();
38
+ _this.address = new address_entity_1.ShippingAddressEntity();
39
+ _this.customer = new customer_entity_1.ShippingCustomerEntity();
40
+ _this.status = [];
40
41
  return _this;
41
42
  }
42
43
  __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
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Map, ref: function () { return address_entity_1.ShippingAddressEntity; }, default: new address_entity_1.ShippingAddressEntity() }),
44
45
  __metadata("design:type", Object)
45
46
  ], ShippingEntity.prototype, "address", void 0);
46
47
  __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
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Map, ref: function () { return customer_entity_1.ShippingCustomerEntity; }, default: new customer_entity_1.ShippingCustomerEntity() }),
48
49
  __metadata("design:type", Object)
49
50
  ], ShippingEntity.prototype, "customer", void 0);
50
51
  __decorate([
51
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, enum: shipping_validator_1.ShippingType, required: true }),
52
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, enum: shipping_types_1.ShippingMethod, required: true }),
52
53
  __metadata("design:type", String)
53
- ], ShippingEntity.prototype, "type", void 0);
54
+ ], ShippingEntity.prototype, "method", void 0);
54
55
  __decorate([
55
56
  (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Number, default: 0 }),
56
57
  __metadata("design:type", Number)
57
58
  ], ShippingEntity.prototype, "price", void 0);
59
+ __decorate([
60
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Array, default: [] }),
61
+ __metadata("design:type", Array)
62
+ ], ShippingEntity.prototype, "status", void 0);
58
63
  ShippingEntity = __decorate([
59
64
  (0, schema_decorator_1.Schema)({})
60
65
  ], ShippingEntity);
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@merkaly/api",
3
- "version": "0.2.4-4",
3
+ "version": "0.2.4-6",
4
4
  "description": "NestJS Backend ApiRest Service",
5
5
  "repository": {
6
6
  "type": "git",