@merkaly/api 0.2.2-22 → 0.2.2-24

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 (34) hide show
  1. package/.output/modules/inventory/products/product.entity.js +1 -1
  2. package/.output/modules/store/clients/client.entity.d.ts +6 -18
  3. package/.output/modules/store/clients/client.entity.js +27 -15
  4. package/.output/modules/store/clients/client.validator.d.ts +3 -1
  5. package/.output/modules/store/clients/client.validator.js +12 -0
  6. package/.output/modules/store/orders/billing/billing.validator.d.ts +2 -2
  7. package/.output/modules/store/orders/billing/billing.validator.js +6 -9
  8. package/.output/modules/store/orders/order.entity.d.ts +3 -3
  9. package/.output/modules/store/orders/order.entity.js +3 -2
  10. package/.output/modules/store/orders/order.validator.d.ts +6 -5
  11. package/.output/modules/store/orders/order.validator.js +12 -2
  12. package/.output/modules/store/orders/payment/payment.entity.d.ts +4 -0
  13. package/.output/modules/{setting/payments → store/orders/payment}/payment.entity.js +5 -17
  14. package/.output/modules/store/orders/payment/payment.schema.d.ts +27 -0
  15. package/.output/modules/store/orders/payment/payment.schema.js +6 -0
  16. package/.output/modules/store/orders/payment/payment.validator.d.ts +6 -0
  17. package/.output/modules/store/orders/payment/payment.validator.js +10 -0
  18. package/.output/modules/store/orders/shipping/shipping.validator.d.ts +2 -2
  19. package/.output/modules/store/orders/shipping/shipping.validator.js +6 -9
  20. package/.output/modules/store/orders/status/status.validator.d.ts +3 -3
  21. package/.output/modules/store/orders/status/status.validator.js +3 -3
  22. package/.output/modules/users/user.validator.d.ts +10 -0
  23. package/.output/modules/users/user.validator.js +54 -0
  24. package/.output/types.d.ts +17 -0
  25. package/package.json +1 -1
  26. package/.output/modules/setting/payments/payment.entity.d.ts +0 -8
  27. package/.output/modules/setting/payments/payment.validator.d.ts +0 -3
  28. package/.output/modules/setting/payments/payment.validator.js +0 -7
  29. package/.output/modules/store/cart/cart.entity.d.ts +0 -9
  30. package/.output/modules/store/cart/cart.entity.js +0 -39
  31. package/.output/modules/store/cart/cart.validator.d.ts +0 -19
  32. package/.output/modules/store/cart/cart.validator.js +0 -64
  33. package/.output/modules/store/orders/order.document.d.ts +0 -21
  34. package/.output/modules/store/orders/order.document.js +0 -15
@@ -26,7 +26,7 @@ let ProductEntity = class ProductEntity extends abstract_entity_1.AbstractEntity
26
26
  files = [];
27
27
  };
28
28
  __decorate([
29
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true, unique: true, length: 64 }),
29
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true, length: 64 }),
30
30
  __metadata("design:type", String)
31
31
  ], ProductEntity.prototype, "name", void 0);
