@merkaly/api 0.2.2 → 0.2.3-1
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.
- package/.output/abstract/abstract.document.d.ts +1 -1
- package/.output/abstract/abstract.document.js +1 -1
- package/.output/abstract/abstract.entity.d.ts +1 -1
- package/.output/abstract/abstract.entity.js +1 -2
- package/.output/modules/inventory/products/product.entity.d.ts +1 -0
- package/.output/modules/inventory/products/product.entity.js +1 -1
- package/.output/modules/sales/clients/client.document.d.ts +9 -0
- package/.output/modules/sales/clients/client.document.js +33 -0
- package/.output/modules/sales/clients/client.entity.d.ts +4 -5
- package/.output/modules/sales/clients/client.entity.js +8 -17
- package/.output/modules/sales/clients/client.validator.d.ts +5 -3
- package/.output/modules/sales/clients/client.validator.js +33 -8
- package/.output/modules/sales/orders/item/item.entity.d.ts +1 -0
- package/.output/modules/sales/orders/item/item.entity.js +1 -1
- package/.output/modules/sales/orders/item/item.schema.js +3 -0
- package/.output/modules/sales/orders/order.entity.d.ts +4 -2
- package/.output/modules/sales/orders/order.entity.js +6 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ var AbstractDocument = (function () {
|
|
|
6
6
|
var _id = _a._id, createdAt = _a.createdAt, updatedAt = _a.updatedAt;
|
|
7
7
|
this.id = _id;
|
|
8
8
|
this.createdAt = createdAt || new Date();
|
|
9
|
-
this.updatedAt = updatedAt ||
|
|
9
|
+
this.updatedAt = updatedAt || null;
|
|
10
10
|
}
|
|
11
11
|
return AbstractDocument;
|
|
12
12
|
}());
|
|
@@ -32,7 +32,6 @@ var AbstractEntity = (function (_super) {
|
|
|
32
32
|
function AbstractEntity() {
|
|
33
33
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
34
34
|
_this._id = String();
|
|
35
|
-
_this.createdAt = null;
|
|
36
35
|
_this.updatedAt = null;
|
|
37
36
|
_this.deletedAt = null;
|
|
38
37
|
return _this;
|
|
@@ -46,7 +45,7 @@ var AbstractEntity = (function (_super) {
|
|
|
46
45
|
__metadata("design:type", Date)
|
|
47
46
|
], AbstractEntity.prototype, "updatedAt", void 0);
|
|
48
47
|
__decorate([
|
|
49
|
-
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date }),
|
|
48
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date, default: null }),
|
|
50
49
|
__metadata("design:type", Date)
|
|
51
50
|
], AbstractEntity.prototype, "deletedAt", void 0);
|
|
52
51
|
return AbstractEntity;
|
|
@@ -94,7 +94,7 @@ var ProductEntity = (function (_super) {
|
|
|
94
94
|
__metadata("design:type", seo_entity_1.SeoEntity)
|
|
95
95
|
], ProductEntity.prototype, "seo", void 0);
|
|
96
96
|
ProductEntity = __decorate([
|
|
97
|
-
(0, mongoose_1.Schema)({ timestamps: true })
|
|
97
|
+
(0, mongoose_1.Schema)({ timestamps: true, toJSON: { virtuals: true } })
|
|
98
98
|
], ProductEntity);
|
|
99
99
|
return ProductEntity;
|
|
100
100
|
}(abstract_entity_1.AbstractEntity));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AbstractDocument } from '../../../abstract/abstract.document';
|
|
2
|
+
import type { MetaAddress } from "../../../types";
|
|
3
|
+
export declare class ClientDocument extends AbstractDocument {
|
|
4
|
+
name: string;
|
|
5
|
+
identificationNumber: string;
|
|
6
|
+
email: string;
|
|
7
|
+
phone?: string;
|
|
8
|
+
addresses: MetaAddress[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ClientDocument = void 0;
|
|
19
|
+
var abstract_document_1 = require("../../../abstract/abstract.document");
|
|
20
|
+
var ClientDocument = (function (_super) {
|
|
21
|
+
__extends(ClientDocument, _super);
|
|
22
|
+
function ClientDocument() {
|
|
23
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
+
_this.name = String();
|
|
25
|
+
_this.identificationNumber = String();
|
|
26
|
+
_this.email = String();
|
|
27
|
+
_this.phone = String();
|
|
28
|
+
_this.addresses = [];
|
|
29
|
+
return _this;
|
|
30
|
+
}
|
|
31
|
+
return ClientDocument;
|
|
32
|
+
}(abstract_document_1.AbstractDocument));
|
|
33
|
+
exports.ClientDocument = ClientDocument;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { User } from 'auth0';
|
|
2
2
|
import { AbstractEntity } from '../../../abstract/abstract.entity';
|
|
3
|
+
import { MetaAddress } from "../../../types";
|
|
3
4
|
export declare class ClientEntity extends AbstractEntity implements User {
|
|
4
5
|
static readonly $index = "store_clients";
|
|
5
|
-
readonly
|
|
6
|
+
readonly name: string;
|
|
6
7
|
readonly email: string;
|
|
7
|
-
readonly email_verified: boolean;
|
|
8
8
|
readonly phone?: string;
|
|
9
|
-
readonly
|
|
10
|
-
readonly
|
|
11
|
-
readonly name?: string;
|
|
9
|
+
readonly identificationNumber: string;
|
|
10
|
+
readonly addresses: MetaAddress[];
|
|
12
11
|
}
|
|
@@ -32,39 +32,30 @@ var ClientEntity = (function (_super) {
|
|
|
32
32
|
__extends(ClientEntity, _super);
|
|
33
33
|
function ClientEntity() {
|
|
34
34
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
35
|
-
_this.
|
|
36
|
-
_this.phone_verified = false;
|
|
35
|
+
_this.addresses = [];
|
|
37
36
|
return _this;
|
|
38
37
|
}
|
|
39
38
|
ClientEntity.$index = 'store_clients';
|
|
40
39
|
__decorate([
|
|
41
|
-
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true
|
|
40
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true }),
|
|
42
41
|
__metadata("design:type", String)
|
|
43
|
-
], ClientEntity.prototype, "
|
|
42
|
+
], ClientEntity.prototype, "name", void 0);
|
|
44
43
|
__decorate([
|
|
45
44
|
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, unique: true, required: true }),
|
|
46
45
|
__metadata("design:type", String)
|
|
47
46
|
], ClientEntity.prototype, "email", void 0);
|
|
48
|
-
__decorate([
|
|
49
|
-
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Boolean, default: false }),
|
|
50
|
-
__metadata("design:type", Boolean)
|
|
51
|
-
], ClientEntity.prototype, "email_verified", void 0);
|
|
52
47
|
__decorate([
|
|
53
48
|
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, default: null }),
|
|
54
49
|
__metadata("design:type", String)
|
|
55
50
|
], ClientEntity.prototype, "phone", void 0);
|
|
56
51
|
__decorate([
|
|
57
|
-
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.
|
|
58
|
-
__metadata("design:type", Boolean)
|
|
59
|
-
], ClientEntity.prototype, "phone_verified", void 0);
|
|
60
|
-
__decorate([
|
|
61
|
-
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, default: null }),
|
|
52
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, unique: true }),
|
|
62
53
|
__metadata("design:type", String)
|
|
63
|
-
], ClientEntity.prototype, "
|
|
54
|
+
], ClientEntity.prototype, "identificationNumber", void 0);
|
|
64
55
|
__decorate([
|
|
65
|
-
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.
|
|
66
|
-
__metadata("design:type",
|
|
67
|
-
], ClientEntity.prototype, "
|
|
56
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Array, default: [] }),
|
|
57
|
+
__metadata("design:type", Array)
|
|
58
|
+
], ClientEntity.prototype, "addresses", void 0);
|
|
68
59
|
ClientEntity = __decorate([
|
|
69
60
|
(0, mongoose_1.Schema)({ timestamps: true })
|
|
70
61
|
], ClientEntity);
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { MetaAddress } from "../../../types";
|
|
1
2
|
export declare class CreateClientValidator {
|
|
2
3
|
name: string;
|
|
3
4
|
email: string;
|
|
4
5
|
phone?: string;
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
identificationNumber: string;
|
|
7
|
+
addresses: MetaAddress[];
|
|
7
8
|
}
|
|
8
|
-
export declare class UpdateClientValidator {
|
|
9
|
+
export declare class UpdateClientValidator extends CreateClientValidator {
|
|
9
10
|
name: string;
|
|
10
11
|
email: string;
|
|
11
12
|
phone: string;
|
|
13
|
+
identificationNumber: string;
|
|
12
14
|
}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
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
|
+
})();
|
|
2
17
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
18
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
19
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -28,24 +43,25 @@ var CreateClientValidator = (function () {
|
|
|
28
43
|
__metadata("design:type", String)
|
|
29
44
|
], CreateClientValidator.prototype, "email", void 0);
|
|
30
45
|
__decorate([
|
|
31
|
-
(0, class_validator_1.
|
|
46
|
+
(0, class_validator_1.IsString)(),
|
|
32
47
|
(0, class_validator_1.IsOptional)(),
|
|
33
48
|
__metadata("design:type", String)
|
|
34
49
|
], CreateClientValidator.prototype, "phone", void 0);
|
|
35
50
|
__decorate([
|
|
36
51
|
(0, class_validator_1.IsString)(),
|
|
37
52
|
__metadata("design:type", String)
|
|
38
|
-
], CreateClientValidator.prototype, "
|
|
53
|
+
], CreateClientValidator.prototype, "identificationNumber", void 0);
|
|
39
54
|
__decorate([
|
|
40
|
-
(0, class_validator_1.
|
|
41
|
-
(
|
|
42
|
-
|
|
43
|
-
], CreateClientValidator.prototype, "picture", void 0);
|
|
55
|
+
(0, class_validator_1.IsArray)(),
|
|
56
|
+
__metadata("design:type", Array)
|
|
57
|
+
], CreateClientValidator.prototype, "addresses", void 0);
|
|
44
58
|
return CreateClientValidator;
|
|
45
59
|
}());
|
|
46
60
|
exports.CreateClientValidator = CreateClientValidator;
|
|
47
|
-
var UpdateClientValidator = (function () {
|
|
61
|
+
var UpdateClientValidator = (function (_super) {
|
|
62
|
+
__extends(UpdateClientValidator, _super);
|
|
48
63
|
function UpdateClientValidator() {
|
|
64
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
49
65
|
}
|
|
50
66
|
__decorate([
|
|
51
67
|
(0, class_validator_1.IsString)(),
|
|
@@ -54,6 +70,10 @@ var UpdateClientValidator = (function () {
|
|
|
54
70
|
], UpdateClientValidator.prototype, "name", void 0);
|
|
55
71
|
__decorate([
|
|
56
72
|
(0, class_validator_1.IsEmail)(),
|
|
73
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
|
74
|
+
var value = _a.value;
|
|
75
|
+
return String(value).toLowerCase();
|
|
76
|
+
}),
|
|
57
77
|
(0, class_validator_1.IsOptional)(),
|
|
58
78
|
__metadata("design:type", String)
|
|
59
79
|
], UpdateClientValidator.prototype, "email", void 0);
|
|
@@ -62,6 +82,11 @@ var UpdateClientValidator = (function () {
|
|
|
62
82
|
(0, class_validator_1.IsOptional)(),
|
|
63
83
|
__metadata("design:type", String)
|
|
64
84
|
], UpdateClientValidator.prototype, "phone", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, class_validator_1.IsString)(),
|
|
87
|
+
(0, class_validator_1.IsOptional)(),
|
|
88
|
+
__metadata("design:type", String)
|
|
89
|
+
], UpdateClientValidator.prototype, "identificationNumber", void 0);
|
|
65
90
|
return UpdateClientValidator;
|
|
66
|
-
}());
|
|
91
|
+
}(CreateClientValidator));
|
|
67
92
|
exports.UpdateClientValidator = UpdateClientValidator;
|
|
@@ -47,7 +47,7 @@ var ItemEntity = (function (_super) {
|
|
|
47
47
|
__metadata("design:type", product_entity_1.ProductEntity)
|
|
48
48
|
], ItemEntity.prototype, "product", void 0);
|
|
49
49
|
ItemEntity = __decorate([
|
|
50
|
-
(0, mongoose_1.Schema)({ timestamps: true })
|
|
50
|
+
(0, mongoose_1.Schema)({ timestamps: true, toJSON: { virtuals: true } })
|
|
51
51
|
], ItemEntity);
|
|
52
52
|
return ItemEntity;
|
|
53
53
|
}(abstract_entity_1.AbstractEntity));
|
|
@@ -4,3 +4,6 @@ exports.ItemSchema = void 0;
|
|
|
4
4
|
var mongoose_1 = require("@nestjs/mongoose");
|
|
5
5
|
var item_entity_1 = require("./item.entity");
|
|
6
6
|
exports.ItemSchema = mongoose_1.SchemaFactory.createForClass(item_entity_1.ItemEntity);
|
|
7
|
+
exports.ItemSchema.virtual('total').get(function () {
|
|
8
|
+
return this.price * this.quantity;
|
|
9
|
+
});
|
|
@@ -3,6 +3,7 @@ import { AbstractEntity } from '../../../abstract/abstract.entity';
|
|
|
3
3
|
import { ItemEntity } from './item/item.entity';
|
|
4
4
|
import { PaymentEntity } from './payment/payment.entity';
|
|
5
5
|
import { StatusEntity } from './status/status.entity';
|
|
6
|
+
import { ClientEntity } from "../clients/client.entity";
|
|
6
7
|
export declare class OrderEntity extends AbstractEntity {
|
|
7
8
|
static readonly $index = "store_orders";
|
|
8
9
|
number: number;
|
|
@@ -11,9 +12,10 @@ export declare class OrderEntity extends AbstractEntity {
|
|
|
11
12
|
billing?: Types.Map<any>;
|
|
12
13
|
shipping?: Types.Map<any>;
|
|
13
14
|
payment: PaymentEntity;
|
|
14
|
-
|
|
15
|
+
createdBy: string;
|
|
16
|
+
client?: ClientEntity;
|
|
15
17
|
notes: string;
|
|
16
18
|
readonly fullNumber: string;
|
|
17
19
|
readonly total: number;
|
|
18
|
-
readonly
|
|
20
|
+
readonly currentStatus: StatusEntity;
|
|
19
21
|
}
|
|
@@ -33,6 +33,7 @@ var item_schema_1 = require("./item/item.schema");
|
|
|
33
33
|
var payment_entity_1 = require("./payment/payment.entity");
|
|
34
34
|
var payment_schema_1 = require("./payment/payment.schema");
|
|
35
35
|
var shipping_entity_1 = require("./shipping/shipping.entity");
|
|
36
|
+
var client_entity_1 = require("../clients/client.entity");
|
|
36
37
|
var OrderEntity = (function (_super) {
|
|
37
38
|
__extends(OrderEntity, _super);
|
|
38
39
|
function OrderEntity() {
|
|
@@ -69,7 +70,11 @@ var OrderEntity = (function (_super) {
|
|
|
69
70
|
__decorate([
|
|
70
71
|
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
|
|
71
72
|
__metadata("design:type", String)
|
|
72
|
-
], OrderEntity.prototype, "
|
|
73
|
+
], OrderEntity.prototype, "createdBy", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: client_entity_1.ClientEntity.$index }),
|
|
76
|
+
__metadata("design:type", client_entity_1.ClientEntity)
|
|
77
|
+
], OrderEntity.prototype, "client", void 0);
|
|
73
78
|
__decorate([
|
|
74
79
|
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String }),
|
|
75
80
|
__metadata("design:type", String)
|