@merkaly/api 0.2.2-8 → 0.2.2-9
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/configs/app.entity.js +28 -0
- package/.output/modules/assets/asset.entity.js +43 -0
- package/.output/modules/auth/connections/connection.validator.js +29 -0
- package/.output/modules/auth/members/member.validator.js +3 -0
- package/.output/modules/auth/organizations/organization.validator.js +27 -0
- package/.output/modules/inventory/brands/brand.entity.js +27 -0
- package/.output/modules/inventory/brands/brand.validator.js +36 -0
- package/.output/modules/inventory/categories/category.entity.js +27 -0
- package/.output/modules/inventory/categories/category.validator.js +36 -0
- package/.output/modules/inventory/products/product.entity.js +46 -0
- package/.output/modules/inventory/products/product.validator.js +76 -0
- package/.output/modules/settings/payments/payment.entity.d.ts +10 -0
- package/.output/modules/settings/payments/payment.entity.js +35 -0
- package/.output/modules/store/cart/cart.entity.js +39 -0
- package/.output/modules/store/cart/cart.validator.d.ts +2 -0
- package/.output/modules/store/cart/cart.validator.js +48 -0
- package/.output/modules/store/orders/billing/billing.entity.js +38 -0
- package/.output/modules/store/orders/billing/billing.validator.js +36 -0
- package/.output/modules/store/orders/item/item.entity.d.ts +1 -0
- package/.output/modules/store/orders/item/item.entity.js +32 -0
- package/.output/modules/store/orders/item/item.validator.js +22 -0
- package/.output/modules/store/orders/order.entity.d.ts +2 -1
- package/.output/modules/store/orders/order.entity.js +47 -0
- package/.output/modules/store/orders/order.validator.d.ts +2 -0
- package/.output/modules/store/orders/order.validator.js +42 -0
- package/.output/modules/store/orders/shipping/shipping.entity.js +38 -0
- package/.output/modules/store/orders/shipping/shipping.validator.js +36 -0
- package/.output/modules/store/orders/status/status.entity.d.ts +1 -1
- package/.output/modules/store/orders/status/status.entity.js +39 -0
- package/.output/types.js +0 -0
- package/package.json +6 -7
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AppEntity = void 0;
|
|
10
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
11
|
+
const mongoose_2 = require("mongoose");
|
|
12
|
+
class AppEntity extends mongoose_2.Document {
|
|
13
|
+
static $index;
|
|
14
|
+
_id = '';
|
|
15
|
+
createdAt = new Date();
|
|
16
|
+
updatedAt = null;
|
|
17
|
+
deletedAt = null;
|
|
18
|
+
}
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date, default: new Date() })
|
|
21
|
+
], AppEntity.prototype, "createdAt", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date })
|
|
24
|
+
], AppEntity.prototype, "updatedAt", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date })
|
|
27
|
+
], AppEntity.prototype, "deletedAt", void 0);
|
|
28
|
+
exports.AppEntity = AppEntity;
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AssetEntity = void 0;
|
|
10
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
11
|
+
const mongoose_2 = require("mongoose");
|
|
12
|
+
const app_entity_1 = require("../../configs/app.entity");
|
|
13
|
+
let AssetEntity = class AssetEntity extends app_entity_1.AppEntity {
|
|
14
|
+
static $index = 'assets';
|
|
15
|
+
name;
|
|
16
|
+
url;
|
|
17
|
+
weak = true;
|
|
18
|
+
description;
|
|
19
|
+
type;
|
|
20
|
+
size = 0;
|
|
21
|
+
};
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true, unique: true })
|
|
24
|
+
], AssetEntity.prototype, "name", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true })
|
|
27
|
+
], AssetEntity.prototype, "url", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Boolean, default: true })
|
|
30
|
+
], AssetEntity.prototype, "weak", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, nullable: true })
|
|
33
|
+
], AssetEntity.prototype, "description", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String })
|
|
36
|
+
], AssetEntity.prototype, "type", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Number, required: true, default: 0 })
|
|
39
|
+
], AssetEntity.prototype, "size", void 0);
|
|
40
|
+
AssetEntity = __decorate([
|
|
41
|
+
(0, mongoose_1.Schema)({ timestamps: true })
|
|
42
|
+
], AssetEntity);
|
|
43
|
+
exports.AssetEntity = AssetEntity;
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.UpdateConnectionValidator = exports.CreateConnectionValidator = void 0;
|
|
10
|
+
const class_validator_1 = require("class-validator");
|
|
11
|
+
require("reflect-metadata");
|
|
12
|
+
class CreateConnectionValidator {
|
|
13
|
+
connection_id;
|
|
14
|
+
assign_membership_on_login;
|
|
15
|
+
}
|
|
16
|
+
__decorate([
|
|
17
|
+
(0, class_validator_1.IsString)()
|
|
18
|
+
], CreateConnectionValidator.prototype, "connection_id", void 0);
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, class_validator_1.IsBoolean)()
|
|
21
|
+
], CreateConnectionValidator.prototype, "assign_membership_on_login", void 0);
|
|
22
|
+
exports.CreateConnectionValidator = CreateConnectionValidator;
|
|
23
|
+
class UpdateConnectionValidator {
|
|
24
|
+
assign_membership_on_login;
|
|
25
|
+
}
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, class_validator_1.IsBoolean)()
|
|
28
|
+
], UpdateConnectionValidator.prototype, "assign_membership_on_login", void 0);
|
|
29
|
+
exports.UpdateConnectionValidator = UpdateConnectionValidator;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CreateOrganizationValidator = void 0;
|
|
10
|
+
const class_validator_1 = require("class-validator");
|
|
11
|
+
class CreateOrganizationValidator {
|
|
12
|
+
name;
|
|
13
|
+
email;
|
|
14
|
+
password;
|
|
15
|
+
}
|
|
16
|
+
__decorate([
|
|
17
|
+
(0, class_validator_1.IsString)(),
|
|
18
|
+
(0, class_validator_1.Length)(3, 255)
|
|
19
|
+
], CreateOrganizationValidator.prototype, "name", void 0);
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, class_validator_1.IsString)(),
|
|
22
|
+
(0, class_validator_1.IsEmail)()
|
|
23
|
+
], CreateOrganizationValidator.prototype, "email", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, class_validator_1.IsString)()
|
|
26
|
+
], CreateOrganizationValidator.prototype, "password", void 0);
|
|
27
|
+
exports.CreateOrganizationValidator = CreateOrganizationValidator;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.BrandEntity = void 0;
|
|
10
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
11
|
+
const mongoose_2 = require("mongoose");
|
|
12
|
+
const app_entity_1 = require("../../../configs/app.entity");
|
|
13
|
+
let BrandEntity = class BrandEntity extends app_entity_1.AppEntity {
|
|
14
|
+
static $index = 'inventory_brands';
|
|
15
|
+
name;
|
|
16
|
+
description;
|
|
17
|
+
};
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true, unique: true, length: 32 })
|
|
20
|
+
], BrandEntity.prototype, "name", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String })
|
|
23
|
+
], BrandEntity.prototype, "description", void 0);
|
|
24
|
+
BrandEntity = __decorate([
|
|
25
|
+
(0, mongoose_1.Schema)({ timestamps: true })
|
|
26
|
+
], BrandEntity);
|
|
27
|
+
exports.BrandEntity = BrandEntity;
|
|
@@ -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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.UpdateBrandValidator = exports.CreateBrandValidator = void 0;
|
|
10
|
+
const class_validator_1 = require("class-validator");
|
|
11
|
+
class CreateBrandValidator {
|
|
12
|
+
name;
|
|
13
|
+
description;
|
|
14
|
+
}
|
|
15
|
+
__decorate([
|
|
16
|
+
(0, class_validator_1.IsString)(),
|
|
17
|
+
(0, class_validator_1.Length)(2, 32)
|
|
18
|
+
], CreateBrandValidator.prototype, "name", void 0);
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, class_validator_1.IsString)(),
|
|
21
|
+
(0, class_validator_1.IsOptional)()
|
|
22
|
+
], CreateBrandValidator.prototype, "description", void 0);
|
|
23
|
+
exports.CreateBrandValidator = CreateBrandValidator;
|
|
24
|
+
class UpdateBrandValidator {
|
|
25
|
+
name;
|
|
26
|
+
description;
|
|
27
|
+
}
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, class_validator_1.IsString)(),
|
|
30
|
+
(0, class_validator_1.IsOptional)()
|
|
31
|
+
], UpdateBrandValidator.prototype, "name", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, class_validator_1.IsString)(),
|
|
34
|
+
(0, class_validator_1.IsOptional)()
|
|
35
|
+
], UpdateBrandValidator.prototype, "description", void 0);
|
|
36
|
+
exports.UpdateBrandValidator = UpdateBrandValidator;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CategoryEntity = void 0;
|
|
10
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
11
|
+
const mongoose_2 = require("mongoose");
|
|
12
|
+
const app_entity_1 = require("../../../configs/app.entity");
|
|
13
|
+
let CategoryEntity = class CategoryEntity extends app_entity_1.AppEntity {
|
|
14
|
+
static $index = 'inventory_categories';
|
|
15
|
+
name;
|
|
16
|
+
description;
|
|
17
|
+
};
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, length: 32, unique: true, required: true })
|
|
20
|
+
], CategoryEntity.prototype, "name", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String })
|
|
23
|
+
], CategoryEntity.prototype, "description", void 0);
|
|
24
|
+
CategoryEntity = __decorate([
|
|
25
|
+
(0, mongoose_1.Schema)({ timestamps: true })
|
|
26
|
+
], CategoryEntity);
|
|
27
|
+
exports.CategoryEntity = CategoryEntity;
|
|
@@ -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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.UpdateCategoryValidator = exports.CreateCategoryValidator = void 0;
|
|
10
|
+
const class_validator_1 = require("class-validator");
|
|
11
|
+
class CreateCategoryValidator {
|
|
12
|
+
name;
|
|
13
|
+
description;
|
|
14
|
+
}
|
|
15
|
+
__decorate([
|
|
16
|
+
(0, class_validator_1.IsString)(),
|
|
17
|
+
(0, class_validator_1.Length)(5, 32)
|
|
18
|
+
], CreateCategoryValidator.prototype, "name", void 0);
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, class_validator_1.IsString)(),
|
|
21
|
+
(0, class_validator_1.IsOptional)()
|
|
22
|
+
], CreateCategoryValidator.prototype, "description", void 0);
|
|
23
|
+
exports.CreateCategoryValidator = CreateCategoryValidator;
|
|
24
|
+
class UpdateCategoryValidator {
|
|
25
|
+
name;
|
|
26
|
+
description;
|
|
27
|
+
}
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, class_validator_1.IsString)(),
|
|
30
|
+
(0, class_validator_1.IsOptional)()
|
|
31
|
+
], UpdateCategoryValidator.prototype, "name", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, class_validator_1.IsString)(),
|
|
34
|
+
(0, class_validator_1.IsOptional)()
|
|
35
|
+
], UpdateCategoryValidator.prototype, "description", void 0);
|
|
36
|
+
exports.UpdateCategoryValidator = UpdateCategoryValidator;
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ProductEntity = void 0;
|
|
10
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
11
|
+
const mongoose_2 = require("mongoose");
|
|
12
|
+
const app_entity_1 = require("../../../configs/app.entity");
|
|
13
|
+
const asset_entity_1 = require("../../assets/asset.entity");
|
|
14
|
+
const brand_entity_1 = require("../brands/brand.entity");
|
|
15
|
+
const category_entity_1 = require("../categories/category.entity");
|
|
16
|
+
let ProductEntity = class ProductEntity extends app_entity_1.AppEntity {
|
|
17
|
+
static $index = 'inventory_products';
|
|
18
|
+
name;
|
|
19
|
+
description;
|
|
20
|
+
price = 0;
|
|
21
|
+
category;
|
|
22
|
+
brand;
|
|
23
|
+
files = [];
|
|
24
|
+
};
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true, unique: true, length: 64 })
|
|
27
|
+
], ProductEntity.prototype, "name", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, nullable: true })
|
|
30
|
+
], ProductEntity.prototype, "description", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Number, default: 0 })
|
|
33
|
+
], ProductEntity.prototype, "price", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Types.ObjectId, ref: category_entity_1.CategoryEntity.$index })
|
|
36
|
+
], ProductEntity.prototype, "category", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Types.ObjectId, ref: brand_entity_1.BrandEntity.$index })
|
|
39
|
+
], ProductEntity.prototype, "brand", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, mongoose_1.Prop)({ type: [{ type: mongoose_2.Types.ObjectId, ref: asset_entity_1.AssetEntity.$index }] })
|
|
42
|
+
], ProductEntity.prototype, "files", void 0);
|
|
43
|
+
ProductEntity = __decorate([
|
|
44
|
+
(0, mongoose_1.Schema)({ timestamps: true })
|
|
45
|
+
], ProductEntity);
|
|
46
|
+
exports.ProductEntity = ProductEntity;
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.UpdateProductValidator = exports.CreateProductValidator = void 0;
|
|
10
|
+
const class_transformer_1 = require("class-transformer");
|
|
11
|
+
const class_validator_1 = require("class-validator");
|
|
12
|
+
class CreateProductValidator {
|
|
13
|
+
name;
|
|
14
|
+
description;
|
|
15
|
+
price = 0;
|
|
16
|
+
category;
|
|
17
|
+
brand;
|
|
18
|
+
files = [];
|
|
19
|
+
}
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, class_validator_1.IsString)()
|
|
22
|
+
], CreateProductValidator.prototype, "name", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, class_validator_1.IsString)(),
|
|
25
|
+
(0, class_validator_1.IsOptional)()
|
|
26
|
+
], CreateProductValidator.prototype, "description", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, class_validator_1.IsNumber)(),
|
|
29
|
+
(0, class_validator_1.IsOptional)()
|
|
30
|
+
], CreateProductValidator.prototype, "price", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, class_validator_1.IsOptional)(),
|
|
33
|
+
(0, class_validator_1.IsMongoId)()
|
|
34
|
+
], CreateProductValidator.prototype, "category", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, class_validator_1.IsOptional)(),
|
|
37
|
+
(0, class_validator_1.IsMongoId)()
|
|
38
|
+
], CreateProductValidator.prototype, "brand", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, class_transformer_1.Transform)(({ value }) => value.map(({ _id }) => _id)),
|
|
41
|
+
(0, class_validator_1.IsOptional)()
|
|
42
|
+
], CreateProductValidator.prototype, "files", void 0);
|
|
43
|
+
exports.CreateProductValidator = CreateProductValidator;
|
|
44
|
+
class UpdateProductValidator {
|
|
45
|
+
name;
|
|
46
|
+
description;
|
|
47
|
+
price;
|
|
48
|
+
category;
|
|
49
|
+
brand;
|
|
50
|
+
files;
|
|
51
|
+
}
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, class_validator_1.IsString)(),
|
|
54
|
+
(0, class_validator_1.IsOptional)()
|
|
55
|
+
], UpdateProductValidator.prototype, "name", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, class_validator_1.IsString)(),
|
|
58
|
+
(0, class_validator_1.IsOptional)()
|
|
59
|
+
], UpdateProductValidator.prototype, "description", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, class_validator_1.IsNumber)(),
|
|
62
|
+
(0, class_validator_1.IsOptional)()
|
|
63
|
+
], UpdateProductValidator.prototype, "price", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, class_validator_1.IsOptional)(),
|
|
66
|
+
(0, class_validator_1.IsMongoId)()
|
|
67
|
+
], UpdateProductValidator.prototype, "category", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, class_validator_1.IsOptional)(),
|
|
70
|
+
(0, class_validator_1.IsMongoId)()
|
|
71
|
+
], UpdateProductValidator.prototype, "brand", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, class_transformer_1.Transform)(({ value }) => value.map(({ _id }) => _id)),
|
|
74
|
+
(0, class_validator_1.IsOptional)()
|
|
75
|
+
], UpdateProductValidator.prototype, "files", void 0);
|
|
76
|
+
exports.UpdateProductValidator = UpdateProductValidator;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AppEntity } from '../../../configs/app.entity';
|
|
2
|
+
export declare enum PaymentType {
|
|
3
|
+
COD = "CASH_ON_DELIVERY"
|
|
4
|
+
}
|
|
5
|
+
export declare class PaymentEntity extends AppEntity {
|
|
6
|
+
static readonly $index = "settings_payments";
|
|
7
|
+
name: PaymentType;
|
|
8
|
+
active: boolean;
|
|
9
|
+
description: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.PaymentEntity = exports.PaymentType = void 0;
|
|
10
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
11
|
+
const mongoose_2 = require("mongoose");
|
|
12
|
+
const app_entity_1 = require("../../../configs/app.entity");
|
|
13
|
+
var PaymentType;
|
|
14
|
+
(function (PaymentType) {
|
|
15
|
+
PaymentType["COD"] = "CASH_ON_DELIVERY";
|
|
16
|
+
})(PaymentType = exports.PaymentType || (exports.PaymentType = {}));
|
|
17
|
+
let PaymentEntity = class PaymentEntity extends app_entity_1.AppEntity {
|
|
18
|
+
static $index = 'settings_payments';
|
|
19
|
+
name;
|
|
20
|
+
active = true;
|
|
21
|
+
description;
|
|
22
|
+
};
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, enum: PaymentType, required: true, unique: true })
|
|
25
|
+
], PaymentEntity.prototype, "name", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Boolean, default: true })
|
|
28
|
+
], PaymentEntity.prototype, "active", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, default: String() })
|
|
31
|
+
], PaymentEntity.prototype, "description", void 0);
|
|
32
|
+
PaymentEntity = __decorate([
|
|
33
|
+
(0, mongoose_1.Schema)({ timestamps: true })
|
|
34
|
+
], PaymentEntity);
|
|
35
|
+
exports.PaymentEntity = PaymentEntity;
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CartEntity = exports.CartStatus = void 0;
|
|
10
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
11
|
+
const mongoose_2 = require("mongoose");
|
|
12
|
+
const app_entity_1 = require("../../../configs/app.entity");
|
|
13
|
+
const item_entity_1 = require("../orders/item/item.entity");
|
|
14
|
+
var CartStatus;
|
|
15
|
+
(function (CartStatus) {
|
|
16
|
+
CartStatus["EMPTY"] = "EMPTY";
|
|
17
|
+
CartStatus["FILLED"] = "FILLED";
|
|
18
|
+
CartStatus["FINISHED"] = "FINISHED";
|
|
19
|
+
CartStatus["ABANDONED"] = "ABANDONED";
|
|
20
|
+
})(CartStatus = exports.CartStatus || (exports.CartStatus = {}));
|
|
21
|
+
let CartEntity = class CartEntity extends app_entity_1.AppEntity {
|
|
22
|
+
static $index = 'store_carts';
|
|
23
|
+
user;
|
|
24
|
+
status = CartStatus.EMPTY;
|
|
25
|
+
items = [];
|
|
26
|
+
};
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true })
|
|
29
|
+
], CartEntity.prototype, "user", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, enum: CartStatus, default: CartStatus.EMPTY })
|
|
32
|
+
], CartEntity.prototype, "status", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, mongoose_1.Prop)({ type: [item_entity_1.ItemSchema], default: [] })
|
|
35
|
+
], CartEntity.prototype, "items", void 0);
|
|
36
|
+
CartEntity = __decorate([
|
|
37
|
+
(0, mongoose_1.Schema)({ timestamps: true })
|
|
38
|
+
], CartEntity);
|
|
39
|
+
exports.CartEntity = CartEntity;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { PaymentType } from '../../settings/payments/payment.entity';
|
|
1
2
|
import { CreateBillingValidator } from '../orders/billing/billing.validator';
|
|
2
3
|
import { CreateShippingValidator } from '../orders/shipping/shipping.validator';
|
|
3
4
|
export declare class CheckoutCartValidator {
|
|
4
5
|
cart: string;
|
|
5
6
|
billing: CreateBillingValidator;
|
|
6
7
|
shipping: CreateShippingValidator;
|
|
8
|
+
payment: PaymentType;
|
|
7
9
|
}
|
|
8
10
|
export declare class AddItemValidator {
|
|
9
11
|
product: string;
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AddItemValidator = exports.CheckoutCartValidator = void 0;
|
|
10
|
+
const class_transformer_1 = require("class-transformer");
|
|
11
|
+
const class_validator_1 = require("class-validator");
|
|
12
|
+
const payment_entity_1 = require("../../settings/payments/payment.entity");
|
|
13
|
+
const billing_validator_1 = require("../orders/billing/billing.validator");
|
|
14
|
+
const shipping_validator_1 = require("../orders/shipping/shipping.validator");
|
|
15
|
+
class CheckoutCartValidator {
|
|
16
|
+
cart;
|
|
17
|
+
billing;
|
|
18
|
+
shipping;
|
|
19
|
+
payment;
|
|
20
|
+
}
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, class_validator_1.IsMongoId)()
|
|
23
|
+
], CheckoutCartValidator.prototype, "cart", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, class_validator_1.ValidateNested)(),
|
|
26
|
+
(0, class_transformer_1.Type)(() => billing_validator_1.CreateBillingValidator)
|
|
27
|
+
], CheckoutCartValidator.prototype, "billing", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, class_validator_1.ValidateNested)(),
|
|
30
|
+
(0, class_transformer_1.Type)(() => shipping_validator_1.CreateShippingValidator)
|
|
31
|
+
], CheckoutCartValidator.prototype, "shipping", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, class_validator_1.ValidateNested)(),
|
|
34
|
+
(0, class_validator_1.IsEnum)(payment_entity_1.PaymentType)
|
|
35
|
+
], CheckoutCartValidator.prototype, "payment", void 0);
|
|
36
|
+
exports.CheckoutCartValidator = CheckoutCartValidator;
|
|
37
|
+
class AddItemValidator {
|
|
38
|
+
product;
|
|
39
|
+
quantity = 1;
|
|
40
|
+
}
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, class_validator_1.IsMongoId)()
|
|
43
|
+
], AddItemValidator.prototype, "product", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, class_validator_1.IsOptional)(),
|
|
46
|
+
(0, class_validator_1.Min)(1)
|
|
47
|
+
], AddItemValidator.prototype, "quantity", void 0);
|
|
48
|
+
exports.AddItemValidator = AddItemValidator;
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.BillingEntity = void 0;
|
|
10
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
11
|
+
const schema_decorator_1 = require("@nestjs/mongoose/dist/decorators/schema.decorator");
|
|
12
|
+
const mongoose_2 = require("mongoose");
|
|
13
|
+
let BillingEntity = class BillingEntity {
|
|
14
|
+
name;
|
|
15
|
+
email;
|
|
16
|
+
phone;
|
|
17
|
+
address;
|
|
18
|
+
code;
|
|
19
|
+
};
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true })
|
|
22
|
+
], BillingEntity.prototype, "name", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String })
|
|
25
|
+
], BillingEntity.prototype, "email", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String })
|
|
28
|
+
], BillingEntity.prototype, "phone", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true })
|
|
31
|
+
], BillingEntity.prototype, "address", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true })
|
|
34
|
+
], BillingEntity.prototype, "code", void 0);
|
|
35
|
+
BillingEntity = __decorate([
|
|
36
|
+
(0, schema_decorator_1.Schema)({ timestamps: true })
|
|
37
|
+
], BillingEntity);
|
|
38
|
+
exports.BillingEntity = BillingEntity;
|
|
@@ -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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CreateBillingValidator = void 0;
|
|
10
|
+
const class_validator_1 = require("class-validator");
|
|
11
|
+
class CreateBillingValidator {
|
|
12
|
+
name;
|
|
13
|
+
email;
|
|
14
|
+
phone;
|
|
15
|
+
address;
|
|
16
|
+
code;
|
|
17
|
+
}
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, class_validator_1.IsString)(),
|
|
20
|
+
(0, class_validator_1.IsNotEmpty)()
|
|
21
|
+
], CreateBillingValidator.prototype, "name", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_validator_1.IsEmail)()
|
|
24
|
+
], CreateBillingValidator.prototype, "email", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, class_validator_1.IsString)()
|
|
27
|
+
], CreateBillingValidator.prototype, "phone", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, class_validator_1.IsString)(),
|
|
30
|
+
(0, class_validator_1.IsNotEmpty)()
|
|
31
|
+
], CreateBillingValidator.prototype, "address", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, class_validator_1.IsString)(),
|
|
34
|
+
(0, class_validator_1.IsOptional)()
|
|
35
|
+
], CreateBillingValidator.prototype, "code", void 0);
|
|
36
|
+
exports.CreateBillingValidator = CreateBillingValidator;
|
|
@@ -27,6 +27,7 @@ import { AppEntity } from '../../../../configs/app.entity';
|
|
|
27
27
|
import { ProductEntity } from '../../../inventory/products/product.entity';
|
|
28
28
|
export declare class ItemEntity extends AppEntity {
|
|
29
29
|
quantity: number;
|
|
30
|
+
price: number;
|
|
30
31
|
product: ProductEntity;
|
|
31
32
|
}
|
|
32
33
|
export declare const ItemSchema: Schema<ItemEntity, import("mongoose").Model<ItemEntity, any, any, any, any>, {}, {}, {}, {}, "type", ItemEntity>;
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ItemSchema = exports.ItemEntity = void 0;
|
|
10
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
11
|
+
const mongoose_2 = require("mongoose");
|
|
12
|
+
const app_entity_1 = require("../../../../configs/app.entity");
|
|
13
|
+
const product_entity_1 = require("../../../inventory/products/product.entity");
|
|
14
|
+
let ItemEntity = class ItemEntity extends app_entity_1.AppEntity {
|
|
15
|
+
quantity;
|
|
16
|
+
price;
|
|
17
|
+
product;
|
|
18
|
+
};
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Number, default: 1 })
|
|
21
|
+
], ItemEntity.prototype, "quantity", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Number, default: 0 })
|
|
24
|
+
], ItemEntity.prototype, "price", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Types.ObjectId, ref: product_entity_1.ProductEntity.$index, required: true })
|
|
27
|
+
], ItemEntity.prototype, "product", void 0);
|
|
28
|
+
ItemEntity = __decorate([
|
|
29
|
+
(0, mongoose_1.Schema)({ timestamps: true })
|
|
30
|
+
], ItemEntity);
|
|
31
|
+
exports.ItemEntity = ItemEntity;
|
|
32
|
+
exports.ItemSchema = mongoose_1.SchemaFactory.createForClass(ItemEntity);
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CreateItemValidator = void 0;
|
|
10
|
+
const class_validator_1 = require("class-validator");
|
|
11
|
+
class CreateItemValidator {
|
|
12
|
+
quantity = 1;
|
|
13
|
+
product;
|
|
14
|
+
}
|
|
15
|
+
__decorate([
|
|
16
|
+
(0, class_validator_1.IsNumber)(),
|
|
17
|
+
(0, class_validator_1.IsNotEmpty)()
|
|
18
|
+
], CreateItemValidator.prototype, "quantity", void 0);
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, class_validator_1.IsMongoId)()
|
|
21
|
+
], CreateItemValidator.prototype, "product", void 0);
|
|
22
|
+
exports.CreateItemValidator = CreateItemValidator;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AppEntity } from '../../../configs/app.entity';
|
|
2
|
+
import { PaymentEntity } from '../../settings/payments/payment.entity';
|
|
2
3
|
import { BillingEntity } from './billing/billing.entity';
|
|
3
4
|
import { ItemEntity } from './item/item.entity';
|
|
4
5
|
import { ShippingEntity } from './shipping/shipping.entity';
|
|
@@ -6,9 +7,9 @@ import { StatusEntity } from './status/status.entity';
|
|
|
6
7
|
export declare class OrderEntity extends AppEntity {
|
|
7
8
|
static readonly $index = "store_orders";
|
|
8
9
|
number: string;
|
|
9
|
-
amount: number;
|
|
10
10
|
status: StatusEntity[];
|
|
11
11
|
items: ItemEntity[];
|
|
12
12
|
billing: BillingEntity;
|
|
13
13
|
shipping: ShippingEntity;
|
|
14
|
+
payment: PaymentEntity;
|
|
14
15
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.OrderEntity = void 0;
|
|
10
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
11
|
+
const mongoose_2 = require("mongoose");
|
|
12
|
+
const app_entity_1 = require("../../../configs/app.entity");
|
|
13
|
+
const payment_entity_1 = require("../../settings/payments/payment.entity");
|
|
14
|
+
const billing_entity_1 = require("./billing/billing.entity");
|
|
15
|
+
const item_entity_1 = require("./item/item.entity");
|
|
16
|
+
const shipping_entity_1 = require("./shipping/shipping.entity");
|
|
17
|
+
let OrderEntity = class OrderEntity extends app_entity_1.AppEntity {
|
|
18
|
+
static $index = 'store_orders';
|
|
19
|
+
number;
|
|
20
|
+
status = [];
|
|
21
|
+
items = [];
|
|
22
|
+
billing;
|
|
23
|
+
shipping;
|
|
24
|
+
payment;
|
|
25
|
+
};
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true, unique: true })
|
|
28
|
+
], OrderEntity.prototype, "number", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Array, default: [] })
|
|
31
|
+
], OrderEntity.prototype, "status", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, mongoose_1.Prop)({ type: [item_entity_1.ItemSchema], default: [] })
|
|
34
|
+
], OrderEntity.prototype, "items", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Map, ref: () => billing_entity_1.BillingEntity })
|
|
37
|
+
], OrderEntity.prototype, "billing", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Map, ref: () => shipping_entity_1.ShippingEntity })
|
|
40
|
+
], OrderEntity.prototype, "shipping", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Types.ObjectId, ref: payment_entity_1.PaymentEntity.$index })
|
|
43
|
+
], OrderEntity.prototype, "payment", void 0);
|
|
44
|
+
OrderEntity = __decorate([
|
|
45
|
+
(0, mongoose_1.Schema)({ timestamps: true })
|
|
46
|
+
], OrderEntity);
|
|
47
|
+
exports.OrderEntity = OrderEntity;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PaymentType } from '../../settings/payments/payment.entity';
|
|
1
2
|
import { CreateBillingValidator } from './billing/billing.validator';
|
|
2
3
|
import { CreateItemValidator } from './item/item.validator';
|
|
3
4
|
import { CreateShippingValidator } from './shipping/shipping.validator';
|
|
@@ -5,6 +6,7 @@ export declare class CreateOrderValidator {
|
|
|
5
6
|
items: CreateItemValidator[];
|
|
6
7
|
billing: CreateBillingValidator;
|
|
7
8
|
shipping: CreateShippingValidator;
|
|
9
|
+
payment: PaymentType;
|
|
8
10
|
}
|
|
9
11
|
export declare class UpdateOrderValidator {
|
|
10
12
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.UpdateOrderValidator = exports.CreateOrderValidator = void 0;
|
|
10
|
+
const class_transformer_1 = require("class-transformer");
|
|
11
|
+
const class_validator_1 = require("class-validator");
|
|
12
|
+
const payment_entity_1 = require("../../settings/payments/payment.entity");
|
|
13
|
+
const billing_validator_1 = require("./billing/billing.validator");
|
|
14
|
+
const item_validator_1 = require("./item/item.validator");
|
|
15
|
+
const shipping_validator_1 = require("./shipping/shipping.validator");
|
|
16
|
+
class CreateOrderValidator {
|
|
17
|
+
items = [];
|
|
18
|
+
billing;
|
|
19
|
+
shipping;
|
|
20
|
+
payment;
|
|
21
|
+
}
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_validator_1.ArrayNotEmpty)(),
|
|
24
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
25
|
+
(0, class_transformer_1.Type)(() => item_validator_1.CreateItemValidator)
|
|
26
|
+
], CreateOrderValidator.prototype, "items", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, class_validator_1.ValidateNested)(),
|
|
29
|
+
(0, class_transformer_1.Type)(() => billing_validator_1.CreateBillingValidator)
|
|
30
|
+
], CreateOrderValidator.prototype, "billing", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, class_validator_1.ValidateNested)(),
|
|
33
|
+
(0, class_transformer_1.Type)(() => shipping_validator_1.CreateShippingValidator)
|
|
34
|
+
], CreateOrderValidator.prototype, "shipping", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, class_validator_1.ValidateNested)(),
|
|
37
|
+
(0, class_validator_1.IsEnum)(payment_entity_1.PaymentType)
|
|
38
|
+
], CreateOrderValidator.prototype, "payment", void 0);
|
|
39
|
+
exports.CreateOrderValidator = CreateOrderValidator;
|
|
40
|
+
class UpdateOrderValidator {
|
|
41
|
+
}
|
|
42
|
+
exports.UpdateOrderValidator = UpdateOrderValidator;
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ShippingEntity = void 0;
|
|
10
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
11
|
+
const schema_decorator_1 = require("@nestjs/mongoose/dist/decorators/schema.decorator");
|
|
12
|
+
const mongoose_2 = require("mongoose");
|
|
13
|
+
let ShippingEntity = class ShippingEntity {
|
|
14
|
+
name;
|
|
15
|
+
email;
|
|
16
|
+
phone;
|
|
17
|
+
address;
|
|
18
|
+
code;
|
|
19
|
+
};
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true })
|
|
22
|
+
], ShippingEntity.prototype, "name", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String })
|
|
25
|
+
], ShippingEntity.prototype, "email", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String })
|
|
28
|
+
], ShippingEntity.prototype, "phone", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true })
|
|
31
|
+
], ShippingEntity.prototype, "address", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, required: true })
|
|
34
|
+
], ShippingEntity.prototype, "code", void 0);
|
|
35
|
+
ShippingEntity = __decorate([
|
|
36
|
+
(0, schema_decorator_1.Schema)({ timestamps: true })
|
|
37
|
+
], ShippingEntity);
|
|
38
|
+
exports.ShippingEntity = ShippingEntity;
|
|
@@ -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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CreateShippingValidator = void 0;
|
|
10
|
+
const class_validator_1 = require("class-validator");
|
|
11
|
+
class CreateShippingValidator {
|
|
12
|
+
name;
|
|
13
|
+
email;
|
|
14
|
+
phone;
|
|
15
|
+
address;
|
|
16
|
+
code;
|
|
17
|
+
}
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, class_validator_1.IsString)(),
|
|
20
|
+
(0, class_validator_1.IsNotEmpty)()
|
|
21
|
+
], CreateShippingValidator.prototype, "name", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_validator_1.IsEmail)()
|
|
24
|
+
], CreateShippingValidator.prototype, "email", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, class_validator_1.IsString)()
|
|
27
|
+
], CreateShippingValidator.prototype, "phone", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, class_validator_1.IsString)(),
|
|
30
|
+
(0, class_validator_1.IsNotEmpty)()
|
|
31
|
+
], CreateShippingValidator.prototype, "address", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, class_validator_1.IsString)(),
|
|
34
|
+
(0, class_validator_1.IsOptional)()
|
|
35
|
+
], CreateShippingValidator.prototype, "code", void 0);
|
|
36
|
+
exports.CreateShippingValidator = CreateShippingValidator;
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.StatusEntity = exports.StatusType = void 0;
|
|
10
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
11
|
+
const schema_decorator_1 = require("@nestjs/mongoose/dist/decorators/schema.decorator");
|
|
12
|
+
const mongoose_2 = require("mongoose");
|
|
13
|
+
var StatusType;
|
|
14
|
+
(function (StatusType) {
|
|
15
|
+
StatusType["CREATED"] = "CREATED";
|
|
16
|
+
StatusType["APPROVED"] = "APPROVED";
|
|
17
|
+
StatusType["ON_HOLD"] = "ON_HOLD";
|
|
18
|
+
StatusType["IN_PROGRESS"] = "IN_PROGRESS";
|
|
19
|
+
StatusType["COMPLETED"] = "COMPLETED";
|
|
20
|
+
StatusType["CANCELED"] = "CANCELED";
|
|
21
|
+
})(StatusType = exports.StatusType || (exports.StatusType = {}));
|
|
22
|
+
let StatusEntity = class StatusEntity {
|
|
23
|
+
name;
|
|
24
|
+
user;
|
|
25
|
+
date = new Date();
|
|
26
|
+
};
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String, enum: StatusType, required: true })
|
|
29
|
+
], StatusEntity.prototype, "name", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.String })
|
|
32
|
+
], StatusEntity.prototype, "user", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Date, default: new Date() })
|
|
35
|
+
], StatusEntity.prototype, "date", void 0);
|
|
36
|
+
StatusEntity = __decorate([
|
|
37
|
+
(0, schema_decorator_1.Schema)({ timestamps: true })
|
|
38
|
+
], StatusEntity);
|
|
39
|
+
exports.StatusEntity = StatusEntity;
|
package/.output/types.js
ADDED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkaly/api",
|
|
3
|
-
"version": "0.2.2-
|
|
3
|
+
"version": "0.2.2-9",
|
|
4
4
|
"description": "NestJS Backend ApiRest Service",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,11 +31,12 @@
|
|
|
31
31
|
"test:watch": "yarn test -- --watch"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
+
"@nestjs/mongoose": "^9.2.0",
|
|
34
35
|
"@types/auth0": "^2.35.2",
|
|
35
36
|
"class-transformer": "^0.5.1",
|
|
36
37
|
"class-validator": "^0.13.1",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
38
|
+
"mongoose": "^6.5.1",
|
|
39
|
+
"reflect-metadata": "^0.1.13"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"@commitlint/config-conventional": "^17.0.0",
|
|
@@ -46,7 +47,6 @@
|
|
|
46
47
|
"@nestjs/config": "^2.2.0",
|
|
47
48
|
"@nestjs/core": "^9.0.11",
|
|
48
49
|
"@nestjs/jwt": "^9.0.0",
|
|
49
|
-
"@nestjs/mongoose": "^9.2.0",
|
|
50
50
|
"@nestjs/passport": "^9.0.0",
|
|
51
51
|
"@nestjs/platform-express": "^9.0.11",
|
|
52
52
|
"@nestjs/schematics": "^9.0.1",
|
|
@@ -64,20 +64,18 @@
|
|
|
64
64
|
"@typescript-eslint/parser": "4.33.0",
|
|
65
65
|
"auth0": "^2.42.0",
|
|
66
66
|
"cache-manager": "^4.1.0",
|
|
67
|
-
"chalk": "^4.1.2",
|
|
68
67
|
"commitlint": "^17.0.1",
|
|
69
68
|
"eslint": "7.32.0",
|
|
70
69
|
"eslint-plugin-import": "^2.23.4",
|
|
71
70
|
"express": "^4.17.3",
|
|
72
71
|
"husky": "^8.0.1",
|
|
73
72
|
"jest": "27.5.1",
|
|
74
|
-
"mongoose": "^6.5.1",
|
|
75
73
|
"nestjs-console": "^8.0.0",
|
|
76
74
|
"passport": "^0.6.0",
|
|
77
75
|
"passport-jwt": "^4.0.0",
|
|
78
76
|
"rimraf": "^3.0.2",
|
|
79
77
|
"rxjs": "^7.2.0",
|
|
80
|
-
"
|
|
78
|
+
"short-unique-id": "^4.4.4",
|
|
81
79
|
"supertest": "^6.1.3",
|
|
82
80
|
"swagger-ui-express": "^4.3.0",
|
|
83
81
|
"ts-jest": "27.1.3",
|
|
@@ -85,6 +83,7 @@
|
|
|
85
83
|
"ts-node": "^10.0.0",
|
|
86
84
|
"tsconfig-paths": "^4.0.0",
|
|
87
85
|
"typescript": "4.4.4",
|
|
86
|
+
"version": "^4.1.2",
|
|
88
87
|
"webpack": "^5"
|
|
89
88
|
},
|
|
90
89
|
"engines": {
|