32
32
  __decorate([
@@ -3,22 +3,10 @@ import { AbstractEntity } from '../../../abstract/abstract.entity';
3
3
  export declare class ClientEntity extends AbstractEntity implements User {
4
4
  static readonly $index = "store_clients";
5
5
  readonly user_id: string;
6
- readonly email?: string | undefined;
7
- readonly email_verified?: boolean | undefined;
8
- readonly username?: string | undefined;
9
- readonly phone_number?: string | undefined;
10
- readonly phone_verified?: boolean | undefined;
11
- readonly created_at?: string | undefined;
12
- readonly updated_at?: string | undefined;
13
- readonly picture?: string | undefined;
14
- readonly name?: string | undefined;
15
- readonly nickname?: string | undefined;
16
- readonly multifactor?: string[] | undefined;
17
- readonly last_ip?: string | undefined;
18
- readonly last_login?: string | undefined;
19
- readonly last_password_reset?: string | undefined;
20
- readonly logins_count?: number | undefined;
21
- readonly blocked?: boolean | undefined;
22
- readonly given_name?: string | undefined;
23
- readonly family_name?: string | undefined;
6
+ readonly email: string;
7
+ readonly email_verified: boolean;
8
+ readonly phone?: string;
9
+ readonly phone_verified: boolean;
10
+ readonly picture?: string;
11
+ readonly name?: string;
24
12
  }
@@ -17,28 +17,40 @@ let ClientEntity = class ClientEntity extends abstract_entity_1.AbstractEntity {
17
17
  static $index = 'store_clients';
18
18
  user_id;
19
19
  email;
20
- email_verified;
21
- username;
22
- phone_number;
23
- phone_verified;
24
- created_at;
25
- updated_at;
20
+ email_verified = false;
21
+ phone;
22
+ phone_verified = false;
26
23
  picture;
27
24
  name;
28
- nickname;
29
- multifactor;
30
- last_ip;
31
- last_login;
32
- last_password_reset;
33
- logins_count;
34
- blocked;
35
- given_name;
36
- family_name;
37
25
  };
38
26
  __decorate([
39
27
  (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true, unique: true }),
40
28
  __metadata("design:type", String)
41
29
  ], ClientEntity.prototype, "user_id", void 0);
30
+ __decorate([
31
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, unique: true, required: true }),
32
+ __metadata("design:type", String)
33
+ ], ClientEntity.prototype, "email", void 0);
34
+ __decorate([
35
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Boolean, default: false }),
36
+ __metadata("design:type", Boolean)
37
+ ], ClientEntity.prototype, "email_verified", void 0);
38
+ __decorate([
39
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, default: false }),
40
+ __metadata("design:type", String)
41
+ ], ClientEntity.prototype, "phone", void 0);
42
+ __decorate([
43
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Boolean, default: false }),
44
+ __metadata("design:type", Boolean)
45
+ ], ClientEntity.prototype, "phone_verified", void 0);
46
+ __decorate([
47
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, default: null }),
48
+ __metadata("design:type", String)
49
+ ], ClientEntity.prototype, "picture", void 0);
50
+ __decorate([
51
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, default: null }),
52
+ __metadata("design:type", String)
53
+ ], ClientEntity.prototype, "name", void 0);
42
54
  ClientEntity = __decorate([
43
55
  (0, mongoose_1.Schema)({ timestamps: true })
44
56
  ], ClientEntity);
@@ -1,7 +1,9 @@
1
1
  export declare class CreateClientValidator {
2
2
  name: string;
3
3
  email: string;
4
- phone: string;
4
+ phone?: string;
5
+ user_id: string;
6
+ picture?: string;
5
7
  }
