@merkaly/api 0.1.12-0 → 0.2.1-0
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.d.ts +28 -0
- package/.output/app.js +28 -0
- package/.output/config/app.document.d.ts +9 -0
- package/.output/config/app.document.js +28 -0
- package/.output/config/app.validator.d.ts +6 -0
- package/.output/config/app.validator.js +6 -0
- package/{src → .output/src}/auth/auth.validator.d.ts +0 -1
- package/.output/src/auth/auth.validator.js +14 -0
- package/.output/src/inventory/brands/brand.document.d.ts +7 -0
- package/.output/src/inventory/brands/brand.document.js +22 -0
- package/.output/src/inventory/brands/brand.validator.d.ts +12 -0
- package/.output/src/inventory/brands/brand.validator.js +43 -0
- package/.output/src/inventory/categories/category.document.d.ts +7 -0
- package/.output/src/inventory/categories/category.document.js +22 -0
- package/.output/src/inventory/categories/category.validator.d.ts +15 -0
- package/.output/src/inventory/categories/category.validator.js +47 -0
- package/.output/src/inventory/media/media.document.d.ts +7 -0
- package/.output/src/inventory/media/media.document.js +22 -0
- package/.output/src/inventory/media/media.validator.d.ts +11 -0
- package/.output/src/inventory/media/media.validator.js +31 -0
- package/.output/src/inventory/products/product.document.d.ts +12 -0
- package/.output/src/inventory/products/product.document.js +38 -0
- package/.output/src/inventory/products/product.validator.d.ts +25 -0
- package/.output/src/inventory/products/product.validator.js +111 -0
- package/.output/src/inventory/variants/variant.document.d.ts +9 -0
- package/.output/src/inventory/variants/variant.document.js +30 -0
- package/.output/src/inventory/variants/variant.validator.d.ts +18 -0
- package/.output/src/inventory/variants/variant.validator.js +81 -0
- package/.output/src/store/orders/order.document.d.ts +7 -0
- package/.output/src/store/orders/order.document.js +22 -0
- package/.output/src/store/orders/order.validator.d.ts +9 -0
- package/.output/src/store/orders/order.validator.js +18 -0
- package/index.ts +25 -2
- package/package.json +25 -24
- package/config/app.entity.d.ts +0 -7
- package/config/app.entity.d.ts.map +0 -1
- package/config/app.entity.ts +0 -9
- package/index.d.ts +0 -3
- package/index.d.ts.map +0 -1
- package/src/account/connections/connection.validator.d.ts +0 -9
- package/src/account/connections/connection.validator.d.ts.map +0 -1
- package/src/account/connections/connection.validator.ts +0 -15
- package/src/account/connections/index.d.ts +0 -5
- package/src/account/connections/index.d.ts.map +0 -1
- package/src/account/connections/index.ts +0 -5
- package/src/account/index.d.ts +0 -9
- package/src/account/index.d.ts.map +0 -1
- package/src/account/index.ts +0 -9
- package/src/account/organizations/connections/connection.validator.d.ts +0 -10
- package/src/account/organizations/connections/connection.validator.d.ts.map +0 -1
- package/src/account/organizations/connections/connection.validator.ts +0 -16
- package/src/account/organizations/connections/index.d.ts +0 -5
- package/src/account/organizations/connections/index.d.ts.map +0 -1
- package/src/account/organizations/connections/index.ts +0 -6
- package/src/account/organizations/index.d.ts +0 -9
- package/src/account/organizations/index.d.ts.map +0 -1
- package/src/account/organizations/index.ts +0 -9
- package/src/account/organizations/members/index.d.ts +0 -5
- package/src/account/organizations/members/index.d.ts.map +0 -1
- package/src/account/organizations/members/index.ts +0 -6
- package/src/account/organizations/members/member.validator.d.ts +0 -4
- package/src/account/organizations/members/member.validator.d.ts.map +0 -1
- package/src/account/organizations/members/member.validator.ts +0 -5
- package/src/account/organizations/organization.validator.d.ts +0 -18
- package/src/account/organizations/organization.validator.d.ts.map +0 -1
- package/src/account/organizations/organization.validator.ts +0 -46
- package/src/account/roles/index.d.ts +0 -7
- package/src/account/roles/index.d.ts.map +0 -1
- package/src/account/roles/index.ts +0 -7
- package/src/account/roles/role.validator.d.ts +0 -13
- package/src/account/roles/role.validator.d.ts.map +0 -1
- package/src/account/roles/role.validator.ts +0 -26
- package/src/account/roles/users/index.d.ts +0 -5
- package/src/account/roles/users/index.d.ts.map +0 -1
- package/src/account/roles/users/index.ts +0 -5
- package/src/account/roles/users/user.validator.d.ts +0 -4
- package/src/account/roles/users/user.validator.d.ts.map +0 -1
- package/src/account/roles/users/user.validator.ts +0 -5
- package/src/account/users/extra/extra.validator.d.ts +0 -2
- package/src/account/users/extra/extra.validator.d.ts.map +0 -1
- package/src/account/users/extra/extra.validator.ts +0 -1
- package/src/account/users/index.d.ts +0 -7
- package/src/account/users/index.d.ts.map +0 -1
- package/src/account/users/index.ts +0 -7
- package/src/account/users/roles/index.d.ts +0 -5
- package/src/account/users/roles/index.d.ts.map +0 -1
- package/src/account/users/roles/index.ts +0 -5
- package/src/account/users/roles/role.validator.d.ts +0 -4
- package/src/account/users/roles/role.validator.d.ts.map +0 -1
- package/src/account/users/roles/role.validator.ts +0 -5
- package/src/account/users/user.validator.d.ts +0 -16
- package/src/account/users/user.validator.d.ts.map +0 -1
- package/src/account/users/user.validator.ts +0 -36
- package/src/auth/auth.validator.d.ts.map +0 -1
- package/src/auth/auth.validator.ts +0 -12
- package/src/inventory/brands/brand.entity.d.ts +0 -8
- package/src/inventory/brands/brand.entity.d.ts.map +0 -1
- package/src/inventory/brands/brand.entity.ts +0 -10
- package/src/inventory/brands/brand.validator.d.ts +0 -11
- package/src/inventory/brands/brand.validator.d.ts.map +0 -1
- package/src/inventory/brands/brand.validator.ts +0 -17
- package/src/inventory/categories/category.entity.d.ts +0 -10
- package/src/inventory/categories/category.entity.d.ts.map +0 -1
- package/src/inventory/categories/category.entity.ts +0 -13
- package/src/inventory/categories/category.validator.d.ts +0 -12
- package/src/inventory/categories/category.validator.d.ts.map +0 -1
- package/src/inventory/categories/category.validator.ts +0 -20
- package/src/inventory/media/media.entity.d.ts +0 -6
- package/src/inventory/media/media.entity.d.ts.map +0 -1
- package/src/inventory/media/media.entity.ts +0 -7
- package/src/inventory/media/media.validator.d.ts +0 -6
- package/src/inventory/media/media.validator.d.ts.map +0 -1
- package/src/inventory/media/media.validator.ts +0 -9
- package/src/inventory/products/product.entity.d.ts +0 -22
- package/src/inventory/products/product.entity.d.ts.map +0 -1
- package/src/inventory/products/product.entity.ts +0 -38
- package/src/inventory/products/product.validator.d.ts +0 -24
- package/src/inventory/products/product.validator.d.ts.map +0 -1
- package/src/inventory/products/product.validator.ts +0 -69
- package/src/inventory/properties/property.entity.d.ts +0 -10
- package/src/inventory/properties/property.entity.d.ts.map +0 -1
- package/src/inventory/properties/property.entity.ts +0 -14
- package/src/inventory/properties/property.validator.d.ts +0 -13
- package/src/inventory/properties/property.validator.d.ts.map +0 -1
- package/src/inventory/properties/property.validator.ts +0 -26
- package/src/inventory/variants/variant.entity.d.ts +0 -12
- package/src/inventory/variants/variant.entity.d.ts.map +0 -1
- package/src/inventory/variants/variant.entity.ts +0 -22
- package/src/inventory/variants/variant.validator.d.ts +0 -11
- package/src/inventory/variants/variant.validator.d.ts.map +0 -1
- package/src/inventory/variants/variant.validator.ts +0 -23
- package/src/store/orders/order.entity.d.ts +0 -6
- package/src/store/orders/order.entity.d.ts.map +0 -1
- package/src/store/orders/order.entity.ts +0 -7
- package/src/store/orders/order.validator.d.ts +0 -8
- package/src/store/orders/order.validator.d.ts.map +0 -1
- package/src/store/orders/order.validator.ts +0 -14
package/.output/app.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare namespace Inventory {
|
|
2
|
+
const brand: {
|
|
3
|
+
document: any;
|
|
4
|
+
validators: any;
|
|
5
|
+
};
|
|
6
|
+
const category: {
|
|
7
|
+
document: any;
|
|
8
|
+
validators: any;
|
|
9
|
+
};
|
|
10
|
+
const product: {
|
|
11
|
+
document: any;
|
|
12
|
+
validators: any;
|
|
13
|
+
};
|
|
14
|
+
const media: {
|
|
15
|
+
document: any;
|
|
16
|
+
validators: any;
|
|
17
|
+
};
|
|
18
|
+
const variant: {
|
|
19
|
+
document: any;
|
|
20
|
+
validators: any;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare namespace Store {
|
|
24
|
+
const order: {
|
|
25
|
+
document: any;
|
|
26
|
+
validators: any;
|
|
27
|
+
};
|
|
28
|
+
}
|
package/.output/app.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Store = exports.Inventory = void 0;
|
|
4
|
+
const brand_document_1 = require("./src/inventory/brands/brand.document");
|
|
5
|
+
const BrandValidators = __importStar(require("./src/inventory/brands/brand.validator"));
|
|
6
|
+
const category_document_1 = require("./src/inventory/categories/category.document");
|
|
7
|
+
const CategoryValidators = __importStar(require("./src/inventory/categories/category.validator"));
|
|
8
|
+
const media_document_1 = require("./src/inventory/media/media.document");
|
|
9
|
+
const MediaValidators = __importStar(require("./src/inventory/media/media.validator"));
|
|
10
|
+
const product_document_1 = require("./src/inventory/products/product.document");
|
|
11
|
+
const ProductValidators = __importStar(require("./src/inventory/products/product.validator"));
|
|
12
|
+
const variant_document_1 = require("./src/inventory/variants/variant.document");
|
|
13
|
+
const VariantValidators = __importStar(require("./src/inventory/variants/variant.validator"));
|
|
14
|
+
const order_document_1 = require("./src/store/orders/order.document");
|
|
15
|
+
const OrderValidators = __importStar(require("./src/store/orders/order.validator"));
|
|
16
|
+
const create = (document, validators) => ({ document, validators });
|
|
17
|
+
var Inventory;
|
|
18
|
+
(function (Inventory) {
|
|
19
|
+
Inventory.brand = create(brand_document_1.BrandDocument, BrandValidators);
|
|
20
|
+
Inventory.category = create(category_document_1.CategoryDocument, CategoryValidators);
|
|
21
|
+
Inventory.product = create(product_document_1.ProductDocument, ProductValidators);
|
|
22
|
+
Inventory.media = create(media_document_1.MediaDocument, MediaValidators);
|
|
23
|
+
Inventory.variant = create(variant_document_1.VariantDocument, VariantValidators);
|
|
24
|
+
})(Inventory = exports.Inventory || (exports.Inventory = {}));
|
|
25
|
+
var Store;
|
|
26
|
+
(function (Store) {
|
|
27
|
+
Store.order = create(order_document_1.OrderDocument, OrderValidators);
|
|
28
|
+
})(Store = exports.Store || (exports.Store = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppEntity } from './app.entity';
|
|
2
|
+
export declare abstract class AppDocument<E extends AppEntity> {
|
|
3
|
+
protected abstract transform(entity: E): this;
|
|
4
|
+
$id: string;
|
|
5
|
+
$createdAt: Date;
|
|
6
|
+
$updatedAt: Date;
|
|
7
|
+
$deletedAt: Date;
|
|
8
|
+
serialize(entity: E): this;
|
|
9
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppDocument = void 0;
|
|
4
|
+
const class_transformer_1 = require("class-transformer");
|
|
5
|
+
const es_mapping_ts_1 = require("es-mapping-ts");
|
|
6
|
+
class AppDocument {
|
|
7
|
+
serialize(entity) {
|
|
8
|
+
this.$id = entity.id;
|
|
9
|
+
this.$createdAt = entity.createdAt;
|
|
10
|
+
this.$updatedAt = entity.updatedAt;
|
|
11
|
+
this.$deletedAt = entity.deletedAt;
|
|
12
|
+
this.transform(entity);
|
|
13
|
+
return (0, class_transformer_1.instanceToPlain)(this);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
__decorate([
|
|
17
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
18
|
+
], AppDocument.prototype, "$id", void 0);
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, es_mapping_ts_1.EsField)({ type: 'date' })
|
|
21
|
+
], AppDocument.prototype, "$createdAt", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, es_mapping_ts_1.EsField)({ type: 'date' })
|
|
24
|
+
], AppDocument.prototype, "$updatedAt", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, es_mapping_ts_1.EsField)({ type: 'date' })
|
|
27
|
+
], AppDocument.prototype, "$deletedAt", void 0);
|
|
28
|
+
exports.AppDocument = AppDocument;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SearchRequest } from '@elastic/elasticsearch/lib/api/types';
|
|
2
|
+
import { AppEntity } from './app.entity';
|
|
3
|
+
export declare abstract class AppValidator<E extends AppEntity> {
|
|
4
|
+
abstract toEntity(...variadic: unknown[]): E;
|
|
5
|
+
}
|
|
6
|
+
export declare type SearchQuery = Omit<SearchRequest, 'index' | 'routing'>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoginValidator = void 0;
|
|
4
|
+
const class_validator_1 = require("class-validator");
|
|
5
|
+
require("reflect-metadata");
|
|
6
|
+
class LoginValidator {
|
|
7
|
+
}
|
|
8
|
+
__decorate([
|
|
9
|
+
(0, class_validator_1.IsEmail)()
|
|
10
|
+
], LoginValidator.prototype, "username", void 0);
|
|
11
|
+
__decorate([
|
|
12
|
+
(0, class_validator_1.IsNotEmpty)()
|
|
13
|
+
], LoginValidator.prototype, "password", void 0);
|
|
14
|
+
exports.LoginValidator = LoginValidator;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AppDocument } from '../../../config/app.document';
|
|
2
|
+
import { BrandEntity } from './brand.entity';
|
|
3
|
+
export declare class BrandDocument extends AppDocument<BrandEntity> {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
protected transform(entity: BrandEntity): this;
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrandDocument = void 0;
|
|
4
|
+
const es_mapping_ts_1 = require("es-mapping-ts");
|
|
5
|
+
const app_document_1 = require("../../../config/app.document");
|
|
6
|
+
let BrandDocument = class BrandDocument extends app_document_1.AppDocument {
|
|
7
|
+
transform(entity) {
|
|
8
|
+
this.name = entity.name;
|
|
9
|
+
this.description = entity.description;
|
|
10
|
+
return this;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
__decorate([
|
|
14
|
+
(0, es_mapping_ts_1.EsField)({ type: 'keyword' })
|
|
15
|
+
], BrandDocument.prototype, "name", void 0);
|
|
16
|
+
__decorate([
|
|
17
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
18
|
+
], BrandDocument.prototype, "description", void 0);
|
|
19
|
+
BrandDocument = __decorate([
|
|
20
|
+
(0, es_mapping_ts_1.EsEntity)({ mixins: [app_document_1.AppDocument] })
|
|
21
|
+
], BrandDocument);
|
|
22
|
+
exports.BrandDocument = BrandDocument;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AppValidator } from '../../../config/app.validator';
|
|
2
|
+
import { BrandEntity } from './brand.entity';
|
|
3
|
+
export declare class CreateBrandValidator extends AppValidator<BrandEntity> {
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
toEntity(): BrandEntity;
|
|
7
|
+
}
|
|
8
|
+
export declare class UpdateBrandValidator extends AppValidator<BrandEntity> {
|
|
9
|
+
name?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
toEntity(entity: BrandEntity): BrandEntity;
|
|
12
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateBrandValidator = exports.CreateBrandValidator = void 0;
|
|
4
|
+
const class_validator_1 = require("class-validator");
|
|
5
|
+
const app_validator_1 = require("../../../config/app.validator");
|
|
6
|
+
const brand_entity_1 = require("./brand.entity");
|
|
7
|
+
class CreateBrandValidator extends app_validator_1.AppValidator {
|
|
8
|
+
toEntity() {
|
|
9
|
+
const entity = new brand_entity_1.BrandEntity();
|
|
10
|
+
entity.name = this.name;
|
|
11
|
+
entity.description = this.description;
|
|
12
|
+
return entity;
|
|
13
|
+
}
|
|
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 extends app_validator_1.AppValidator {
|
|
25
|
+
toEntity(entity) {
|
|
26
|
+
if (this.name) {
|
|
27
|
+
entity.name = this.name;
|
|
28
|
+
}
|
|
29
|
+
if (this.description) {
|
|
30
|
+
entity.description = this.description;
|
|
31
|
+
}
|
|
32
|
+
return entity;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, class_validator_1.IsString)(),
|
|
37
|
+
(0, class_validator_1.IsOptional)()
|
|
38
|
+
], UpdateBrandValidator.prototype, "name", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, class_validator_1.IsString)(),
|
|
41
|
+
(0, class_validator_1.IsOptional)()
|
|
42
|
+
], UpdateBrandValidator.prototype, "description", void 0);
|
|
43
|
+
exports.UpdateBrandValidator = UpdateBrandValidator;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AppDocument } from '../../../config/app.document';
|
|
2
|
+
import { CategoryEntity } from './category.entity';
|
|
3
|
+
export declare class CategoryDocument extends AppDocument<CategoryEntity> {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
protected transform(entity: CategoryEntity): this;
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CategoryDocument = void 0;
|
|
4
|
+
const es_mapping_ts_1 = require("es-mapping-ts");
|
|
5
|
+
const app_document_1 = require("../../../config/app.document");
|
|
6
|
+
let CategoryDocument = class CategoryDocument extends app_document_1.AppDocument {
|
|
7
|
+
transform(entity) {
|
|
8
|
+
this.name = entity.name;
|
|
9
|
+
this.description = entity.description;
|
|
10
|
+
return this;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
__decorate([
|
|
14
|
+
(0, es_mapping_ts_1.EsField)({ type: 'keyword' })
|
|
15
|
+
], CategoryDocument.prototype, "name", void 0);
|
|
16
|
+
__decorate([
|
|
17
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
18
|
+
], CategoryDocument.prototype, "description", void 0);
|
|
19
|
+
CategoryDocument = __decorate([
|
|
20
|
+
(0, es_mapping_ts_1.EsEntity)({ mixins: [app_document_1.AppDocument] })
|
|
21
|
+
], CategoryDocument);
|
|
22
|
+
exports.CategoryDocument = CategoryDocument;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { AppValidator } from '../../../config/app.validator';
|
|
3
|
+
import { CategoryEntity } from './category.entity';
|
|
4
|
+
export declare class FindCategoryValidator {
|
|
5
|
+
}
|
|
6
|
+
export declare class CreateCategoryValidator extends AppValidator<CategoryEntity> {
|
|
7
|
+
name: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
toEntity(): CategoryEntity;
|
|
10
|
+
}
|
|
11
|
+
export declare class UpdateCategoryValidator extends AppValidator<CategoryEntity> {
|
|
12
|
+
name: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
toEntity(entity: CategoryEntity): CategoryEntity;
|
|
15
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateCategoryValidator = exports.CreateCategoryValidator = exports.FindCategoryValidator = void 0;
|
|
4
|
+
const class_validator_1 = require("class-validator");
|
|
5
|
+
require("reflect-metadata");
|
|
6
|
+
const app_validator_1 = require("../../../config/app.validator");
|
|
7
|
+
const category_entity_1 = require("./category.entity");
|
|
8
|
+
class FindCategoryValidator {
|
|
9
|
+
}
|
|
10
|
+
exports.FindCategoryValidator = FindCategoryValidator;
|
|
11
|
+
class CreateCategoryValidator extends app_validator_1.AppValidator {
|
|
12
|
+
toEntity() {
|
|
13
|
+
const entity = new category_entity_1.CategoryEntity();
|
|
14
|
+
entity.name = this.name;
|
|
15
|
+
entity.description = this.description;
|
|
16
|
+
return entity;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, class_validator_1.IsString)(),
|
|
21
|
+
(0, class_validator_1.Length)(5, 32)
|
|
22
|
+
], CreateCategoryValidator.prototype, "name", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, class_validator_1.IsString)(),
|
|
25
|
+
(0, class_validator_1.IsOptional)()
|
|
26
|
+
], CreateCategoryValidator.prototype, "description", void 0);
|
|
27
|
+
exports.CreateCategoryValidator = CreateCategoryValidator;
|
|
28
|
+
class UpdateCategoryValidator extends app_validator_1.AppValidator {
|
|
29
|
+
toEntity(entity) {
|
|
30
|
+
if (this.name) {
|
|
31
|
+
entity.name = this.name;
|
|
32
|
+
}
|
|
33
|
+
if (this.description) {
|
|
34
|
+
entity.description = this.description;
|
|
35
|
+
}
|
|
36
|
+
return entity;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, class_validator_1.IsString)(),
|
|
41
|
+
(0, class_validator_1.IsOptional)()
|
|
42
|
+
], UpdateCategoryValidator.prototype, "name", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, class_validator_1.IsString)(),
|
|
45
|
+
(0, class_validator_1.IsOptional)()
|
|
46
|
+
], UpdateCategoryValidator.prototype, "description", void 0);
|
|
47
|
+
exports.UpdateCategoryValidator = UpdateCategoryValidator;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MediaDocument = void 0;
|
|
4
|
+
const es_mapping_ts_1 = require("es-mapping-ts");
|
|
5
|
+
const app_document_1 = require("../../../config/app.document");
|
|
6
|
+
let MediaDocument = class MediaDocument extends app_document_1.AppDocument {
|
|
7
|
+
transform(entity) {
|
|
8
|
+
this.name = entity.name;
|
|
9
|
+
this.url = entity.url;
|
|
10
|
+
return this;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
__decorate([
|
|
14
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
15
|
+
], MediaDocument.prototype, "name", void 0);
|
|
16
|
+
__decorate([
|
|
17
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
18
|
+
], MediaDocument.prototype, "url", void 0);
|
|
19
|
+
MediaDocument = __decorate([
|
|
20
|
+
(0, es_mapping_ts_1.EsEntity)({ mixins: [app_document_1.AppDocument] })
|
|
21
|
+
], MediaDocument);
|
|
22
|
+
exports.MediaDocument = MediaDocument;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { AppValidator } from '../../../config/app.validator';
|
|
3
|
+
import { MediaEntity } from './media.entity';
|
|
4
|
+
export declare class CreateMediaValidator extends AppValidator<MediaEntity> {
|
|
5
|
+
name: string;
|
|
6
|
+
toEntity(): MediaEntity;
|
|
7
|
+
}
|
|
8
|
+
export declare class UpdateMediaValidator extends AppValidator<MediaEntity> {
|
|
9
|
+
name: string;
|
|
10
|
+
toEntity(entity: MediaEntity): MediaEntity;
|
|
11
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateMediaValidator = exports.CreateMediaValidator = void 0;
|
|
4
|
+
const class_validator_1 = require("class-validator");
|
|
5
|
+
require("reflect-metadata");
|
|
6
|
+
const app_validator_1 = require("../../../config/app.validator");
|
|
7
|
+
const media_entity_1 = require("./media.entity");
|
|
8
|
+
class CreateMediaValidator extends app_validator_1.AppValidator {
|
|
9
|
+
toEntity() {
|
|
10
|
+
const entity = new media_entity_1.MediaEntity();
|
|
11
|
+
entity.name = this.name;
|
|
12
|
+
return entity;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
__decorate([
|
|
16
|
+
(0, class_validator_1.IsString)()
|
|
17
|
+
], CreateMediaValidator.prototype, "name", void 0);
|
|
18
|
+
exports.CreateMediaValidator = CreateMediaValidator;
|
|
19
|
+
class UpdateMediaValidator extends app_validator_1.AppValidator {
|
|
20
|
+
toEntity(entity) {
|
|
21
|
+
if (this.name) {
|
|
22
|
+
entity.name = this.name;
|
|
23
|
+
}
|
|
24
|
+
return entity;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, class_validator_1.IsString)(),
|
|
29
|
+
(0, class_validator_1.IsOptional)()
|
|
30
|
+
], UpdateMediaValidator.prototype, "name", void 0);
|
|
31
|
+
exports.UpdateMediaValidator = UpdateMediaValidator;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Id } from '@elastic/elasticsearch/lib/api/types';
|
|
2
|
+
import { AppDocument } from '../../../config/app.document';
|
|
3
|
+
import { ProductEntity } from './product.entity';
|
|
4
|
+
export declare class ProductDocument extends AppDocument<ProductEntity> {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
availableFrom: Date;
|
|
8
|
+
active: boolean;
|
|
9
|
+
category: Id;
|
|
10
|
+
brand: Id;
|
|
11
|
+
protected transform(entity: ProductEntity): this;
|
|
12
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProductDocument = void 0;
|
|
4
|
+
const es_mapping_ts_1 = require("es-mapping-ts");
|
|
5
|
+
const app_document_1 = require("../../../config/app.document");
|
|
6
|
+
let ProductDocument = class ProductDocument extends app_document_1.AppDocument {
|
|
7
|
+
transform(entity) {
|
|
8
|
+
this.name = entity.name;
|
|
9
|
+
this.description = entity.description;
|
|
10
|
+
this.active = entity.active;
|
|
11
|
+
this.availableFrom = entity.availableFrom;
|
|
12
|
+
this.category = entity.category.id;
|
|
13
|
+
this.brand = entity.brand.id;
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, es_mapping_ts_1.EsField)({ type: 'keyword' })
|
|
19
|
+
], ProductDocument.prototype, "name", void 0);
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, es_mapping_ts_1.EsField)({ type: 'keyword' })
|
|
22
|
+
], ProductDocument.prototype, "description", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, es_mapping_ts_1.EsField)({ type: 'date' })
|
|
25
|
+
], ProductDocument.prototype, "availableFrom", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, es_mapping_ts_1.EsField)({ type: 'boolean' })
|
|
28
|
+
], ProductDocument.prototype, "active", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
31
|
+
], ProductDocument.prototype, "category", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' })
|
|
34
|
+
], ProductDocument.prototype, "brand", void 0);
|
|
35
|
+
ProductDocument = __decorate([
|
|
36
|
+
(0, es_mapping_ts_1.EsEntity)({ mixins: [app_document_1.AppDocument] })
|
|
37
|
+
], ProductDocument);
|
|
38
|
+
exports.ProductDocument = ProductDocument;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Id } from '@elastic/elasticsearch/lib/api/types';
|
|
2
|
+
import 'reflect-metadata';
|
|
3
|
+
import { AppValidator } from '../../../config/app.validator';
|
|
4
|
+
import { CreateVariantValidator } from '../variants/variant.validator';
|
|
5
|
+
import { ProductEntity } from './product.entity';
|
|
6
|
+
export declare class CreateProductValidator extends AppValidator<ProductEntity> {
|
|
7
|
+
name: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
availableFrom: Date;
|
|
10
|
+
active: boolean;
|
|
11
|
+
category?: Id;
|
|
12
|
+
brand?: Id;
|
|
13
|
+
hashtags: string[];
|
|
14
|
+
variants: CreateVariantValidator[];
|
|
15
|
+
toEntity(): ProductEntity;
|
|
16
|
+
}
|
|
17
|
+
export declare class UpdateProductValidator extends AppValidator<ProductEntity> {
|
|
18
|
+
name?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
category?: Id;
|
|
21
|
+
brand?: Id;
|
|
22
|
+
hashtags?: string[];
|
|
23
|
+
active: boolean;
|
|
24
|
+
toEntity(entity: ProductEntity): ProductEntity;
|
|
25
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateProductValidator = exports.CreateProductValidator = void 0;
|
|
4
|
+
const class_transformer_1 = require("class-transformer");
|
|
5
|
+
const class_validator_1 = require("class-validator");
|
|
6
|
+
require("reflect-metadata");
|
|
7
|
+
const app_validator_1 = require("../../../config/app.validator");
|
|
8
|
+
const brand_entity_1 = require("../brands/brand.entity");
|
|
9
|
+
const category_entity_1 = require("../categories/category.entity");
|
|
10
|
+
const variant_validator_1 = require("../variants/variant.validator");
|
|
11
|
+
const product_entity_1 = require("./product.entity");
|
|
12
|
+
class CreateProductValidator extends app_validator_1.AppValidator {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.active = true;
|
|
16
|
+
this.hashtags = [];
|
|
17
|
+
this.variants = [];
|
|
18
|
+
}
|
|
19
|
+
toEntity() {
|
|
20
|
+
const entity = new product_entity_1.ProductEntity();
|
|
21
|
+
entity.name = this.name;
|
|
22
|
+
entity.description = this.description;
|
|
23
|
+
entity.brand = new brand_entity_1.BrandEntity(this.brand);
|
|
24
|
+
entity.category = new category_entity_1.CategoryEntity(this.category);
|
|
25
|
+
entity.active = this.active;
|
|
26
|
+
entity.hashtags = this.hashtags;
|
|
27
|
+
entity.availableFrom = new Date(this.availableFrom || null);
|
|
28
|
+
return entity;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, class_validator_1.IsString)()
|
|
33
|
+
], CreateProductValidator.prototype, "name", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, class_validator_1.IsString)(),
|
|
36
|
+
(0, class_validator_1.IsOptional)()
|
|
37
|
+
], CreateProductValidator.prototype, "description", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, class_validator_1.IsDateString)(),
|
|
40
|
+
(0, class_validator_1.IsOptional)()
|
|
41
|
+
], CreateProductValidator.prototype, "availableFrom", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, class_validator_1.IsBoolean)(),
|
|
44
|
+
(0, class_validator_1.IsOptional)()
|
|
45
|
+
], CreateProductValidator.prototype, "active", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, class_validator_1.IsOptional)(),
|
|
48
|
+
(0, class_validator_1.IsUUID)()
|
|
49
|
+
], CreateProductValidator.prototype, "category", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, class_validator_1.IsOptional)(),
|
|
52
|
+
(0, class_validator_1.IsUUID)()
|
|
53
|
+
], CreateProductValidator.prototype, "brand", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, class_validator_1.IsOptional)(),
|
|
56
|
+
(0, class_validator_1.IsString)({ each: true })
|
|
57
|
+
], CreateProductValidator.prototype, "hashtags", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
60
|
+
(0, class_transformer_1.Type)(() => variant_validator_1.CreateVariantValidator),
|
|
61
|
+
(0, class_validator_1.IsOptional)()
|
|
62
|
+
], CreateProductValidator.prototype, "variants", void 0);
|
|
63
|
+
exports.CreateProductValidator = CreateProductValidator;
|
|
64
|
+
class UpdateProductValidator extends app_validator_1.AppValidator {
|
|
65
|
+
toEntity(entity) {
|
|
66
|
+
if (this.brand) {
|
|
67
|
+
entity.brand = new brand_entity_1.BrandEntity(this.brand);
|
|
68
|
+
}
|
|
69
|
+
if (this.category) {
|
|
70
|
+
entity.category = new category_entity_1.CategoryEntity(this.category);
|
|
71
|
+
}
|
|
72
|
+
if (this.description) {
|
|
73
|
+
entity.description = this.description;
|
|
74
|
+
}
|
|
75
|
+
if (this.hashtags) {
|
|
76
|
+
entity.hashtags = this.hashtags;
|
|
77
|
+
}
|
|
78
|
+
if (this.name) {
|
|
79
|
+
entity.name = this.name;
|
|
80
|
+
}
|
|
81
|
+
if (this.active) {
|
|
82
|
+
entity.active = this.active;
|
|
83
|
+
}
|
|
84
|
+
return entity;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, class_validator_1.IsString)(),
|
|
89
|
+
(0, class_validator_1.IsOptional)()
|
|
90
|
+
], UpdateProductValidator.prototype, "name", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
(0, class_validator_1.IsString)(),
|
|
93
|
+
(0, class_validator_1.IsOptional)()
|
|
94
|
+
], UpdateProductValidator.prototype, "description", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
(0, class_validator_1.IsOptional)(),
|
|
97
|
+
(0, class_validator_1.IsPositive)()
|
|
98
|
+
], UpdateProductValidator.prototype, "category", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, class_validator_1.IsOptional)(),
|
|
101
|
+
(0, class_validator_1.IsPositive)()
|
|
102
|
+
], UpdateProductValidator.prototype, "brand", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, class_validator_1.IsOptional)(),
|
|
105
|
+
(0, class_validator_1.IsString)({ each: true })
|
|
106
|
+
], UpdateProductValidator.prototype, "hashtags", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
(0, class_validator_1.IsBoolean)(),
|
|
109
|
+
(0, class_validator_1.IsOptional)()
|
|
110
|
+
], UpdateProductValidator.prototype, "active", void 0);
|
|
111
|
+
exports.UpdateProductValidator = UpdateProductValidator;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppDocument } from '../../../config/app.document';
|
|
2
|
+
import { VariantEntity } from './variant.entity';
|
|
3
|
+
export declare class VariantDocument extends AppDocument<VariantEntity> {
|
|
4
|
+
sku: string;
|
|
5
|
+
quantity: number;
|
|
6
|
+
price: number;
|
|
7
|
+
active: boolean;
|
|
8
|
+
protected transform(entity: VariantEntity): this;
|
|
9
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VariantDocument = void 0;
|
|
4
|
+
const es_mapping_ts_1 = require("es-mapping-ts");
|
|
5
|
+
const app_document_1 = require("../../../config/app.document");
|
|
6
|
+
let VariantDocument = class VariantDocument extends app_document_1.AppDocument {
|
|
7
|
+
transform(entity) {
|
|
8
|
+
this.sku = entity.sku;
|
|
9
|
+
this.quantity = entity.quantity;
|
|
10
|
+
this.price = entity.price;
|
|
11
|
+
this.active = entity.active;
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
__decorate([
|
|
16
|
+
(0, es_mapping_ts_1.EsField)({ type: 'keyword' })
|
|
17
|
+
], VariantDocument.prototype, "sku", void 0);
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, es_mapping_ts_1.EsField)({ type: 'float' })
|
|
20
|
+
], VariantDocument.prototype, "quantity", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, es_mapping_ts_1.EsField)({ type: 'integer' })
|
|
23
|
+
], VariantDocument.prototype, "price", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, es_mapping_ts_1.EsField)({ type: 'boolean' })
|
|
26
|
+
], VariantDocument.prototype, "active", void 0);
|
|
27
|
+
VariantDocument = __decorate([
|
|
28
|
+
(0, es_mapping_ts_1.EsEntity)({ mixins: [app_document_1.AppDocument] })
|
|
29
|
+
], VariantDocument);
|
|
30
|
+
exports.VariantDocument = VariantDocument;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { AppValidator } from '../../../config/app.validator';
|
|
3
|
+
import { ProductEntity } from '../products/product.entity';
|
|
4
|
+
import { VariantEntity } from './variant.entity';
|
|
5
|
+
export declare class CreateVariantValidator extends AppValidator<VariantEntity> {
|
|
6
|
+
price: number;
|
|
7
|
+
sku: string;
|
|
8
|
+
quantity: number;
|
|
9
|
+
active: boolean;
|
|
10
|
+
toEntity(product?: ProductEntity): VariantEntity;
|
|
11
|
+
}
|
|
12
|
+
export declare class UpdateVariantValidator extends AppValidator<VariantEntity> {
|
|
13
|
+
price: number;
|
|
14
|
+
sku: string;
|
|
15
|
+
quantity: number;
|
|
16
|
+
active: any;
|
|
17
|
+
toEntity(entity: VariantEntity): VariantEntity;
|
|
18
|
+
}
|