@merkaly/api 0.2.0 → 0.2.1-2
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 +47 -2
- package/.output/app.js +25 -0
- package/.output/config/app.document.d.ts +5 -8
- package/.output/config/app.document.js +32 -0
- package/.output/config/app.entity.d.ts +0 -1
- package/.output/config/app.entity.js +31 -0
- package/.output/config/app.validator.d.ts +0 -1
- package/.output/config/app.validator.js +6 -0
- package/.output/src/auth/auth.validator.d.ts +0 -2
- package/.output/src/auth/auth.validator.js +15 -0
- package/.output/src/inventory/brands/brand.document.d.ts +0 -1
- package/.output/src/inventory/brands/brand.document.js +24 -0
- package/.output/src/inventory/brands/brand.entity.d.ts +0 -1
- package/.output/src/inventory/brands/brand.entity.js +24 -0
- package/.output/src/inventory/brands/brand.validator.d.ts +0 -1
- package/.output/src/inventory/brands/brand.validator.js +47 -0
- package/.output/src/inventory/categories/category.document.d.ts +0 -1
- package/.output/src/inventory/categories/category.document.js +24 -0
- package/.output/src/inventory/categories/category.entity.d.ts +0 -1
- package/.output/src/inventory/categories/category.entity.js +24 -0
- package/.output/src/inventory/categories/category.validator.d.ts +0 -2
- package/.output/src/inventory/categories/category.validator.js +50 -0
- package/.output/src/inventory/media/media.document.d.ts +0 -1
- package/.output/src/inventory/media/media.document.js +24 -0
- package/.output/src/inventory/media/media.entity.d.ts +0 -1
- package/.output/src/inventory/media/media.entity.js +24 -0
- package/.output/src/inventory/media/media.validator.d.ts +0 -2
- package/.output/src/inventory/media/media.validator.js +32 -0
- package/.output/src/inventory/products/product.document.d.ts +1 -1
- package/.output/src/inventory/products/product.document.js +48 -0
- package/.output/src/inventory/products/product.entity.d.ts +0 -1
- package/.output/src/inventory/products/product.entity.js +67 -0
- package/.output/src/inventory/products/product.validator.d.ts +1 -3
- package/.output/src/inventory/products/product.validator.js +124 -0
- package/.output/src/inventory/variants/variant.document.d.ts +0 -1
- package/.output/src/inventory/variants/variant.document.js +34 -0
- package/.output/src/inventory/variants/variant.entity.d.ts +0 -1
- package/.output/src/inventory/variants/variant.entity.js +44 -0
- package/.output/src/inventory/variants/variant.validator.d.ts +0 -2
- package/.output/src/inventory/variants/variant.validator.js +88 -0
- package/.output/src/store/orders/order.document.d.ts +0 -1
- package/.output/src/store/orders/order.document.js +24 -0
- package/.output/src/store/orders/order.entity.d.ts +0 -1
- package/.output/src/store/orders/order.entity.js +19 -0
- package/.output/src/store/orders/order.validator.d.ts +0 -2
- package/.output/src/store/orders/order.validator.js +17 -0
- package/index.ts +24 -0
- package/package.json +6 -2
- package/.output/config/app.config.d.ts +0 -28
- package/.output/config/app.controller.d.ts +0 -11
- package/.output/config/app.exception.d.ts +0 -11
- package/.output/config/app.middleware.d.ts +0 -3
- package/.output/config/app.module.d.ts +0 -6
- package/.output/config/app.repository.d.ts +0 -24
- package/.output/config/app.router.d.ts +0 -6
- package/.output/src/auth/auth.controller.d.ts +0 -9
- package/.output/src/auth/auth.decorator.d.ts +0 -5
- package/.output/src/auth/auth.guard.d.ts +0 -16
- package/.output/src/auth/auth.module.d.ts +0 -9
- package/.output/src/auth/auth.repository.d.ts +0 -11
- package/.output/src/auth/auth.strategy.d.ts +0 -18
- package/.output/src/inventory/brands/brand.controller.d.ts +0 -15
- package/.output/src/inventory/brands/brand.exception.d.ts +0 -6
- package/.output/src/inventory/brands/brand.module.d.ts +0 -8
- package/.output/src/inventory/brands/brand.repository.d.ts +0 -9
- package/.output/src/inventory/categories/category.controller.d.ts +0 -12
- package/.output/src/inventory/categories/category.exception.d.ts +0 -6
- package/.output/src/inventory/categories/category.module.d.ts +0 -8
- package/.output/src/inventory/categories/category.repository.d.ts +0 -9
- package/.output/src/inventory/inventory.module.d.ts +0 -14
- package/.output/src/inventory/media/media.controller.d.ts +0 -6
- package/.output/src/inventory/media/media.exception.d.ts +0 -6
- package/.output/src/inventory/media/media.module.d.ts +0 -8
- package/.output/src/inventory/media/media.repository.d.ts +0 -9
- package/.output/src/inventory/products/product.controller.d.ts +0 -14
- package/.output/src/inventory/products/product.exception.d.ts +0 -6
- package/.output/src/inventory/products/product.module.d.ts +0 -8
- package/.output/src/inventory/products/product.repository.d.ts +0 -11
- package/.output/src/inventory/variants/variant.controller.d.ts +0 -9
- package/.output/src/inventory/variants/variant.exception.d.ts +0 -6
- package/.output/src/inventory/variants/variant.module.d.ts +0 -8
- package/.output/src/inventory/variants/variant.repository.d.ts +0 -9
- package/.output/src/store/orders/order.controller.d.ts +0 -12
- package/.output/src/store/orders/order.exception.d.ts +0 -6
- package/.output/src/store/orders/order.module.d.ts +0 -8
- package/.output/src/store/orders/order.repository.d.ts +0 -9
- package/.output/src/store/store.module.d.ts +0 -10
package/.output/app.d.ts
CHANGED
|
@@ -1,2 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { BrandDocument } from './src/inventory/brands/brand.document';
|
|
2
|
+
import * as BrandValidators from './src/inventory/brands/brand.validator';
|
|
3
|
+
import { CategoryDocument } from './src/inventory/categories/category.document';
|
|
4
|
+
import * as CategoryValidators from './src/inventory/categories/category.validator';
|
|
5
|
+
import { MediaDocument } from './src/inventory/media/media.document';
|
|
6
|
+
import * as MediaValidators from './src/inventory/media/media.validator';
|
|
7
|
+
import { ProductDocument } from './src/inventory/products/product.document';
|
|
8
|
+
import * as ProductValidators from './src/inventory/products/product.validator';
|
|
9
|
+
import { VariantDocument } from './src/inventory/variants/variant.document';
|
|
10
|
+
import * as VariantValidators from './src/inventory/variants/variant.validator';
|
|
11
|
+
import { OrderDocument } from './src/store/orders/order.document';
|
|
12
|
+
import * as OrderValidators from './src/store/orders/order.validator';
|
|
13
|
+
export declare const Inventory: {
|
|
14
|
+
Brand: {
|
|
15
|
+
CreateBrandValidator: typeof BrandValidators.CreateBrandValidator;
|
|
16
|
+
UpdateBrandValidator: typeof BrandValidators.UpdateBrandValidator;
|
|
17
|
+
BrandDocument: typeof BrandDocument;
|
|
18
|
+
};
|
|
19
|
+
Category: {
|
|
20
|
+
FindCategoryValidator: typeof CategoryValidators.FindCategoryValidator;
|
|
21
|
+
CreateCategoryValidator: typeof CategoryValidators.CreateCategoryValidator;
|
|
22
|
+
UpdateCategoryValidator: typeof CategoryValidators.UpdateCategoryValidator;
|
|
23
|
+
CategoryDocument: typeof CategoryDocument;
|
|
24
|
+
};
|
|
25
|
+
Product: {
|
|
26
|
+
CreateProductValidator: typeof ProductValidators.CreateProductValidator;
|
|
27
|
+
UpdateProductValidator: typeof ProductValidators.UpdateProductValidator;
|
|
28
|
+
ProductDocument: typeof ProductDocument;
|
|
29
|
+
};
|
|
30
|
+
Media: {
|
|
31
|
+
CreateMediaValidator: typeof MediaValidators.CreateMediaValidator;
|
|
32
|
+
UpdateMediaValidator: typeof MediaValidators.UpdateMediaValidator;
|
|
33
|
+
MediaDocument: typeof MediaDocument;
|
|
34
|
+
};
|
|
35
|
+
Variant: {
|
|
36
|
+
CreateVariantValidator: typeof VariantValidators.CreateVariantValidator;
|
|
37
|
+
UpdateVariantValidator: typeof VariantValidators.UpdateVariantValidator;
|
|
38
|
+
VariantDocument: typeof VariantDocument;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export declare const Store: {
|
|
42
|
+
Order: {
|
|
43
|
+
CreateOrderValidator: typeof OrderValidators.CreateOrderValidator;
|
|
44
|
+
UpdateOrderValidator: typeof OrderValidators.UpdateOrderValidator;
|
|
45
|
+
OrderDocument: typeof OrderDocument;
|
|
46
|
+
};
|
|
47
|
+
};
|
package/.output/app.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
exports.Inventory = {
|
|
17
|
+
Brand: Object.assign({ BrandDocument: brand_document_1.BrandDocument }, BrandValidators),
|
|
18
|
+
Category: Object.assign({ CategoryDocument: category_document_1.CategoryDocument }, CategoryValidators),
|
|
19
|
+
Product: Object.assign({ ProductDocument: product_document_1.ProductDocument }, ProductValidators),
|
|
20
|
+
Media: Object.assign({ MediaDocument: media_document_1.MediaDocument }, MediaValidators),
|
|
21
|
+
Variant: Object.assign({ VariantDocument: variant_document_1.VariantDocument }, VariantValidators)
|
|
22
|
+
};
|
|
23
|
+
exports.Store = {
|
|
24
|
+
Order: Object.assign({ OrderDocument: order_document_1.OrderDocument }, OrderValidators)
|
|
25
|
+
};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { EntityManager } from 'typeorm';
|
|
2
1
|
import { AppEntity } from './app.entity';
|
|
3
2
|
export declare abstract class AppDocument<E extends AppEntity> {
|
|
4
|
-
protected $id: string;
|
|
5
|
-
protected $updatedAt: Date;
|
|
6
|
-
protected $createdAt: Date;
|
|
7
|
-
protected $deletedAt: Date;
|
|
8
|
-
protected $manager: EntityManager;
|
|
9
|
-
serialize(entity: E): this;
|
|
10
3
|
protected abstract transform(entity: E): this;
|
|
4
|
+
$id: string;
|
|
5
|
+
$createdAt: Date;
|
|
6
|
+
$updatedAt: Date;
|
|
7
|
+
$deletedAt: Date;
|
|
8
|
+
serialize(entity: E): this;
|
|
11
9
|
}
|
|
12
|
-
//# sourceMappingURL=app.document.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
__metadata("design:type", String)
|
|
19
|
+
], AppDocument.prototype, "$id", void 0);
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, es_mapping_ts_1.EsField)({ type: 'date' }),
|
|
22
|
+
__metadata("design:type", Date)
|
|
23
|
+
], AppDocument.prototype, "$createdAt", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, es_mapping_ts_1.EsField)({ type: 'date' }),
|
|
26
|
+
__metadata("design:type", Date)
|
|
27
|
+
], AppDocument.prototype, "$updatedAt", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, es_mapping_ts_1.EsField)({ type: 'date' }),
|
|
30
|
+
__metadata("design:type", Date)
|
|
31
|
+
], AppDocument.prototype, "$deletedAt", void 0);
|
|
32
|
+
exports.AppDocument = AppDocument;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppEntity = void 0;
|
|
4
|
+
const typeorm_1 = require("typeorm");
|
|
5
|
+
let AppEntity = class AppEntity {
|
|
6
|
+
constructor(id) {
|
|
7
|
+
this.createdAt = new Date();
|
|
8
|
+
this.id = id;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
__decorate([
|
|
12
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
13
|
+
__metadata("design:type", String)
|
|
14
|
+
], AppEntity.prototype, "id", void 0);
|
|
15
|
+
__decorate([
|
|
16
|
+
(0, typeorm_1.CreateDateColumn)({ type: 'datetime', nullable: false }),
|
|
17
|
+
__metadata("design:type", Object)
|
|
18
|
+
], AppEntity.prototype, "createdAt", void 0);
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, typeorm_1.UpdateDateColumn)({ type: 'datetime', nullable: true }),
|
|
21
|
+
__metadata("design:type", Date)
|
|
22
|
+
], AppEntity.prototype, "updatedAt", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, typeorm_1.DeleteDateColumn)({ type: 'datetime', nullable: true }),
|
|
25
|
+
__metadata("design:type", Date)
|
|
26
|
+
], AppEntity.prototype, "deletedAt", void 0);
|
|
27
|
+
AppEntity = __decorate([
|
|
28
|
+
(0, typeorm_1.Entity)(),
|
|
29
|
+
__metadata("design:paramtypes", [String])
|
|
30
|
+
], AppEntity);
|
|
31
|
+
exports.AppEntity = AppEntity;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoginValidator = void 0;
|
|
4
|
+
const class_validator_1 = require("class-validator");
|
|
5
|
+
class LoginValidator {
|
|
6
|
+
}
|
|
7
|
+
__decorate([
|
|
8
|
+
(0, class_validator_1.IsEmail)(),
|
|
9
|
+
__metadata("design:type", String)
|
|
10
|
+
], LoginValidator.prototype, "username", void 0);
|
|
11
|
+
__decorate([
|
|
12
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
13
|
+
__metadata("design:type", String)
|
|
14
|
+
], LoginValidator.prototype, "password", void 0);
|
|
15
|
+
exports.LoginValidator = LoginValidator;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
__metadata("design:type", String)
|
|
16
|
+
], BrandDocument.prototype, "name", void 0);
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' }),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], BrandDocument.prototype, "description", void 0);
|
|
21
|
+
BrandDocument = __decorate([
|
|
22
|
+
(0, es_mapping_ts_1.EsEntity)({ mixins: [app_document_1.AppDocument] })
|
|
23
|
+
], BrandDocument);
|
|
24
|
+
exports.BrandDocument = BrandDocument;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrandEntity = void 0;
|
|
4
|
+
const typeorm_1 = require("typeorm");
|
|
5
|
+
const app_entity_1 = require("../../../config/app.entity");
|
|
6
|
+
const product_entity_1 = require("../products/product.entity");
|
|
7
|
+
let BrandEntity = class BrandEntity extends app_entity_1.AppEntity {
|
|
8
|
+
};
|
|
9
|
+
__decorate([
|
|
10
|
+
(0, typeorm_1.Column)({ length: 32, unique: true }),
|
|
11
|
+
__metadata("design:type", String)
|
|
12
|
+
], BrandEntity.prototype, "name", void 0);
|
|
13
|
+
__decorate([
|
|
14
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
15
|
+
__metadata("design:type", String)
|
|
16
|
+
], BrandEntity.prototype, "description", void 0);
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, typeorm_1.OneToMany)(() => product_entity_1.ProductEntity, ({ brand }) => brand),
|
|
19
|
+
__metadata("design:type", Array)
|
|
20
|
+
], BrandEntity.prototype, "products", void 0);
|
|
21
|
+
BrandEntity = __decorate([
|
|
22
|
+
(0, typeorm_1.Entity)('inventory_brands')
|
|
23
|
+
], BrandEntity);
|
|
24
|
+
exports.BrandEntity = BrandEntity;
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
__metadata("design:type", String)
|
|
19
|
+
], CreateBrandValidator.prototype, "name", void 0);
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, class_validator_1.IsString)(),
|
|
22
|
+
(0, class_validator_1.IsOptional)(),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], CreateBrandValidator.prototype, "description", void 0);
|
|
25
|
+
exports.CreateBrandValidator = CreateBrandValidator;
|
|
26
|
+
class UpdateBrandValidator extends app_validator_1.AppValidator {
|
|
27
|
+
toEntity(entity) {
|
|
28
|
+
if (this.name) {
|
|
29
|
+
entity.name = this.name;
|
|
30
|
+
}
|
|
31
|
+
if (this.description) {
|
|
32
|
+
entity.description = this.description;
|
|
33
|
+
}
|
|
34
|
+
return entity;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, class_validator_1.IsString)(),
|
|
39
|
+
(0, class_validator_1.IsOptional)(),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], UpdateBrandValidator.prototype, "name", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, class_validator_1.IsString)(),
|
|
44
|
+
(0, class_validator_1.IsOptional)(),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], UpdateBrandValidator.prototype, "description", void 0);
|
|
47
|
+
exports.UpdateBrandValidator = UpdateBrandValidator;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
__metadata("design:type", String)
|
|
16
|
+
], CategoryDocument.prototype, "name", void 0);
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' }),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], CategoryDocument.prototype, "description", void 0);
|
|
21
|
+
CategoryDocument = __decorate([
|
|
22
|
+
(0, es_mapping_ts_1.EsEntity)({ mixins: [app_document_1.AppDocument] })
|
|
23
|
+
], CategoryDocument);
|
|
24
|
+
exports.CategoryDocument = CategoryDocument;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CategoryEntity = void 0;
|
|
4
|
+
const typeorm_1 = require("typeorm");
|
|
5
|
+
const app_entity_1 = require("../../../config/app.entity");
|
|
6
|
+
const product_entity_1 = require("../products/product.entity");
|
|
7
|
+
let CategoryEntity = class CategoryEntity extends app_entity_1.AppEntity {
|
|
8
|
+
};
|
|
9
|
+
__decorate([
|
|
10
|
+
(0, typeorm_1.Column)({ length: 32, unique: true }),
|
|
11
|
+
__metadata("design:type", String)
|
|
12
|
+
], CategoryEntity.prototype, "name", void 0);
|
|
13
|
+
__decorate([
|
|
14
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
15
|
+
__metadata("design:type", String)
|
|
16
|
+
], CategoryEntity.prototype, "description", void 0);
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, typeorm_1.OneToMany)(() => product_entity_1.ProductEntity, ({ category }) => category),
|
|
19
|
+
__metadata("design:type", Array)
|
|
20
|
+
], CategoryEntity.prototype, "products", void 0);
|
|
21
|
+
CategoryEntity = __decorate([
|
|
22
|
+
(0, typeorm_1.Entity)('inventory_categories')
|
|
23
|
+
], CategoryEntity);
|
|
24
|
+
exports.CategoryEntity = CategoryEntity;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
1
|
import { AppValidator } from '../../../config/app.validator';
|
|
3
2
|
import { CategoryEntity } from './category.entity';
|
|
4
3
|
export declare class FindCategoryValidator {
|
|
@@ -13,4 +12,3 @@ export declare class UpdateCategoryValidator extends AppValidator<CategoryEntity
|
|
|
13
12
|
description?: string;
|
|
14
13
|
toEntity(entity: CategoryEntity): CategoryEntity;
|
|
15
14
|
}
|
|
16
|
-
//# sourceMappingURL=category.validator.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
const app_validator_1 = require("../../../config/app.validator");
|
|
6
|
+
const category_entity_1 = require("./category.entity");
|
|
7
|
+
class FindCategoryValidator {
|
|
8
|
+
}
|
|
9
|
+
exports.FindCategoryValidator = FindCategoryValidator;
|
|
10
|
+
class CreateCategoryValidator extends app_validator_1.AppValidator {
|
|
11
|
+
toEntity() {
|
|
12
|
+
const entity = new category_entity_1.CategoryEntity();
|
|
13
|
+
entity.name = this.name;
|
|
14
|
+
entity.description = this.description;
|
|
15
|
+
return entity;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, class_validator_1.IsString)(),
|
|
20
|
+
(0, class_validator_1.Length)(5, 32),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], CreateCategoryValidator.prototype, "name", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, class_validator_1.IsString)(),
|
|
25
|
+
(0, class_validator_1.IsOptional)(),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], CreateCategoryValidator.prototype, "description", void 0);
|
|
28
|
+
exports.CreateCategoryValidator = CreateCategoryValidator;
|
|
29
|
+
class UpdateCategoryValidator extends app_validator_1.AppValidator {
|
|
30
|
+
toEntity(entity) {
|
|
31
|
+
if (this.name) {
|
|
32
|
+
entity.name = this.name;
|
|
33
|
+
}
|
|
34
|
+
if (this.description) {
|
|
35
|
+
entity.description = this.description;
|
|
36
|
+
}
|
|
37
|
+
return entity;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, class_validator_1.IsString)(),
|
|
42
|
+
(0, class_validator_1.IsOptional)(),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], UpdateCategoryValidator.prototype, "name", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_validator_1.IsString)(),
|
|
47
|
+
(0, class_validator_1.IsOptional)(),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], UpdateCategoryValidator.prototype, "description", void 0);
|
|
50
|
+
exports.UpdateCategoryValidator = UpdateCategoryValidator;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
__metadata("design:type", String)
|
|
16
|
+
], MediaDocument.prototype, "name", void 0);
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' }),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], MediaDocument.prototype, "url", void 0);
|
|
21
|
+
MediaDocument = __decorate([
|
|
22
|
+
(0, es_mapping_ts_1.EsEntity)({ mixins: [app_document_1.AppDocument] })
|
|
23
|
+
], MediaDocument);
|
|
24
|
+
exports.MediaDocument = MediaDocument;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MediaEntity = void 0;
|
|
4
|
+
const typeorm_1 = require("typeorm");
|
|
5
|
+
const app_entity_1 = require("../../../config/app.entity");
|
|
6
|
+
const product_entity_1 = require("../products/product.entity");
|
|
7
|
+
let MediaEntity = class MediaEntity extends app_entity_1.AppEntity {
|
|
8
|
+
};
|
|
9
|
+
__decorate([
|
|
10
|
+
(0, typeorm_1.Column)({ length: 64 }),
|
|
11
|
+
__metadata("design:type", String)
|
|
12
|
+
], MediaEntity.prototype, "name", void 0);
|
|
13
|
+
__decorate([
|
|
14
|
+
(0, typeorm_1.Column)({ length: 2048 }),
|
|
15
|
+
__metadata("design:type", String)
|
|
16
|
+
], MediaEntity.prototype, "url", void 0);
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, typeorm_1.ManyToOne)(() => product_entity_1.ProductEntity, ({ media }) => media),
|
|
19
|
+
__metadata("design:type", product_entity_1.ProductEntity)
|
|
20
|
+
], MediaEntity.prototype, "product", void 0);
|
|
21
|
+
MediaEntity = __decorate([
|
|
22
|
+
(0, typeorm_1.Entity)('inventory_media')
|
|
23
|
+
], MediaEntity);
|
|
24
|
+
exports.MediaEntity = MediaEntity;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
1
|
import { AppValidator } from '../../../config/app.validator';
|
|
3
2
|
import { MediaEntity } from './media.entity';
|
|
4
3
|
export declare class CreateMediaValidator extends AppValidator<MediaEntity> {
|
|
@@ -9,4 +8,3 @@ export declare class UpdateMediaValidator extends AppValidator<MediaEntity> {
|
|
|
9
8
|
name: string;
|
|
10
9
|
toEntity(entity: MediaEntity): MediaEntity;
|
|
11
10
|
}
|
|
12
|
-
//# sourceMappingURL=media.validator.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
const app_validator_1 = require("../../../config/app.validator");
|
|
6
|
+
const media_entity_1 = require("./media.entity");
|
|
7
|
+
class CreateMediaValidator extends app_validator_1.AppValidator {
|
|
8
|
+
toEntity() {
|
|
9
|
+
const entity = new media_entity_1.MediaEntity();
|
|
10
|
+
entity.name = this.name;
|
|
11
|
+
return entity;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
__decorate([
|
|
15
|
+
(0, class_validator_1.IsString)(),
|
|
16
|
+
__metadata("design:type", String)
|
|
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
|
+
__metadata("design:type", String)
|
|
31
|
+
], UpdateMediaValidator.prototype, "name", void 0);
|
|
32
|
+
exports.UpdateMediaValidator = UpdateMediaValidator;
|
|
@@ -5,9 +5,9 @@ export declare class ProductDocument extends AppDocument<ProductEntity> {
|
|
|
5
5
|
name: string;
|
|
6
6
|
description: string;
|
|
7
7
|
availableFrom: Date;
|
|
8
|
+
hashtags: string[];
|
|
8
9
|
active: boolean;
|
|
9
10
|
category: Id;
|
|
10
11
|
brand: Id;
|
|
11
12
|
protected transform(entity: ProductEntity): this;
|
|
12
13
|
}
|
|
13
|
-
//# sourceMappingURL=product.document.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
__metadata("design:type", String)
|
|
20
|
+
], ProductDocument.prototype, "name", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, es_mapping_ts_1.EsField)({ type: 'keyword' }),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], ProductDocument.prototype, "description", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, es_mapping_ts_1.EsField)({ type: 'date' }),
|
|
27
|
+
__metadata("design:type", Date)
|
|
28
|
+
], ProductDocument.prototype, "availableFrom", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, es_mapping_ts_1.EsField)({ type: 'nested' }),
|
|
31
|
+
__metadata("design:type", Array)
|
|
32
|
+
], ProductDocument.prototype, "hashtags", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, es_mapping_ts_1.EsField)({ type: 'boolean' }),
|
|
35
|
+
__metadata("design:type", Boolean)
|
|
36
|
+
], ProductDocument.prototype, "active", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' }),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], ProductDocument.prototype, "category", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, es_mapping_ts_1.EsField)({ type: 'text' }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], ProductDocument.prototype, "brand", void 0);
|
|
45
|
+
ProductDocument = __decorate([
|
|
46
|
+
(0, es_mapping_ts_1.EsEntity)({ mixins: [app_document_1.AppDocument] })
|
|
47
|
+
], ProductDocument);
|
|
48
|
+
exports.ProductDocument = ProductDocument;
|