@merkaly/api 0.2.1-2 → 0.2.1-3
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/app.js +29 -6
- package/.output/config/app.document.js +14 -8
- package/.output/config/app.entity.js +15 -11
- package/.output/config/app.validator.d.ts +1 -1
- package/.output/src/auth/auth.validator.js +10 -4
- package/.output/src/inventory/brands/brand.document.js +10 -4
- package/.output/src/inventory/brands/brand.entity.js +12 -6
- package/.output/src/inventory/brands/brand.validator.d.ts +1 -1
- package/.output/src/inventory/brands/brand.validator.js +14 -8
- package/.output/src/inventory/categories/category.document.js +10 -4
- package/.output/src/inventory/categories/category.entity.js +12 -6
- package/.output/src/inventory/categories/category.validator.d.ts +1 -1
- package/.output/src/inventory/categories/category.validator.js +14 -8
- package/.output/src/inventory/media/media.document.js +10 -4
- package/.output/src/inventory/media/media.entity.js +12 -6
- package/.output/src/inventory/media/media.validator.d.ts +1 -1
- package/.output/src/inventory/media/media.validator.js +10 -4
- package/.output/src/inventory/products/product.document.js +20 -14
- package/.output/src/inventory/products/product.entity.js +26 -26
- package/.output/src/inventory/products/product.validator.d.ts +1 -1
- package/.output/src/inventory/products/product.validator.js +34 -34
- package/.output/src/inventory/variants/variant.document.js +14 -8
- package/.output/src/inventory/variants/variant.entity.js +16 -16
- package/.output/src/inventory/variants/variant.validator.js +22 -27
- package/.output/src/store/orders/order.document.js +10 -4
- package/.output/src/store/orders/order.entity.js +10 -4
- package/.output/src/store/orders/order.validator.d.ts +1 -1
- package/package.json +4 -4
package/.output/app.js
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.Store = exports.Inventory = void 0;
|
|
4
27
|
const brand_document_1 = require("./src/inventory/brands/brand.document");
|
|
@@ -14,12 +37,12 @@ const VariantValidators = __importStar(require("./src/inventory/variants/variant
|
|
|
14
37
|
const order_document_1 = require("./src/store/orders/order.document");
|
|
15
38
|
const OrderValidators = __importStar(require("./src/store/orders/order.validator"));
|
|
16
39
|
exports.Inventory = {
|
|
17
|
-
Brand:
|
|
18
|
-
Category:
|
|
19
|
-
Product:
|
|
20
|
-
Media:
|
|
21
|
-
Variant:
|
|
40
|
+
Brand: { BrandDocument: brand_document_1.BrandDocument, ...BrandValidators },
|
|
41
|
+
Category: { CategoryDocument: category_document_1.CategoryDocument, ...CategoryValidators },
|
|
42
|
+
Product: { ProductDocument: product_document_1.ProductDocument, ...ProductValidators },
|
|
43
|
+
Media: { MediaDocument: media_document_1.MediaDocument, ...MediaValidators },
|
|
44
|
+
Variant: { VariantDocument: variant_document_1.VariantDocument, ...VariantValidators }
|
|
22
45
|
};
|
|
23
46
|
exports.Store = {
|
|
24
|
-
Order:
|
|
47
|
+
Order: { OrderDocument: order_document_1.OrderDocument, ...OrderValidators }
|
|
25
48
|
};
|
|
@@ -1,9 +1,19 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.AppDocument = void 0;
|
|
4
10
|
const class_transformer_1 = require("class-transformer");
|
|
5
11
|
const es_mapping_ts_1 = require("es-mapping-ts");
|
|
6
12
|
class AppDocument {
|
|
13
|
+
$id;
|
|
14
|
+
$createdAt;
|
|
15
|
+
$updatedAt;
|
|
16
|
+
$deletedAt;
|
|
7
17
|
serialize(entity) {
|
|
8
18
|
this.$id = entity.id;
|
|
9
19
|
this.$createdAt = entity.createdAt;
|
|
@@ -14,19 +24,15 @@ class AppDocument {
|
|
|
14
24
|
}
|
|
15
25
|
}
|
|
16
26
|
__decorate([
|
|
17
|
-
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
18
|
-
__metadata("design:type", String)
|
|
27
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
19
28
|
], AppDocument.prototype, "$id", void 0);
|
|
20
29
|
__decorate([
|
|
21
|
-
(0, es_mapping_ts_1.EsField)({ type: 'date' })
|
|
22
|
-
__metadata("design:type", Date)
|
|
30
|
+
(0, es_mapping_ts_1.EsField)({ type: 'date' })
|
|
23
31
|
], AppDocument.prototype, "$createdAt", void 0);
|
|
24
32
|
__decorate([
|
|
25
|
-
(0, es_mapping_ts_1.EsField)({ type: 'date' })
|
|
26
|
-
__metadata("design:type", Date)
|
|
33
|
+
(0, es_mapping_ts_1.EsField)({ type: 'date' })
|
|
27
34
|
], AppDocument.prototype, "$updatedAt", void 0);
|
|
28
35
|
__decorate([
|
|
29
|
-
(0, es_mapping_ts_1.EsField)({ type: 'date' })
|
|
30
|
-
__metadata("design:type", Date)
|
|
36
|
+
(0, es_mapping_ts_1.EsField)({ type: 'date' })
|
|
31
37
|
], AppDocument.prototype, "$deletedAt", void 0);
|
|
32
38
|
exports.AppDocument = AppDocument;
|
|
@@ -1,31 +1,35 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.AppEntity = void 0;
|
|
4
10
|
const typeorm_1 = require("typeorm");
|
|
5
11
|
let AppEntity = class AppEntity {
|
|
6
12
|
constructor(id) {
|
|
7
|
-
this.createdAt = new Date();
|
|
8
13
|
this.id = id;
|
|
9
14
|
}
|
|
15
|
+
id;
|
|
16
|
+
createdAt = new Date();
|
|
17
|
+
updatedAt;
|
|
18
|
+
deletedAt;
|
|
10
19
|
};
|
|
11
20
|
__decorate([
|
|
12
|
-
(0, typeorm_1.PrimaryGeneratedColumn)('uuid')
|
|
13
|
-
__metadata("design:type", String)
|
|
21
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid')
|
|
14
22
|
], AppEntity.prototype, "id", void 0);
|
|
15
23
|
__decorate([
|
|
16
|
-
(0, typeorm_1.CreateDateColumn)({ type: 'datetime', nullable: false })
|
|
17
|
-
__metadata("design:type", Object)
|
|
24
|
+
(0, typeorm_1.CreateDateColumn)({ type: 'datetime', nullable: false })
|
|
18
25
|
], AppEntity.prototype, "createdAt", void 0);
|
|
19
26
|
__decorate([
|
|
20
|
-
(0, typeorm_1.UpdateDateColumn)({ type: 'datetime', nullable: true })
|
|
21
|
-
__metadata("design:type", Date)
|
|
27
|
+
(0, typeorm_1.UpdateDateColumn)({ type: 'datetime', nullable: true })
|
|
22
28
|
], AppEntity.prototype, "updatedAt", void 0);
|
|
23
29
|
__decorate([
|
|
24
|
-
(0, typeorm_1.DeleteDateColumn)({ type: 'datetime', nullable: true })
|
|
25
|
-
__metadata("design:type", Date)
|
|
30
|
+
(0, typeorm_1.DeleteDateColumn)({ type: 'datetime', nullable: true })
|
|
26
31
|
], AppEntity.prototype, "deletedAt", void 0);
|
|
27
32
|
AppEntity = __decorate([
|
|
28
|
-
(0, typeorm_1.Entity)()
|
|
29
|
-
__metadata("design:paramtypes", [String])
|
|
33
|
+
(0, typeorm_1.Entity)()
|
|
30
34
|
], AppEntity);
|
|
31
35
|
exports.AppEntity = AppEntity;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SearchRequest } from '@elastic/elasticsearch/lib/api/types';
|
|
2
2
|
import { AppEntity } from './app.entity';
|
|
3
3
|
export declare abstract class AppValidator<E extends AppEntity> {
|
|
4
|
-
abstract toEntity(...variadic: unknown[]): E;
|
|
4
|
+
abstract toEntity?(...variadic: unknown[]): E;
|
|
5
5
|
}
|
|
6
6
|
export declare type SearchQuery = Omit<SearchRequest, 'index' | 'routing'>;
|
|
@@ -1,15 +1,21 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.LoginValidator = void 0;
|
|
4
10
|
const class_validator_1 = require("class-validator");
|
|
5
11
|
class LoginValidator {
|
|
12
|
+
username;
|
|
13
|
+
password;
|
|
6
14
|
}
|
|
7
15
|
__decorate([
|
|
8
|
-
(0, class_validator_1.IsEmail)()
|
|
9
|
-
__metadata("design:type", String)
|
|
16
|
+
(0, class_validator_1.IsEmail)()
|
|
10
17
|
], LoginValidator.prototype, "username", void 0);
|
|
11
18
|
__decorate([
|
|
12
|
-
(0, class_validator_1.IsNotEmpty)()
|
|
13
|
-
__metadata("design:type", String)
|
|
19
|
+
(0, class_validator_1.IsNotEmpty)()
|
|
14
20
|
], LoginValidator.prototype, "password", void 0);
|
|
15
21
|
exports.LoginValidator = LoginValidator;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.BrandDocument = void 0;
|
|
4
10
|
const es_mapping_ts_1 = require("es-mapping-ts");
|
|
5
11
|
const app_document_1 = require("../../../config/app.document");
|
|
6
12
|
let BrandDocument = class BrandDocument extends app_document_1.AppDocument {
|
|
13
|
+
name;
|
|
14
|
+
description;
|
|
7
15
|
transform(entity) {
|
|
8
16
|
this.name = entity.name;
|
|
9
17
|
this.description = entity.description;
|
|
@@ -11,12 +19,10 @@ let BrandDocument = class BrandDocument extends app_document_1.AppDocument {
|
|
|
11
19
|
}
|
|
12
20
|
};
|
|
13
21
|
__decorate([
|
|
14
|
-
(0, es_mapping_ts_1.EsField)({ type: 'keyword' })
|
|
15
|
-
__metadata("design:type", String)
|
|
22
|
+
(0, es_mapping_ts_1.EsField)({ type: 'keyword' })
|
|
16
23
|
], BrandDocument.prototype, "name", void 0);
|
|
17
24
|
__decorate([
|
|
18
|
-
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
19
|
-
__metadata("design:type", String)
|
|
25
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
20
26
|
], BrandDocument.prototype, "description", void 0);
|
|
21
27
|
BrandDocument = __decorate([
|
|
22
28
|
(0, es_mapping_ts_1.EsEntity)({ mixins: [app_document_1.AppDocument] })
|
|
@@ -1,22 +1,28 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.BrandEntity = void 0;
|
|
4
10
|
const typeorm_1 = require("typeorm");
|
|
5
11
|
const app_entity_1 = require("../../../config/app.entity");
|
|
6
12
|
const product_entity_1 = require("../products/product.entity");
|
|
7
13
|
let BrandEntity = class BrandEntity extends app_entity_1.AppEntity {
|
|
14
|
+
name;
|
|
15
|
+
description;
|
|
16
|
+
products;
|
|
8
17
|
};
|
|
9
18
|
__decorate([
|
|
10
|
-
(0, typeorm_1.Column)({ length: 32, unique: true })
|
|
11
|
-
__metadata("design:type", String)
|
|
19
|
+
(0, typeorm_1.Column)({ length: 32, unique: true })
|
|
12
20
|
], BrandEntity.prototype, "name", void 0);
|
|
13
21
|
__decorate([
|
|
14
|
-
(0, typeorm_1.Column)({ type: 'text', nullable: true })
|
|
15
|
-
__metadata("design:type", String)
|
|
22
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true })
|
|
16
23
|
], BrandEntity.prototype, "description", void 0);
|
|
17
24
|
__decorate([
|
|
18
|
-
(0, typeorm_1.OneToMany)(() => product_entity_1.ProductEntity, ({ brand }) => brand)
|
|
19
|
-
__metadata("design:type", Array)
|
|
25
|
+
(0, typeorm_1.OneToMany)(() => product_entity_1.ProductEntity, ({ brand }) => brand)
|
|
20
26
|
], BrandEntity.prototype, "products", void 0);
|
|
21
27
|
BrandEntity = __decorate([
|
|
22
28
|
(0, typeorm_1.Entity)('inventory_brands')
|
|
@@ -3,7 +3,7 @@ import { BrandEntity } from './brand.entity';
|
|
|
3
3
|
export declare class CreateBrandValidator extends AppValidator<BrandEntity> {
|
|
4
4
|
name: string;
|
|
5
5
|
description?: string;
|
|
6
|
-
toEntity(): BrandEntity;
|
|
6
|
+
toEntity?(): BrandEntity;
|
|
7
7
|
}
|
|
8
8
|
export declare class UpdateBrandValidator extends AppValidator<BrandEntity> {
|
|
9
9
|
name?: string;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.UpdateBrandValidator = exports.CreateBrandValidator = void 0;
|
|
4
10
|
const class_validator_1 = require("class-validator");
|
|
5
11
|
const app_validator_1 = require("../../../config/app.validator");
|
|
6
12
|
const brand_entity_1 = require("./brand.entity");
|
|
7
13
|
class CreateBrandValidator extends app_validator_1.AppValidator {
|
|
14
|
+
name;
|
|
15
|
+
description;
|
|
8
16
|
toEntity() {
|
|
9
17
|
const entity = new brand_entity_1.BrandEntity();
|
|
10
18
|
entity.name = this.name;
|
|
@@ -14,16 +22,16 @@ class CreateBrandValidator extends app_validator_1.AppValidator {
|
|
|
14
22
|
}
|
|
15
23
|
__decorate([
|
|
16
24
|
(0, class_validator_1.IsString)(),
|
|
17
|
-
(0, class_validator_1.Length)(2, 32)
|
|
18
|
-
__metadata("design:type", String)
|
|
25
|
+
(0, class_validator_1.Length)(2, 32)
|
|
19
26
|
], CreateBrandValidator.prototype, "name", void 0);
|
|
20
27
|
__decorate([
|
|
21
28
|
(0, class_validator_1.IsString)(),
|
|
22
|
-
(0, class_validator_1.IsOptional)()
|
|
23
|
-
__metadata("design:type", String)
|
|
29
|
+
(0, class_validator_1.IsOptional)()
|
|
24
30
|
], CreateBrandValidator.prototype, "description", void 0);
|
|
25
31
|
exports.CreateBrandValidator = CreateBrandValidator;
|
|
26
32
|
class UpdateBrandValidator extends app_validator_1.AppValidator {
|
|
33
|
+
name;
|
|
34
|
+
description;
|
|
27
35
|
toEntity(entity) {
|
|
28
36
|
if (this.name) {
|
|
29
37
|
entity.name = this.name;
|
|
@@ -36,12 +44,10 @@ class UpdateBrandValidator extends app_validator_1.AppValidator {
|
|
|
36
44
|
}
|
|
37
45
|
__decorate([
|
|
38
46
|
(0, class_validator_1.IsString)(),
|
|
39
|
-
(0, class_validator_1.IsOptional)()
|
|
40
|
-
__metadata("design:type", String)
|
|
47
|
+
(0, class_validator_1.IsOptional)()
|
|
41
48
|
], UpdateBrandValidator.prototype, "name", void 0);
|
|
42
49
|
__decorate([
|
|
43
50
|
(0, class_validator_1.IsString)(),
|
|
44
|
-
(0, class_validator_1.IsOptional)()
|
|
45
|
-
__metadata("design:type", String)
|
|
51
|
+
(0, class_validator_1.IsOptional)()
|
|
46
52
|
], UpdateBrandValidator.prototype, "description", void 0);
|
|
47
53
|
exports.UpdateBrandValidator = UpdateBrandValidator;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.CategoryDocument = void 0;
|
|
4
10
|
const es_mapping_ts_1 = require("es-mapping-ts");
|
|
5
11
|
const app_document_1 = require("../../../config/app.document");
|
|
6
12
|
let CategoryDocument = class CategoryDocument extends app_document_1.AppDocument {
|
|
13
|
+
name;
|
|
14
|
+
description;
|
|
7
15
|
transform(entity) {
|
|
8
16
|
this.name = entity.name;
|
|
9
17
|
this.description = entity.description;
|
|
@@ -11,12 +19,10 @@ let CategoryDocument = class CategoryDocument extends app_document_1.AppDocument
|
|
|
11
19
|
}
|
|
12
20
|
};
|
|
13
21
|
__decorate([
|
|
14
|
-
(0, es_mapping_ts_1.EsField)({ type: 'keyword' })
|
|
15
|
-
__metadata("design:type", String)
|
|
22
|
+
(0, es_mapping_ts_1.EsField)({ type: 'keyword' })
|
|
16
23
|
], CategoryDocument.prototype, "name", void 0);
|
|
17
24
|
__decorate([
|
|
18
|
-
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
19
|
-
__metadata("design:type", String)
|
|
25
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
20
26
|
], CategoryDocument.prototype, "description", void 0);
|
|
21
27
|
CategoryDocument = __decorate([
|
|
22
28
|
(0, es_mapping_ts_1.EsEntity)({ mixins: [app_document_1.AppDocument] })
|
|
@@ -1,22 +1,28 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.CategoryEntity = void 0;
|
|
4
10
|
const typeorm_1 = require("typeorm");
|
|
5
11
|
const app_entity_1 = require("../../../config/app.entity");
|
|
6
12
|
const product_entity_1 = require("../products/product.entity");
|
|
7
13
|
let CategoryEntity = class CategoryEntity extends app_entity_1.AppEntity {
|
|
14
|
+
name;
|
|
15
|
+
description;
|
|
16
|
+
products;
|
|
8
17
|
};
|
|
9
18
|
__decorate([
|
|
10
|
-
(0, typeorm_1.Column)({ length: 32, unique: true })
|
|
11
|
-
__metadata("design:type", String)
|
|
19
|
+
(0, typeorm_1.Column)({ length: 32, unique: true })
|
|
12
20
|
], CategoryEntity.prototype, "name", void 0);
|
|
13
21
|
__decorate([
|
|
14
|
-
(0, typeorm_1.Column)({ type: 'text', nullable: true })
|
|
15
|
-
__metadata("design:type", String)
|
|
22
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true })
|
|
16
23
|
], CategoryEntity.prototype, "description", void 0);
|
|
17
24
|
__decorate([
|
|
18
|
-
(0, typeorm_1.OneToMany)(() => product_entity_1.ProductEntity, ({ category }) => category)
|
|
19
|
-
__metadata("design:type", Array)
|
|
25
|
+
(0, typeorm_1.OneToMany)(() => product_entity_1.ProductEntity, ({ category }) => category)
|
|
20
26
|
], CategoryEntity.prototype, "products", void 0);
|
|
21
27
|
CategoryEntity = __decorate([
|
|
22
28
|
(0, typeorm_1.Entity)('inventory_categories')
|
|
@@ -5,7 +5,7 @@ export declare class FindCategoryValidator {
|
|
|
5
5
|
export declare class CreateCategoryValidator extends AppValidator<CategoryEntity> {
|
|
6
6
|
name: string;
|
|
7
7
|
description?: string;
|
|
8
|
-
toEntity(): CategoryEntity;
|
|
8
|
+
toEntity?(): CategoryEntity;
|
|
9
9
|
}
|
|
10
10
|
export declare class UpdateCategoryValidator extends AppValidator<CategoryEntity> {
|
|
11
11
|
name: string;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.UpdateCategoryValidator = exports.CreateCategoryValidator = exports.FindCategoryValidator = void 0;
|
|
4
10
|
const class_validator_1 = require("class-validator");
|
|
@@ -8,6 +14,8 @@ class FindCategoryValidator {
|
|
|
8
14
|
}
|
|
9
15
|
exports.FindCategoryValidator = FindCategoryValidator;
|
|
10
16
|
class CreateCategoryValidator extends app_validator_1.AppValidator {
|
|
17
|
+
name;
|
|
18
|
+
description;
|
|
11
19
|
toEntity() {
|
|
12
20
|
const entity = new category_entity_1.CategoryEntity();
|
|
13
21
|
entity.name = this.name;
|
|
@@ -17,16 +25,16 @@ class CreateCategoryValidator extends app_validator_1.AppValidator {
|
|
|
17
25
|
}
|
|
18
26
|
__decorate([
|
|
19
27
|
(0, class_validator_1.IsString)(),
|
|
20
|
-
(0, class_validator_1.Length)(5, 32)
|
|
21
|
-
__metadata("design:type", String)
|
|
28
|
+
(0, class_validator_1.Length)(5, 32)
|
|
22
29
|
], CreateCategoryValidator.prototype, "name", void 0);
|
|
23
30
|
__decorate([
|
|
24
31
|
(0, class_validator_1.IsString)(),
|
|
25
|
-
(0, class_validator_1.IsOptional)()
|
|
26
|
-
__metadata("design:type", String)
|
|
32
|
+
(0, class_validator_1.IsOptional)()
|
|
27
33
|
], CreateCategoryValidator.prototype, "description", void 0);
|
|
28
34
|
exports.CreateCategoryValidator = CreateCategoryValidator;
|
|
29
35
|
class UpdateCategoryValidator extends app_validator_1.AppValidator {
|
|
36
|
+
name;
|
|
37
|
+
description;
|
|
30
38
|
toEntity(entity) {
|
|
31
39
|
if (this.name) {
|
|
32
40
|
entity.name = this.name;
|
|
@@ -39,12 +47,10 @@ class UpdateCategoryValidator extends app_validator_1.AppValidator {
|
|
|
39
47
|
}
|
|
40
48
|
__decorate([
|
|
41
49
|
(0, class_validator_1.IsString)(),
|
|
42
|
-
(0, class_validator_1.IsOptional)()
|
|
43
|
-
__metadata("design:type", String)
|
|
50
|
+
(0, class_validator_1.IsOptional)()
|
|
44
51
|
], UpdateCategoryValidator.prototype, "name", void 0);
|
|
45
52
|
__decorate([
|
|
46
53
|
(0, class_validator_1.IsString)(),
|
|
47
|
-
(0, class_validator_1.IsOptional)()
|
|
48
|
-
__metadata("design:type", String)
|
|
54
|
+
(0, class_validator_1.IsOptional)()
|
|
49
55
|
], UpdateCategoryValidator.prototype, "description", void 0);
|
|
50
56
|
exports.UpdateCategoryValidator = UpdateCategoryValidator;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.MediaDocument = void 0;
|
|
4
10
|
const es_mapping_ts_1 = require("es-mapping-ts");
|
|
5
11
|
const app_document_1 = require("../../../config/app.document");
|
|
6
12
|
let MediaDocument = class MediaDocument extends app_document_1.AppDocument {
|
|
13
|
+
name;
|
|
14
|
+
url;
|
|
7
15
|
transform(entity) {
|
|
8
16
|
this.name = entity.name;
|
|
9
17
|
this.url = entity.url;
|
|
@@ -11,12 +19,10 @@ let MediaDocument = class MediaDocument extends app_document_1.AppDocument {
|
|
|
11
19
|
}
|
|
12
20
|
};
|
|
13
21
|
__decorate([
|
|
14
|
-
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
15
|
-
__metadata("design:type", String)
|
|
22
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
16
23
|
], MediaDocument.prototype, "name", void 0);
|
|
17
24
|
__decorate([
|
|
18
|
-
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
19
|
-
__metadata("design:type", String)
|
|
25
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
20
26
|
], MediaDocument.prototype, "url", void 0);
|
|
21
27
|
MediaDocument = __decorate([
|
|
22
28
|
(0, es_mapping_ts_1.EsEntity)({ mixins: [app_document_1.AppDocument] })
|
|
@@ -1,22 +1,28 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.MediaEntity = void 0;
|
|
4
10
|
const typeorm_1 = require("typeorm");
|
|
5
11
|
const app_entity_1 = require("../../../config/app.entity");
|
|
6
12
|
const product_entity_1 = require("../products/product.entity");
|
|
7
13
|
let MediaEntity = class MediaEntity extends app_entity_1.AppEntity {
|
|
14
|
+
name;
|
|
15
|
+
url;
|
|
16
|
+
product;
|
|
8
17
|
};
|
|
9
18
|
__decorate([
|
|
10
|
-
(0, typeorm_1.Column)({ length: 64 })
|
|
11
|
-
__metadata("design:type", String)
|
|
19
|
+
(0, typeorm_1.Column)({ length: 64 })
|
|
12
20
|
], MediaEntity.prototype, "name", void 0);
|
|
13
21
|
__decorate([
|
|
14
|
-
(0, typeorm_1.Column)({ length: 2048 })
|
|
15
|
-
__metadata("design:type", String)
|
|
22
|
+
(0, typeorm_1.Column)({ length: 2048 })
|
|
16
23
|
], MediaEntity.prototype, "url", void 0);
|
|
17
24
|
__decorate([
|
|
18
|
-
(0, typeorm_1.ManyToOne)(() => product_entity_1.ProductEntity, ({ media }) => media)
|
|
19
|
-
__metadata("design:type", product_entity_1.ProductEntity)
|
|
25
|
+
(0, typeorm_1.ManyToOne)(() => product_entity_1.ProductEntity, ({ media }) => media)
|
|
20
26
|
], MediaEntity.prototype, "product", void 0);
|
|
21
27
|
MediaEntity = __decorate([
|
|
22
28
|
(0, typeorm_1.Entity)('inventory_media')
|
|
@@ -2,7 +2,7 @@ import { AppValidator } from '../../../config/app.validator';
|
|
|
2
2
|
import { MediaEntity } from './media.entity';
|
|
3
3
|
export declare class CreateMediaValidator extends AppValidator<MediaEntity> {
|
|
4
4
|
name: string;
|
|
5
|
-
toEntity(): MediaEntity;
|
|
5
|
+
toEntity?(): MediaEntity;
|
|
6
6
|
}
|
|
7
7
|
export declare class UpdateMediaValidator extends AppValidator<MediaEntity> {
|
|
8
8
|
name: string;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.UpdateMediaValidator = exports.CreateMediaValidator = void 0;
|
|
4
10
|
const class_validator_1 = require("class-validator");
|
|
5
11
|
const app_validator_1 = require("../../../config/app.validator");
|
|
6
12
|
const media_entity_1 = require("./media.entity");
|
|
7
13
|
class CreateMediaValidator extends app_validator_1.AppValidator {
|
|
14
|
+
name;
|
|
8
15
|
toEntity() {
|
|
9
16
|
const entity = new media_entity_1.MediaEntity();
|
|
10
17
|
entity.name = this.name;
|
|
@@ -12,11 +19,11 @@ class CreateMediaValidator extends app_validator_1.AppValidator {
|
|
|
12
19
|
}
|
|
13
20
|
}
|
|
14
21
|
__decorate([
|
|
15
|
-
(0, class_validator_1.IsString)()
|
|
16
|
-
__metadata("design:type", String)
|
|
22
|
+
(0, class_validator_1.IsString)()
|
|
17
23
|
], CreateMediaValidator.prototype, "name", void 0);
|
|
18
24
|
exports.CreateMediaValidator = CreateMediaValidator;
|
|
19
25
|
class UpdateMediaValidator extends app_validator_1.AppValidator {
|
|
26
|
+
name;
|
|
20
27
|
toEntity(entity) {
|
|
21
28
|
if (this.name) {
|
|
22
29
|
entity.name = this.name;
|
|
@@ -26,7 +33,6 @@ class UpdateMediaValidator extends app_validator_1.AppValidator {
|
|
|
26
33
|
}
|
|
27
34
|
__decorate([
|
|
28
35
|
(0, class_validator_1.IsString)(),
|
|
29
|
-
(0, class_validator_1.IsOptional)()
|
|
30
|
-
__metadata("design:type", String)
|
|
36
|
+
(0, class_validator_1.IsOptional)()
|
|
31
37
|
], UpdateMediaValidator.prototype, "name", void 0);
|
|
32
38
|
exports.UpdateMediaValidator = UpdateMediaValidator;
|
|
@@ -1,9 +1,22 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.ProductDocument = void 0;
|
|
4
10
|
const es_mapping_ts_1 = require("es-mapping-ts");
|
|
5
11
|
const app_document_1 = require("../../../config/app.document");
|
|
6
12
|
let ProductDocument = class ProductDocument extends app_document_1.AppDocument {
|
|
13
|
+
name;
|
|
14
|
+
description;
|
|
15
|
+
availableFrom;
|
|
16
|
+
hashtags;
|
|
17
|
+
active;
|
|
18
|
+
category;
|
|
19
|
+
brand;
|
|
7
20
|
transform(entity) {
|
|
8
21
|
this.name = entity.name;
|
|
9
22
|
this.description = entity.description;
|
|
@@ -15,32 +28,25 @@ let ProductDocument = class ProductDocument extends app_document_1.AppDocument {
|
|
|
15
28
|
}
|
|
16
29
|
};
|
|
17
30
|
__decorate([
|
|
18
|
-
(0, es_mapping_ts_1.EsField)({ type: 'keyword' })
|
|
19
|
-
__metadata("design:type", String)
|
|
31
|
+
(0, es_mapping_ts_1.EsField)({ type: 'keyword' })
|
|
20
32
|
], ProductDocument.prototype, "name", void 0);
|
|
21
33
|
__decorate([
|
|
22
|
-
(0, es_mapping_ts_1.EsField)({ type: 'keyword' })
|
|
23
|
-
__metadata("design:type", String)
|
|
34
|
+
(0, es_mapping_ts_1.EsField)({ type: 'keyword' })
|
|
24
35
|
], ProductDocument.prototype, "description", void 0);
|
|
25
36
|
__decorate([
|
|
26
|
-
(0, es_mapping_ts_1.EsField)({ type: 'date' })
|
|
27
|
-
__metadata("design:type", Date)
|
|
37
|
+
(0, es_mapping_ts_1.EsField)({ type: 'date' })
|
|
28
38
|
], ProductDocument.prototype, "availableFrom", void 0);
|
|
29
39
|
__decorate([
|
|
30
|
-
(0, es_mapping_ts_1.EsField)({ type: 'nested' })
|
|
31
|
-
__metadata("design:type", Array)
|
|
40
|
+
(0, es_mapping_ts_1.EsField)({ type: 'nested' })
|
|
32
41
|
], ProductDocument.prototype, "hashtags", void 0);
|
|
33
42
|
__decorate([
|
|
34
|
-
(0, es_mapping_ts_1.EsField)({ type: 'boolean' })
|
|
35
|
-
__metadata("design:type", Boolean)
|
|
43
|
+
(0, es_mapping_ts_1.EsField)({ type: 'boolean' })
|
|
36
44
|
], ProductDocument.prototype, "active", void 0);
|
|
37
45
|
__decorate([
|
|
38
|
-
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
39
|
-
__metadata("design:type", String)
|
|
46
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
40
47
|
], ProductDocument.prototype, "category", void 0);
|
|
41
48
|
__decorate([
|
|
42
|
-
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
43
|
-
__metadata("design:type", String)
|
|
49
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
44
50
|
], ProductDocument.prototype, "brand", void 0);
|
|
45
51
|
ProductDocument = __decorate([
|
|
46
52
|
(0, es_mapping_ts_1.EsEntity)({ mixins: [app_document_1.AppDocument] })
|
|
@@ -1,4 +1,10 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.ProductEntity = void 0;
|
|
4
10
|
const typeorm_1 = require("typeorm");
|
|
@@ -8,12 +14,16 @@ const category_entity_1 = require("../categories/category.entity");
|
|
|
8
14
|
const media_entity_1 = require("../media/media.entity");
|
|
9
15
|
const variant_entity_1 = require("../variants/variant.entity");
|
|
10
16
|
let ProductEntity = class ProductEntity extends app_entity_1.AppEntity {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
name;
|
|
18
|
+
description;
|
|
19
|
+
active = true;
|
|
20
|
+
availableFrom = new Date();
|
|
21
|
+
hashtags = [];
|
|
22
|
+
category;
|
|
23
|
+
brand;
|
|
24
|
+
variant;
|
|
25
|
+
variants;
|
|
26
|
+
media;
|
|
17
27
|
get isOutOfStock() {
|
|
18
28
|
return this.variants.every(variant => variant.isOutOfStock);
|
|
19
29
|
}
|
|
@@ -22,44 +32,34 @@ let ProductEntity = class ProductEntity extends app_entity_1.AppEntity {
|
|
|
22
32
|
}
|
|
23
33
|
};
|
|
24
34
|
__decorate([
|
|
25
|
-
(0, typeorm_1.Column)({ length: 64 })
|
|
26
|
-
__metadata("design:type", String)
|
|
35
|
+
(0, typeorm_1.Column)({ length: 64 })
|
|
27
36
|
], ProductEntity.prototype, "name", void 0);
|
|
28
37
|
__decorate([
|
|
29
|
-
(0, typeorm_1.Column)({ type: 'text', nullable: true })
|
|
30
|
-
__metadata("design:type", String)
|
|
38
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true })
|
|
31
39
|
], ProductEntity.prototype, "description", void 0);
|
|
32
40
|
__decorate([
|
|
33
|
-
(0, typeorm_1.Column)({ type: 'boolean', default: true })
|
|
34
|
-
__metadata("design:type", Object)
|
|
41
|
+
(0, typeorm_1.Column)({ type: 'boolean', default: true })
|
|
35
42
|
], ProductEntity.prototype, "active", void 0);
|
|
36
43
|
__decorate([
|
|
37
|
-
(0, typeorm_1.Column)({ type: 'datetime', nullable: true })
|
|
38
|
-
__metadata("design:type", Object)
|
|
44
|
+
(0, typeorm_1.Column)({ type: 'datetime', nullable: true })
|
|
39
45
|
], ProductEntity.prototype, "availableFrom", void 0);
|
|
40
46
|
__decorate([
|
|
41
|
-
(0, typeorm_1.Column)({ type: 'simple-array', nullable: true })
|
|
42
|
-
__metadata("design:type", Array)
|
|
47
|
+
(0, typeorm_1.Column)({ type: 'simple-array', nullable: true })
|
|
43
48
|
], ProductEntity.prototype, "hashtags", void 0);
|
|
44
49
|
__decorate([
|
|
45
|
-
(0, typeorm_1.ManyToOne)(() => category_entity_1.CategoryEntity, ({ products }) => products)
|
|
46
|
-
__metadata("design:type", category_entity_1.CategoryEntity)
|
|
50
|
+
(0, typeorm_1.ManyToOne)(() => category_entity_1.CategoryEntity, ({ products }) => products)
|
|
47
51
|
], ProductEntity.prototype, "category", void 0);
|
|
48
52
|
__decorate([
|
|
49
|
-
(0, typeorm_1.ManyToOne)(() => brand_entity_1.BrandEntity, ({ products }) => products)
|
|
50
|
-
__metadata("design:type", brand_entity_1.BrandEntity)
|
|
53
|
+
(0, typeorm_1.ManyToOne)(() => brand_entity_1.BrandEntity, ({ products }) => products)
|
|
51
54
|
], ProductEntity.prototype, "brand", void 0);
|
|
52
55
|
__decorate([
|
|
53
|
-
(0, typeorm_1.ManyToOne)(() => variant_entity_1.VariantEntity, ({ product }) => product)
|
|
54
|
-
__metadata("design:type", variant_entity_1.VariantEntity)
|
|
56
|
+
(0, typeorm_1.ManyToOne)(() => variant_entity_1.VariantEntity, ({ product }) => product)
|
|
55
57
|
], ProductEntity.prototype, "variant", void 0);
|
|
56
58
|
__decorate([
|
|
57
|
-
(0, typeorm_1.OneToMany)(() => variant_entity_1.VariantEntity, ({ product }) => product)
|
|
58
|
-
__metadata("design:type", Array)
|
|
59
|
+
(0, typeorm_1.OneToMany)(() => variant_entity_1.VariantEntity, ({ product }) => product)
|
|
59
60
|
], ProductEntity.prototype, "variants", void 0);
|
|
60
61
|
__decorate([
|
|
61
|
-
(0, typeorm_1.OneToMany)(() => media_entity_1.MediaEntity, ({ product }) => product)
|
|
62
|
-
__metadata("design:type", Array)
|
|
62
|
+
(0, typeorm_1.OneToMany)(() => media_entity_1.MediaEntity, ({ product }) => product)
|
|
63
63
|
], ProductEntity.prototype, "media", void 0);
|
|
64
64
|
ProductEntity = __decorate([
|
|
65
65
|
(0, typeorm_1.Entity)('inventory_products')
|
|
@@ -11,7 +11,7 @@ export declare class CreateProductValidator extends AppValidator<ProductEntity>
|
|
|
11
11
|
brand?: Id;
|
|
12
12
|
hashtags: string[];
|
|
13
13
|
variants?: CreateVariantValidator[];
|
|
14
|
-
toEntity(): ProductEntity;
|
|
14
|
+
toEntity?(): ProductEntity;
|
|
15
15
|
}
|
|
16
16
|
export declare class UpdateProductValidator extends AppValidator<ProductEntity> {
|
|
17
17
|
name?: string;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.UpdateProductValidator = exports.CreateProductValidator = void 0;
|
|
4
10
|
const class_transformer_1 = require("class-transformer");
|
|
@@ -9,12 +15,14 @@ const category_entity_1 = require("../categories/category.entity");
|
|
|
9
15
|
const variant_validator_1 = require("../variants/variant.validator");
|
|
10
16
|
const product_entity_1 = require("./product.entity");
|
|
11
17
|
class CreateProductValidator extends app_validator_1.AppValidator {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
name;
|
|
19
|
+
description;
|
|
20
|
+
availableFrom;
|
|
21
|
+
active = true;
|
|
22
|
+
category;
|
|
23
|
+
brand;
|
|
24
|
+
hashtags = [];
|
|
25
|
+
variants = [];
|
|
18
26
|
toEntity() {
|
|
19
27
|
const entity = new product_entity_1.ProductEntity();
|
|
20
28
|
entity.name = this.name;
|
|
@@ -28,47 +36,45 @@ class CreateProductValidator extends app_validator_1.AppValidator {
|
|
|
28
36
|
}
|
|
29
37
|
}
|
|
30
38
|
__decorate([
|
|
31
|
-
(0, class_validator_1.IsString)()
|
|
32
|
-
__metadata("design:type", String)
|
|
39
|
+
(0, class_validator_1.IsString)()
|
|
33
40
|
], CreateProductValidator.prototype, "name", void 0);
|
|
34
41
|
__decorate([
|
|
35
42
|
(0, class_validator_1.IsString)(),
|
|
36
|
-
(0, class_validator_1.IsOptional)()
|
|
37
|
-
__metadata("design:type", String)
|
|
43
|
+
(0, class_validator_1.IsOptional)()
|
|
38
44
|
], CreateProductValidator.prototype, "description", void 0);
|
|
39
45
|
__decorate([
|
|
40
46
|
(0, class_validator_1.IsDateString)(),
|
|
41
|
-
(0, class_validator_1.IsOptional)()
|
|
42
|
-
__metadata("design:type", Date)
|
|
47
|
+
(0, class_validator_1.IsOptional)()
|
|
43
48
|
], CreateProductValidator.prototype, "availableFrom", void 0);
|
|
44
49
|
__decorate([
|
|
45
50
|
(0, class_validator_1.IsBoolean)(),
|
|
46
|
-
(0, class_validator_1.IsOptional)()
|
|
47
|
-
__metadata("design:type", Object)
|
|
51
|
+
(0, class_validator_1.IsOptional)()
|
|
48
52
|
], CreateProductValidator.prototype, "active", void 0);
|
|
49
53
|
__decorate([
|
|
50
54
|
(0, class_validator_1.IsOptional)(),
|
|
51
|
-
(0, class_validator_1.IsUUID)()
|
|
52
|
-
__metadata("design:type", String)
|
|
55
|
+
(0, class_validator_1.IsUUID)()
|
|
53
56
|
], CreateProductValidator.prototype, "category", void 0);
|
|
54
57
|
__decorate([
|
|
55
58
|
(0, class_validator_1.IsOptional)(),
|
|
56
|
-
(0, class_validator_1.IsUUID)()
|
|
57
|
-
__metadata("design:type", String)
|
|
59
|
+
(0, class_validator_1.IsUUID)()
|
|
58
60
|
], CreateProductValidator.prototype, "brand", void 0);
|
|
59
61
|
__decorate([
|
|
60
62
|
(0, class_validator_1.IsOptional)(),
|
|
61
|
-
(0, class_validator_1.IsString)({ each: true })
|
|
62
|
-
__metadata("design:type", Array)
|
|
63
|
+
(0, class_validator_1.IsString)({ each: true })
|
|
63
64
|
], CreateProductValidator.prototype, "hashtags", void 0);
|
|
64
65
|
__decorate([
|
|
65
66
|
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
66
67
|
(0, class_transformer_1.Type)(() => variant_validator_1.CreateVariantValidator),
|
|
67
|
-
(0, class_validator_1.IsOptional)()
|
|
68
|
-
__metadata("design:type", Array)
|
|
68
|
+
(0, class_validator_1.IsOptional)()
|
|
69
69
|
], CreateProductValidator.prototype, "variants", void 0);
|
|
70
70
|
exports.CreateProductValidator = CreateProductValidator;
|
|
71
71
|
class UpdateProductValidator extends app_validator_1.AppValidator {
|
|
72
|
+
name;
|
|
73
|
+
description;
|
|
74
|
+
category;
|
|
75
|
+
brand;
|
|
76
|
+
hashtags;
|
|
77
|
+
active;
|
|
72
78
|
toEntity(entity) {
|
|
73
79
|
if (this.brand) {
|
|
74
80
|
entity.brand = new brand_entity_1.BrandEntity(this.brand);
|
|
@@ -93,32 +99,26 @@ class UpdateProductValidator extends app_validator_1.AppValidator {
|
|
|
93
99
|
}
|
|
94
100
|
__decorate([
|
|
95
101
|
(0, class_validator_1.IsString)(),
|
|
96
|
-
(0, class_validator_1.IsOptional)()
|
|
97
|
-
__metadata("design:type", String)
|
|
102
|
+
(0, class_validator_1.IsOptional)()
|
|
98
103
|
], UpdateProductValidator.prototype, "name", void 0);
|
|
99
104
|
__decorate([
|
|
100
105
|
(0, class_validator_1.IsString)(),
|
|
101
|
-
(0, class_validator_1.IsOptional)()
|
|
102
|
-
__metadata("design:type", String)
|
|
106
|
+
(0, class_validator_1.IsOptional)()
|
|
103
107
|
], UpdateProductValidator.prototype, "description", void 0);
|
|
104
108
|
__decorate([
|
|
105
109
|
(0, class_validator_1.IsOptional)(),
|
|
106
|
-
(0, class_validator_1.IsPositive)()
|
|
107
|
-
__metadata("design:type", String)
|
|
110
|
+
(0, class_validator_1.IsPositive)()
|
|
108
111
|
], UpdateProductValidator.prototype, "category", void 0);
|
|
109
112
|
__decorate([
|
|
110
113
|
(0, class_validator_1.IsOptional)(),
|
|
111
|
-
(0, class_validator_1.IsPositive)()
|
|
112
|
-
__metadata("design:type", String)
|
|
114
|
+
(0, class_validator_1.IsPositive)()
|
|
113
115
|
], UpdateProductValidator.prototype, "brand", void 0);
|
|
114
116
|
__decorate([
|
|
115
117
|
(0, class_validator_1.IsOptional)(),
|
|
116
|
-
(0, class_validator_1.IsString)({ each: true })
|
|
117
|
-
__metadata("design:type", Array)
|
|
118
|
+
(0, class_validator_1.IsString)({ each: true })
|
|
118
119
|
], UpdateProductValidator.prototype, "hashtags", void 0);
|
|
119
120
|
__decorate([
|
|
120
121
|
(0, class_validator_1.IsBoolean)(),
|
|
121
|
-
(0, class_validator_1.IsOptional)()
|
|
122
|
-
__metadata("design:type", Boolean)
|
|
122
|
+
(0, class_validator_1.IsOptional)()
|
|
123
123
|
], UpdateProductValidator.prototype, "active", void 0);
|
|
124
124
|
exports.UpdateProductValidator = UpdateProductValidator;
|
|
@@ -1,9 +1,19 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.VariantDocument = void 0;
|
|
4
10
|
const es_mapping_ts_1 = require("es-mapping-ts");
|
|
5
11
|
const app_document_1 = require("../../../config/app.document");
|
|
6
12
|
let VariantDocument = class VariantDocument extends app_document_1.AppDocument {
|
|
13
|
+
sku;
|
|
14
|
+
quantity;
|
|
15
|
+
price;
|
|
16
|
+
active;
|
|
7
17
|
transform(entity) {
|
|
8
18
|
this.sku = entity.sku;
|
|
9
19
|
this.quantity = entity.quantity;
|
|
@@ -13,20 +23,16 @@ let VariantDocument = class VariantDocument extends app_document_1.AppDocument {
|
|
|
13
23
|
}
|
|
14
24
|
};
|
|
15
25
|
__decorate([
|
|
16
|
-
(0, es_mapping_ts_1.EsField)({ type: 'keyword' })
|
|
17
|
-
__metadata("design:type", String)
|
|
26
|
+
(0, es_mapping_ts_1.EsField)({ type: 'keyword' })
|
|
18
27
|
], VariantDocument.prototype, "sku", void 0);
|
|
19
28
|
__decorate([
|
|
20
|
-
(0, es_mapping_ts_1.EsField)({ type: 'float' })
|
|
21
|
-
__metadata("design:type", Number)
|
|
29
|
+
(0, es_mapping_ts_1.EsField)({ type: 'float' })
|
|
22
30
|
], VariantDocument.prototype, "quantity", void 0);
|
|
23
31
|
__decorate([
|
|
24
|
-
(0, es_mapping_ts_1.EsField)({ type: 'integer' })
|
|
25
|
-
__metadata("design:type", Number)
|
|
32
|
+
(0, es_mapping_ts_1.EsField)({ type: 'integer' })
|
|
26
33
|
], VariantDocument.prototype, "price", void 0);
|
|
27
34
|
__decorate([
|
|
28
|
-
(0, es_mapping_ts_1.EsField)({ type: 'boolean' })
|
|
29
|
-
__metadata("design:type", Boolean)
|
|
35
|
+
(0, es_mapping_ts_1.EsField)({ type: 'boolean' })
|
|
30
36
|
], VariantDocument.prototype, "active", void 0);
|
|
31
37
|
VariantDocument = __decorate([
|
|
32
38
|
(0, es_mapping_ts_1.EsEntity)({ mixins: [app_document_1.AppDocument] })
|
|
@@ -1,16 +1,21 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.VariantEntity = void 0;
|
|
4
10
|
const typeorm_1 = require("typeorm");
|
|
5
11
|
const app_entity_1 = require("../../../config/app.entity");
|
|
6
12
|
const product_entity_1 = require("../products/product.entity");
|
|
7
13
|
let VariantEntity = class VariantEntity extends app_entity_1.AppEntity {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
+
sku;
|
|
15
|
+
price = 0;
|
|
16
|
+
quantity = 1;
|
|
17
|
+
active = true;
|
|
18
|
+
product;
|
|
14
19
|
get isOutOfStock() {
|
|
15
20
|
return this.quantity === 0;
|
|
16
21
|
}
|
|
@@ -19,24 +24,19 @@ let VariantEntity = class VariantEntity extends app_entity_1.AppEntity {
|
|
|
19
24
|
}
|
|
20
25
|
};
|
|
21
26
|
__decorate([
|
|
22
|
-
(0, typeorm_1.Column)({ length: 32, unique: true })
|
|
23
|
-
__metadata("design:type", String)
|
|
27
|
+
(0, typeorm_1.Column)({ length: 32, unique: true })
|
|
24
28
|
], VariantEntity.prototype, "sku", void 0);
|
|
25
29
|
__decorate([
|
|
26
|
-
(0, typeorm_1.Column)({ type: 'int', default: 0 })
|
|
27
|
-
__metadata("design:type", Object)
|
|
30
|
+
(0, typeorm_1.Column)({ type: 'int', default: 0 })
|
|
28
31
|
], VariantEntity.prototype, "price", void 0);
|
|
29
32
|
__decorate([
|
|
30
|
-
(0, typeorm_1.Column)({ type: 'float', default: 1 })
|
|
31
|
-
__metadata("design:type", Object)
|
|
33
|
+
(0, typeorm_1.Column)({ type: 'float', default: 1 })
|
|
32
34
|
], VariantEntity.prototype, "quantity", void 0);
|
|
33
35
|
__decorate([
|
|
34
|
-
(0, typeorm_1.Column)({ type: 'boolean', default: true })
|
|
35
|
-
__metadata("design:type", Object)
|
|
36
|
+
(0, typeorm_1.Column)({ type: 'boolean', default: true })
|
|
36
37
|
], VariantEntity.prototype, "active", void 0);
|
|
37
38
|
__decorate([
|
|
38
|
-
(0, typeorm_1.ManyToOne)(() => product_entity_1.ProductEntity, ({ variants }) => variants)
|
|
39
|
-
__metadata("design:type", product_entity_1.ProductEntity)
|
|
39
|
+
(0, typeorm_1.ManyToOne)(() => product_entity_1.ProductEntity, ({ variants }) => variants)
|
|
40
40
|
], VariantEntity.prototype, "product", void 0);
|
|
41
41
|
VariantEntity = __decorate([
|
|
42
42
|
(0, typeorm_1.Entity)('inventory_variants')
|
|
@@ -1,16 +1,20 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.UpdateVariantValidator = exports.CreateVariantValidator = void 0;
|
|
4
10
|
const class_validator_1 = require("class-validator");
|
|
5
11
|
const app_validator_1 = require("../../../config/app.validator");
|
|
6
12
|
const variant_entity_1 = require("./variant.entity");
|
|
7
13
|
class CreateVariantValidator extends app_validator_1.AppValidator {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
this.active = true;
|
|
13
|
-
}
|
|
14
|
+
price = 0;
|
|
15
|
+
sku;
|
|
16
|
+
quantity = 1;
|
|
17
|
+
active = true;
|
|
14
18
|
toEntity(product) {
|
|
15
19
|
const entity = new variant_entity_1.VariantEntity();
|
|
16
20
|
entity.sku = this.sku;
|
|
@@ -25,30 +29,25 @@ class CreateVariantValidator extends app_validator_1.AppValidator {
|
|
|
25
29
|
}
|
|
26
30
|
__decorate([
|
|
27
31
|
(0, class_validator_1.IsNumber)(),
|
|
28
|
-
(0, class_validator_1.Min)(0)
|
|
29
|
-
__metadata("design:type", Object)
|
|
32
|
+
(0, class_validator_1.Min)(0)
|
|
30
33
|
], CreateVariantValidator.prototype, "price", void 0);
|
|
31
34
|
__decorate([
|
|
32
|
-
(0, class_validator_1.Length)(1, 32)
|
|
33
|
-
__metadata("design:type", String)
|
|
35
|
+
(0, class_validator_1.Length)(1, 32)
|
|
34
36
|
], CreateVariantValidator.prototype, "sku", void 0);
|
|
35
37
|
__decorate([
|
|
36
38
|
(0, class_validator_1.IsPositive)(),
|
|
37
|
-
(0, class_validator_1.IsOptional)()
|
|
38
|
-
__metadata("design:type", Object)
|
|
39
|
+
(0, class_validator_1.IsOptional)()
|
|
39
40
|
], CreateVariantValidator.prototype, "quantity", void 0);
|
|
40
41
|
__decorate([
|
|
41
42
|
(0, class_validator_1.IsBoolean)(),
|
|
42
|
-
(0, class_validator_1.IsOptional)()
|
|
43
|
-
__metadata("design:type", Object)
|
|
43
|
+
(0, class_validator_1.IsOptional)()
|
|
44
44
|
], CreateVariantValidator.prototype, "active", void 0);
|
|
45
45
|
exports.CreateVariantValidator = CreateVariantValidator;
|
|
46
46
|
class UpdateVariantValidator extends app_validator_1.AppValidator {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
47
|
+
price = 0;
|
|
48
|
+
sku;
|
|
49
|
+
quantity = 1;
|
|
50
|
+
active;
|
|
52
51
|
toEntity(entity) {
|
|
53
52
|
if (this.sku) {
|
|
54
53
|
entity.sku = this.sku;
|
|
@@ -68,21 +67,17 @@ class UpdateVariantValidator extends app_validator_1.AppValidator {
|
|
|
68
67
|
__decorate([
|
|
69
68
|
(0, class_validator_1.IsNumber)(),
|
|
70
69
|
(0, class_validator_1.Min)(0),
|
|
71
|
-
(0, class_validator_1.IsOptional)()
|
|
72
|
-
__metadata("design:type", Object)
|
|
70
|
+
(0, class_validator_1.IsOptional)()
|
|
73
71
|
], UpdateVariantValidator.prototype, "price", void 0);
|
|
74
72
|
__decorate([
|
|
75
|
-
(0, class_validator_1.IsOptional)()
|
|
76
|
-
__metadata("design:type", String)
|
|
73
|
+
(0, class_validator_1.IsOptional)()
|
|
77
74
|
], UpdateVariantValidator.prototype, "sku", void 0);
|
|
78
75
|
__decorate([
|
|
79
76
|
(0, class_validator_1.IsPositive)(),
|
|
80
|
-
(0, class_validator_1.IsOptional)()
|
|
81
|
-
__metadata("design:type", Object)
|
|
77
|
+
(0, class_validator_1.IsOptional)()
|
|
82
78
|
], UpdateVariantValidator.prototype, "quantity", void 0);
|
|
83
79
|
__decorate([
|
|
84
80
|
(0, class_validator_1.IsBoolean)(),
|
|
85
|
-
(0, class_validator_1.IsOptional)()
|
|
86
|
-
__metadata("design:type", Object)
|
|
81
|
+
(0, class_validator_1.IsOptional)()
|
|
87
82
|
], UpdateVariantValidator.prototype, "active", void 0);
|
|
88
83
|
exports.UpdateVariantValidator = UpdateVariantValidator;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.OrderDocument = void 0;
|
|
4
10
|
const es_mapping_ts_1 = require("es-mapping-ts");
|
|
5
11
|
const app_document_1 = require("../../../config/app.document");
|
|
6
12
|
let OrderDocument = class OrderDocument extends app_document_1.AppDocument {
|
|
13
|
+
number;
|
|
14
|
+
price;
|
|
7
15
|
transform(entity) {
|
|
8
16
|
this.number = entity.number;
|
|
9
17
|
this.price = entity.price;
|
|
@@ -11,12 +19,10 @@ let OrderDocument = class OrderDocument extends app_document_1.AppDocument {
|
|
|
11
19
|
}
|
|
12
20
|
};
|
|
13
21
|
__decorate([
|
|
14
|
-
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
15
|
-
__metadata("design:type", String)
|
|
22
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
16
23
|
], OrderDocument.prototype, "number", void 0);
|
|
17
24
|
__decorate([
|
|
18
|
-
(0, es_mapping_ts_1.EsField)({ type: 'integer' })
|
|
19
|
-
__metadata("design:type", Number)
|
|
25
|
+
(0, es_mapping_ts_1.EsField)({ type: 'integer' })
|
|
20
26
|
], OrderDocument.prototype, "price", void 0);
|
|
21
27
|
OrderDocument = __decorate([
|
|
22
28
|
(0, es_mapping_ts_1.EsEntity)({ mixins: [app_document_1.AppDocument] })
|
|
@@ -1,17 +1,23 @@
|
|
|
1
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
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.OrderEntity = void 0;
|
|
4
10
|
const typeorm_1 = require("typeorm");
|
|
5
11
|
const app_entity_1 = require("../../../config/app.entity");
|
|
6
12
|
let OrderEntity = class OrderEntity extends app_entity_1.AppEntity {
|
|
13
|
+
number;
|
|
14
|
+
price;
|
|
7
15
|
};
|
|
8
16
|
__decorate([
|
|
9
|
-
(0, typeorm_1.Column)({ type: 'varchar', length: 16 })
|
|
10
|
-
__metadata("design:type", String)
|
|
17
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 16 })
|
|
11
18
|
], OrderEntity.prototype, "number", void 0);
|
|
12
19
|
__decorate([
|
|
13
|
-
(0, typeorm_1.Column)({ type: 'int' })
|
|
14
|
-
__metadata("design:type", Number)
|
|
20
|
+
(0, typeorm_1.Column)({ type: 'int' })
|
|
15
21
|
], OrderEntity.prototype, "price", void 0);
|
|
16
22
|
OrderEntity = __decorate([
|
|
17
23
|
(0, typeorm_1.Entity)('store_orders')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AppValidator } from '../../../config/app.validator';
|
|
2
2
|
import { OrderEntity } from './order.entity';
|
|
3
3
|
export declare class CreateOrderValidator extends AppValidator<OrderEntity> {
|
|
4
|
-
toEntity(): OrderEntity;
|
|
4
|
+
toEntity?(): OrderEntity;
|
|
5
5
|
}
|
|
6
6
|
export declare class UpdateOrderValidator extends AppValidator<OrderEntity> {
|
|
7
7
|
toEntity(entity: OrderEntity): OrderEntity;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkaly/api",
|
|
3
|
-
"version": "0.2.1-
|
|
3
|
+
"version": "0.2.1-3",
|
|
4
4
|
"description": "NestJS Backend ApiRest Service",
|
|
5
5
|
"author": "Randy Tellez Galan <kronhyx@gmail.com>",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"auth0": "^2.35.0",
|
|
33
33
|
"class-transformer": "^0.5.1",
|
|
34
34
|
"class-validator": "^0.13.1",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
35
|
+
"es-mapping-ts": "^1.0.1",
|
|
36
|
+
"reflect-metadata": "^0.1.13"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@commitlint/config-conventional": "^17.0.0",
|
|
@@ -64,7 +64,6 @@
|
|
|
64
64
|
"@typescript-eslint/eslint-plugin": "4.33.0",
|
|
65
65
|
"@typescript-eslint/parser": "4.33.0",
|
|
66
66
|
"commitlint": "^17.0.1",
|
|
67
|
-
"es-mapping-ts": "^1.0.1",
|
|
68
67
|
"eslint": "7.32.0",
|
|
69
68
|
"eslint-plugin-import": "^2.23.4",
|
|
70
69
|
"express": "^4.17.3",
|
|
@@ -83,6 +82,7 @@
|
|
|
83
82
|
"ts-loader": "^9.2.3",
|
|
84
83
|
"ts-node": "^10.0.0",
|
|
85
84
|
"tsconfig-paths": "^4.0.0",
|
|
85
|
+
"typeorm": "^0.3.7",
|
|
86
86
|
"typeorm-naming-strategies": "^4.0.0",
|
|
87
87
|
"typescript": "^4.6.2",
|
|
88
88
|
"webpack": "^5"
|