6
8
  export declare class UpdateClientValidator {
7
9
  name: string;
@@ -16,6 +16,8 @@ class CreateClientValidator {
16
16
  name;
17
17
  email;
18
18
  phone;
19
+ user_id;
20
+ picture;
19
21
  }
20
22
  __decorate([
21
23
  (0, class_validator_1.IsString)(),
@@ -28,8 +30,18 @@ __decorate([
28
30
  ], CreateClientValidator.prototype, "email", void 0);
29
31
  __decorate([
30
32
  (0, class_validator_1.IsPhoneNumber)(),
33
+ (0, class_validator_1.IsOptional)(),
31
34
  __metadata("design:type", String)
32
35
  ], CreateClientValidator.prototype, "phone", void 0);
36
+ __decorate([
37
+ (0, class_validator_1.IsString)(),
38
+ __metadata("design:type", String)
39
+ ], CreateClientValidator.prototype, "user_id", void 0);
40
+ __decorate([
41
+ (0, class_validator_1.IsUrl)(),
42
+ (0, class_validator_1.IsOptional)(),
43
+ __metadata("design:type", String)
44
+ ], CreateClientValidator.prototype, "picture", void 0);
33
45
  exports.CreateClientValidator = CreateClientValidator;
34
46
  class UpdateClientValidator {
35
47
  name;
@@ -1,7 +1,7 @@
1
+ import { AddressValidator } from '../../../users/user.validator';
1
2
  export declare class CreateBillingValidator {
2
3
  name: string;
3
4
  email: string;
4
5
  phone: string;
5
- address: string;
6
- code: string;
6
+ address: AddressValidator;
7
7
  }
@@ -10,13 +10,14 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CreateBillingValidator = void 0;
13
+ const class_transformer_1 = require("class-transformer");
13
14
  const class_validator_1 = require("class-validator");
15
+ const user_validator_1 = require("../../../users/user.validator");
14
16
  class CreateBillingValidator {
15
17
  name;
16
18
  email;
17
19
  phone;
18
20
  address;
19
- code;
20
21
  }
21
22
  __decorate([
22
23
  (0, class_validator_1.IsString)(),
@@ -32,13 +33,9 @@ __decorate([
32
33
  __metadata("design:type", String)
33
34
  ], CreateBillingValidator.prototype, "phone", void 0);
34
35
  __decorate([
35
- (0, class_validator_1.IsString)(),
36
- (0, class_validator_1.IsNotEmpty)(),
37
- __metadata("design:type", String)
36
+ (0, class_validator_1.ValidateNested)(),
37
+ (0, class_transformer_1.Type)(() => user_validator_1.AddressValidator),
38
+ (0, class_validator_1.IsNotEmptyObject)(),
39
+ __metadata("design:type", user_validator_1.AddressValidator)
38
40
  ], CreateBillingValidator.prototype, "address", void 0);
39
- __decorate([
40
- (0, class_validator_1.IsString)(),
41
- (0, class_validator_1.IsOptional)(),
42
- __metadata("design:type", String)
43
- ], CreateBillingValidator.prototype, "code", void 0);
44
41
  exports.CreateBillingValidator = CreateBillingValidator;
@@ -1,16 +1,16 @@
1
1
  import { Types } from 'mongoose';
2
2
  import { AbstractEntity } from '../../../abstract/abstract.entity';
3
- import { PaymentEntity } from '../../setting/payments/payment.entity';
4
3
  import { ClientEntity } from '../clients/client.entity';
5
4
  import { ItemEntity } from './item/item.entity';
5
+ import { PaymentEntity } from './payment/payment.entity';
6
6
  import { StatusEntity } from './status/status.entity';
7
7
  export declare class OrderEntity extends AbstractEntity {
8
8
  static readonly $index = "store_orders";
9
9
  number: string;
10
10
  status: StatusEntity[];
11
11
  items: ItemEntity[];
12
- billing: Types.Map<string>;
13
- shipping: Types.Map<string>;
12
+ billing?: Types.Map<any>;
13
+ shipping?: Types.Map<any>;
14
14
  payment: PaymentEntity;
15
15
  client: ClientEntity;
16
16
  notes: string;
@@ -13,10 +13,11 @@ exports.OrderEntity = void 0;
13
13
  const mongoose_1 = require("@nestjs/mongoose");
14
14
  const mongoose_2 = require("mongoose");
15
15
  const abstract_entity_1 = require("../../../abstract/abstract.entity");
16
- const payment_entity_1 = require("../../setting/payments/payment.entity");
17
16
  const client_entity_1 = require("../clients/client.entity");
18
17
  const billing_entity_1 = require("./billing/billing.entity");
19
18
  const item_schema_1 = require("./item/item.schema");
19
+ const payment_entity_1 = require("./payment/payment.entity");
20
+ const payment_schema_1 = require("./payment/payment.schema");
20
21
  const shipping_entity_1 = require("./shipping/shipping.entity");
21
22
  let OrderEntity = class OrderEntity extends abstract_entity_1.AbstractEntity {
22
23
  static $index = 'store_orders';
@@ -50,7 +51,7 @@ __decorate([
50
51
  __metadata("design:type", mongoose_2.Types.Map)
51
52
  ], OrderEntity.prototype, "shipping", void 0);
52
53
  __decorate([
53
- (0, mongoose_1.Prop)({ type: mongoose_2.Types.ObjectId, ref: payment_entity_1.PaymentEntity.$index }),
54
+ (0, mongoose_1.Prop)({ type: payment_schema_1.PaymentSchema, required: true }),
54
55
  __metadata("design:type", payment_entity_1.PaymentEntity)
55
56
  ], OrderEntity.prototype, "payment", void 0);
56
57
  __decorate([
@@ -1,14 +1,15 @@
1
- import { PaymentType } from '../../setting/payments/payment.validator';
2
1
  import { CreateBillingValidator } from './billing/billing.validator';
3
2
  import { CreateItemValidator } from './item/item.validator';
3
+ import { PaymentMethods } from './payment/payment.validator';
4
4
  import { CreateShippingValidator } from './shipping/shipping.validator';
5
5
  import { StatusType } from './status/status.validator';
6
6
  export declare class CreateOrderValidator {
7
+ client?: string;
7
8
  items: CreateItemValidator[];
8
- billing: CreateBillingValidator;
9
- shipping: CreateShippingValidator;
10
- payment: PaymentType;
11
- notes: string;
9
+ billing?: CreateBillingValidator;
10
+ shipping?: CreateShippingValidator;
11
+ payment: PaymentMethods;
12
+ notes?: string;
12
13
  }
13
14
  export declare class UpdateOrderValidator {
14
15
  }
@@ -12,18 +12,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ChangeOrderStatusValidator = exports.UpdateOrderValidator = exports.CreateOrderValidator = void 0;
13
13
  const class_transformer_1 = require("class-transformer");
14
14
  const class_validator_1 = require("class-validator");
15
- const payment_validator_1 = require("../../setting/payments/payment.validator");
16
15
  const billing_validator_1 = require("./billing/billing.validator");
17
16
  const item_validator_1 = require("./item/item.validator");
17
+ const payment_validator_1 = require("./payment/payment.validator");
18
18
  const shipping_validator_1 = require("./shipping/shipping.validator");
19
19
  const status_validator_1 = require("./status/status.validator");
20
20
  class CreateOrderValidator {
21
+ client;
21
22
  items = [];
22
23
  billing;
23
24
  shipping;
24
25
  payment;
25
26
  notes;
26
27
  }
28
+ __decorate([
29
+ (0, class_validator_1.IsOptional)(),
30
+ (0, class_validator_1.IsMongoId)(),
31
+ __metadata("design:type", String)
32
+ ], CreateOrderValidator.prototype, "client", void 0);
27
33
  __decorate([
28
34
  (0, class_validator_1.ArrayNotEmpty)(),
29
35
  (0, class_validator_1.ValidateNested)({ each: true }),
@@ -33,15 +39,19 @@ __decorate([
33
39
  __decorate([
34
40
  (0, class_validator_1.ValidateNested)(),
35
41
  (0, class_transformer_1.Type)(() => billing_validator_1.CreateBillingValidator),
42
+ (0, class_validator_1.IsNotEmptyObject)(),
43
+ (0, class_validator_1.IsOptional)(),
36
44
  __metadata("design:type", billing_validator_1.CreateBillingValidator)
37
45
  ], CreateOrderValidator.prototype, "billing", void 0);
38
46
  __decorate([
39
47
  (0, class_validator_1.ValidateNested)(),
40
48
  (0, class_transformer_1.Type)(() => shipping_validator_1.CreateShippingValidator),
49
+ (0, class_validator_1.IsNotEmptyObject)(),
50
+ (0, class_validator_1.IsOptional)(),
41
51
  __metadata("design:type", shipping_validator_1.CreateShippingValidator)
42
52
  ], CreateOrderValidator.prototype, "shipping", void 0);
43
53
  __decorate([
44
- (0, class_validator_1.IsEnum)(payment_validator_1.PaymentType),
54
+ (0, class_validator_1.IsEnum)(payment_validator_1.PaymentMethods),
45
55
  __metadata("design:type", String)
46
56
  ], CreateOrderValidator.prototype, "payment", void 0);
47
57
  __decorate([
@@ -0,0 +1,4 @@
1
+ import { PaymentMethods } from './payment.validator';
2
+ export declare class PaymentEntity {
3
+ type: PaymentMethods;
4
+ }
@@ -12,27 +12,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.PaymentEntity = void 0;
13
13
  const mongoose_1 = require("@nestjs/mongoose");
14
14
  const mongoose_2 = require("mongoose");
15
- const abstract_entity_1 = require("../../../abstract/abstract.entity");
16
15
  const payment_validator_1 = require("./payment.validator");
17
- let PaymentEntity = class PaymentEntity extends abstract_entity_1.AbstractEntity {
18
- static $index = 'settings_payments';
19
- name;
20
- active = true;
21
- description;
16
+ let PaymentEntity = class PaymentEntity {
17
+ type;
22
18
  };
23
19
  __decorate([
24
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, enum: payment_validator_1.PaymentType, required: true, unique: true }),
20
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, enum: payment_validator_1.PaymentMethods, required: true }),
25
21
  __metadata("design:type", String)
26
- ], PaymentEntity.prototype, "name", void 0);
27
- __decorate([
28
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Boolean, default: true }),
29
- __metadata("design:type", Object)
30
- ], PaymentEntity.prototype, "active", void 0);
31
- __decorate([
32
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, default: String() }),
33
- __metadata("design:type", String)
34
- ], PaymentEntity.prototype, "description", void 0);
22
+ ], PaymentEntity.prototype, "type", void 0);
35
23
  PaymentEntity = __decorate([
36
- (0, mongoose_1.Schema)({ timestamps: true })
24
+ (0, mongoose_1.Schema)()
37
25
  ], PaymentEntity);
38
26
  exports.PaymentEntity = PaymentEntity;
@@ -0,0 +1,27 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose" />
25
+ /// <reference types="mongoose/types/inferschematype" />
26
+ import { PaymentEntity } from './payment.entity';
27
+ export declare const PaymentSchema: import("mongoose").Schema<PaymentEntity, import("mongoose").Model<PaymentEntity, any, any, any, any>, {}, {}, {}, {}, "type", PaymentEntity>;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaymentSchema = void 0;
4
+ const mongoose_1 = require("@nestjs/mongoose");
5
+ const payment_entity_1 = require("./payment.entity");
6
+ exports.PaymentSchema = mongoose_1.SchemaFactory.createForClass(payment_entity_1.PaymentEntity);
@@ -0,0 +1,6 @@
1
+ export declare enum PaymentMethods {
2
+ COD = "CASH_ON_DELIVERY",
3
+ CARD = "CARD",
4
+ TRANSFER = "TRANSFER",
5
+ CRYPTO = "CRYPTO"
6
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaymentMethods = void 0;
4
+ var PaymentMethods;
5
+ (function (PaymentMethods) {
6
+ PaymentMethods["COD"] = "CASH_ON_DELIVERY";
7
+ PaymentMethods["CARD"] = "CARD";
8
+ PaymentMethods["TRANSFER"] = "TRANSFER";
9
+ PaymentMethods["CRYPTO"] = "CRYPTO";
10
+ })(PaymentMethods = exports.PaymentMethods || (exports.PaymentMethods = {}));
@@ -1,7 +1,7 @@
1
+ import { AddressValidator } from '../../../users/user.validator';
1
2
  export declare class CreateShippingValidator {
2
3
  name: string;
3
4
  email: string;
4
5
  phone: string;
5
- address: string;
6
- code: string;
6
+ address: AddressValidator;
7
7
  }
@@ -10,13 +10,14 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CreateShippingValidator = void 0;
13
+ const class_transformer_1 = require("class-transformer");
13
14
  const class_validator_1 = require("class-validator");
15
+ const user_validator_1 = require("../../../users/user.validator");
14
16
  class CreateShippingValidator {
15
17
  name;
16
18
  email;
17
19
  phone;
18
20
  address;
19
- code;
20
21
  }
21
22
  __decorate([
22
23
  (0, class_validator_1.IsString)(),
@@ -32,13 +33,9 @@ __decorate([
32
33
  __metadata("design:type", String)
33
34
  ], CreateShippingValidator.prototype, "phone", void 0);
34
35
  __decorate([
35
- (0, class_validator_1.IsString)(),
36
- (0, class_validator_1.IsNotEmpty)(),
37
- __metadata("design:type", String)
36
+ (0, class_validator_1.ValidateNested)(),
37
+ (0, class_transformer_1.Type)(() => user_validator_1.AddressValidator),
38
+ (0, class_validator_1.IsNotEmptyObject)(),
39
+ __metadata("design:type", user_validator_1.AddressValidator)
38
40
  ], CreateShippingValidator.prototype, "address", void 0);
39
- __decorate([
40
- (0, class_validator_1.IsString)(),
41
- (0, class_validator_1.IsOptional)(),
42
- __metadata("design:type", String)
43
- ], CreateShippingValidator.prototype, "code", void 0);
44
41
  exports.CreateShippingValidator = CreateShippingValidator;
@@ -1,8 +1,8 @@
1
1
  export declare enum StatusType {
2
2
  CREATED = "CREATED",
3
- APPROVED = "APPROVED",
4
- ON_HOLD = "ON_HOLD",
5
- IN_PROGRESS = "IN_PROGRESS",
3
+ ACCEPTED = "ACCEPTED",
4
+ IN_PREPARATION = "IN_PREPARATION",
5
+ SENDED = "SENDED",
6
6
  COMPLETED = "COMPLETED",
7
7
  CANCELED = "CANCELED"
8
8
  }
@@ -4,9 +4,9 @@ exports.StatusType = void 0;
4
4
  var StatusType;
5
5
  (function (StatusType) {
6
6
  StatusType["CREATED"] = "CREATED";
7
- StatusType["APPROVED"] = "APPROVED";
8
- StatusType["ON_HOLD"] = "ON_HOLD";
9
- StatusType["IN_PROGRESS"] = "IN_PROGRESS";
7
+ StatusType["ACCEPTED"] = "ACCEPTED";
8
+ StatusType["IN_PREPARATION"] = "IN_PREPARATION";
9
+ StatusType["SENDED"] = "SENDED";
10
10
  StatusType["COMPLETED"] = "COMPLETED";
11
11
  StatusType["CANCELED"] = "CANCELED";
12
12
  })(StatusType = exports.StatusType || (exports.StatusType = {}));
@@ -0,0 +1,10 @@
1
+ import { MetaAddress } from '../../types';
2
+ export declare class AddressValidator implements MetaAddress {
3
+ name: string;
4
+ country: string;
5
+ code: string;
6
+ line1: string;
7
+ line2?: string;
8
+ city: string;
9
+ state: string;
10
+ }
@@ -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.AddressValidator = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class AddressValidator {
15
+ name;
16
+ country;
17
+ code;
18
+ line1;
19
+ line2;
20
+ city;
21
+ state;
22
+ }
23
+ __decorate([
24
+ (0, class_validator_1.IsString)(),
25
+ __metadata("design:type", String)
26
+ ], AddressValidator.prototype, "name", void 0);
27
+ __decorate([
28
+ (0, class_validator_1.IsISO31661Alpha3)(),
29
+ __metadata("design:type", String)
30
+ ], AddressValidator.prototype, "country", void 0);
31
+ __decorate([
32
+ (0, class_validator_1.IsString)(),
33
+ __metadata("design:type", String)
34
+ ], AddressValidator.prototype, "code", void 0);
35
+ __decorate([
36
+ (0, class_validator_1.IsString)(),
37
+ __metadata("design:type", String)
38
+ ], AddressValidator.prototype, "line1", void 0);
39
+ __decorate([
40
+ (0, class_validator_1.IsString)(),
41
+ (0, class_validator_1.IsOptional)(),
42
+ __metadata("design:type", String)
43
+ ], AddressValidator.prototype, "line2", void 0);
44
+ __decorate([
45
+ (0, class_validator_1.IsOptional)(),
46
+ (0, class_validator_1.IsString)(),
47
+ __metadata("design:type", String)
48
+ ], AddressValidator.prototype, "city", void 0);
49
+ __decorate([
50
+ (0, class_validator_1.IsString)(),
51
+ (0, class_validator_1.IsOptional)(),
52
+ __metadata("design:type", String)
53
+ ], AddressValidator.prototype, "state", void 0);
54
+ exports.AddressValidator = AddressValidator;
@@ -1,4 +1,5 @@
1
1
  import { GetResponse, SearchHit, SearchRequest, SearchTotalHits } from '@elastic/elasticsearch/lib/api/types';
2
+ import { AppMetadata, User, UserMetadata } from 'auth0';
2
3
  export declare type Document<D> = GetResponse<D>;
3
4
  export declare type Search<D> = {
4
5
  total: SearchTotalHits;
@@ -6,3 +7,19 @@ export declare type Search<D> = {
6
7
  max_score?: number;
7
8
  };
8
9
  export declare type SearchQuery = Omit<SearchRequest, 'index' | 'filter_path'>;
10
+ export interface MetaAddress {
11
+ name: string;
12
+ country: string;
13
+ code: string;
14
+ line1: string;
15
+ line2?: string;
16
+ city: string;
17
+ state: string;
18
+ }
19
+ export interface UserMeta extends UserMetadata {
20
+ addresses?: MetaAddress[];
21
+ }
22
+ export interface AppMeta extends AppMetadata {
23
+ }
24
+ export interface UserDocument extends User<AppMeta, UserMeta> {
25
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@merkaly/api",
3
- "version": "0.2.2-22",
3
+ "version": "0.2.2-24",
4
4
  "description": "NestJS Backend ApiRest Service",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,8 +0,0 @@
1
- import { AbstractEntity } from '../../../abstract/abstract.entity';
2
- import { PaymentType } from './payment.validator';
3
- export declare class PaymentEntity extends AbstractEntity {
4
- static readonly $index = "settings_payments";
5
- name: PaymentType;
6
- active: boolean;
7
- description: string;
8
- }
@@ -1,3 +0,0 @@
1
- export declare enum PaymentType {
2
- COD = "CASH_ON_DELIVERY"
3
- }
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PaymentType = void 0;
4
- var PaymentType;
5
- (function (PaymentType) {
6
- PaymentType["COD"] = "CASH_ON_DELIVERY";
7
- })(PaymentType = exports.PaymentType || (exports.PaymentType = {}));
@@ -1,9 +0,0 @@
1
- import { AbstractEntity } from '../../../abstract/abstract.entity';
2
- import { ItemEntity } from '../orders/item/item.entity';
3
- import { CartStatus } from './cart.validator';
4
- export declare class CartEntity extends AbstractEntity {
5
- static readonly $index = "store_carts";
6
- user: string;
7
- status: CartStatus;
8
- items: ItemEntity[];
9
- }
@@ -1,39 +0,0 @@
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.CartEntity = void 0;
13
- const mongoose_1 = require("@nestjs/mongoose");
14
- const mongoose_2 = require("mongoose");
15
- const abstract_entity_1 = require("../../../abstract/abstract.entity");
16
- const item_schema_1 = require("../orders/item/item.schema");
17
- const cart_validator_1 = require("./cart.validator");
18
- let CartEntity = class CartEntity extends abstract_entity_1.AbstractEntity {
19
- static $index = 'store_carts';
20
- user;
21
- status = cart_validator_1.CartStatus.EMPTY;
22
- items = [];
23
- };
24
- __decorate([
25
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true }),
26
- __metadata("design:type", String)
27
- ], CartEntity.prototype, "user", void 0);
28
- __decorate([
29
- (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, enum: cart_validator_1.CartStatus, default: cart_validator_1.CartStatus.EMPTY }),
30
- __metadata("design:type", Object)
31
- ], CartEntity.prototype, "status", void 0);
32
- __decorate([
33
- (0, mongoose_1.Prop)({ type: [item_schema_1.ItemSchema], default: [] }),
34
- __metadata("design:type", Array)
35
- ], CartEntity.prototype, "items", void 0);
36
- CartEntity = __decorate([
37
- (0, mongoose_1.Schema)({ timestamps: true })
38
- ], CartEntity);
39
- exports.CartEntity = CartEntity;
@@ -1,19 +0,0 @@
1
- import { PaymentType } from '../../setting/payments/payment.validator';
2
- import { CreateBillingValidator } from '../orders/billing/billing.validator';
3
- import { CreateShippingValidator } from '../orders/shipping/shipping.validator';
4
- export declare enum CartStatus {
5
- EMPTY = "EMPTY",
6
- FILLED = "FILLED",
7
- FINISHED = "FINISHED",
8
- ABANDONED = "ABANDONED"
9
- }
10
- export declare class CheckoutCartValidator {
11
- cart: string;
12
- billing: CreateBillingValidator;
13
- shipping: CreateShippingValidator;
14
- payment: PaymentType;
15
- }
16
- export declare class AddItemValidator {
17
- product: string;
18
- quantity: number;
19
- }
@@ -1,64 +0,0 @@
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.AddItemValidator = exports.CheckoutCartValidator = exports.CartStatus = void 0;
13
- const class_transformer_1 = require("class-transformer");
14
- const class_validator_1 = require("class-validator");
15
- const payment_validator_1 = require("../../setting/payments/payment.validator");
16
- const billing_validator_1 = require("../orders/billing/billing.validator");
17
- const shipping_validator_1 = require("../orders/shipping/shipping.validator");
18
- var CartStatus;
19
- (function (CartStatus) {
20
- CartStatus["EMPTY"] = "EMPTY";
21
- CartStatus["FILLED"] = "FILLED";
22
- CartStatus["FINISHED"] = "FINISHED";
23
- CartStatus["ABANDONED"] = "ABANDONED";
24
- })(CartStatus = exports.CartStatus || (exports.CartStatus = {}));
25
- class CheckoutCartValidator {
26
- cart;
27
- billing;
28
- shipping;
29
- payment;
30
- }
31
- __decorate([
32
- (0, class_validator_1.IsMongoId)(),
33
- __metadata("design:type", String)
34
- ], CheckoutCartValidator.prototype, "cart", void 0);
35
- __decorate([
36
- (0, class_validator_1.ValidateNested)(),
37
- (0, class_transformer_1.Type)(() => billing_validator_1.CreateBillingValidator),
38
- __metadata("design:type", billing_validator_1.CreateBillingValidator)
39
- ], CheckoutCartValidator.prototype, "billing", void 0);
40
- __decorate([
41
- (0, class_validator_1.ValidateNested)(),
42
- (0, class_transformer_1.Type)(() => shipping_validator_1.CreateShippingValidator),
43
- __metadata("design:type", shipping_validator_1.CreateShippingValidator)
44
- ], CheckoutCartValidator.prototype, "shipping", void 0);
45
- __decorate([
46
- (0, class_validator_1.ValidateNested)(),
47
- (0, class_validator_1.IsEnum)(payment_validator_1.PaymentType),
48
- __metadata("design:type", String)
49
- ], CheckoutCartValidator.prototype, "payment", void 0);
50
- exports.CheckoutCartValidator = CheckoutCartValidator;
51
- class AddItemValidator {
52
- product;
53
- quantity = 1;
54
- }
55
- __decorate([
56
- (0, class_validator_1.IsMongoId)(),
57
- __metadata("design:type", String)
58
- ], AddItemValidator.prototype, "product", void 0);
59
- __decorate([
60
- (0, class_validator_1.IsOptional)(),
61
- (0, class_validator_1.Min)(1),
62
- __metadata("design:type", Object)
63
- ], AddItemValidator.prototype, "quantity", void 0);
64
- exports.AddItemValidator = AddItemValidator;
@@ -1,21 +0,0 @@
1
- import { AbstractDocument } from '../../../abstract/abstract.document';
2
- import { PaymentType } from '../../setting/payments/payment.validator';
3
- import { BillingDocument } from './billing/billing.document';
4
- import { ItemDocument } from './item/item.document';
5
- import { ShippingDocument } from './shipping/shipping.document';
6
- import { StatusDocument } from './status/status.document';
7
- interface Payment {
8
- name: PaymentType;
9
- id: string;
10
- }
11
- export declare class OrderDocument extends AbstractDocument {
12
- number: string;
13
- owner: string;
14
- notes: string;
15
- status: StatusDocument[];
16
- items: ItemDocument[];
17
- payment: Payment;
18
- billing: BillingDocument;
19
- shipping: ShippingDocument;
20
- }
21
- export {};
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OrderDocument = void 0;
4
- const abstract_document_1 = require("../../../abstract/abstract.document");
5
- class OrderDocument extends abstract_document_1.AbstractDocument {
6
- number;
7
- owner;
8
- notes;
9
- status;
10
- items;
11
- payment;
12
- billing;
13
- shipping;
14
- }
15
- exports.OrderDocument = OrderDocument;