update product full

This commit is contained in:
2026-03-26 12:25:46 +03:00
parent f2b5f7006b
commit 4f5b557085
31733 changed files with 2762883 additions and 5 deletions

View File

@@ -0,0 +1,338 @@
import { CheckProductSlugDto } from './dto/check-product-slug.dto';
import { CreateProductDto } from './dto/create-product.dto';
import { FilterProductReviewsDto } from './dto/filter-product-reviews.dto';
import { FilterProductsDto } from './dto/filter-products.dto';
import { ModerateProductReviewDto } from './dto/moderate-product-review.dto';
import { UpdateProductDto } from './dto/update-product.dto';
import { ProductsService } from './products.service';
export declare class AdminProductsController {
private readonly productsService;
constructor(productsService: ProductsService);
create(dto: CreateProductDto, files: {
mainImage?: Express.Multer.File[];
images?: Express.Multer.File[];
model3d?: Express.Multer.File[];
}): Promise<{
attributes: {
id: string;
attributeId: string;
name: string;
slug: string;
dataType: import("./enums/attribute-data-type.enum").AttributeDataType;
unit: string | null;
options: string[];
isFilterable: boolean;
isVisible: boolean;
valueText: string | null;
valueNumber: number | null;
valueBoolean: boolean | null;
valueJson: string[] | Record<string, unknown> | null;
}[];
meta: import("./entities/product-meta.entity").ProductMeta | {
shortDescription: string | null;
description: string | null;
seo: {
title: string;
description: string | null;
} | undefined;
share: {
title: string;
description: string | null;
imageUrl: string | null | undefined;
};
};
brandInfo: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
primaryCategory: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
categories: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
}[];
id: string;
sku: string;
title: string;
slug: string;
technicalCode: string;
brand: string;
brandEntity?: import("./entities/brand.entity").Brand | null;
basePriceUSD: number;
salePriceUSD?: number | null;
stock: number;
featured: boolean;
type: import("./enums/product-type.enum").ProductType;
status: import("./enums/product-status.enum").ProductStatus;
mainImageUrl?: string | null;
threeDModelUrl?: string | null;
imageGalleryUrls: string[];
tags: string[];
averageRating: number;
reviewsCount: number;
attributeValues: import("./entities/product-attribute-value.entity").ProductAttributeValue[];
reviews: import("./entities/product-review.entity").ProductReview[];
createdAt: Date;
updatedAt: Date;
}>;
findAll(filters: FilterProductsDto): Promise<{
items: {
attributes: {
id: string;
attributeId: string;
name: string;
slug: string;
dataType: import("./enums/attribute-data-type.enum").AttributeDataType;
unit: string | null;
options: string[];
isFilterable: boolean;
isVisible: boolean;
valueText: string | null;
valueNumber: number | null;
valueBoolean: boolean | null;
valueJson: string[] | Record<string, unknown> | null;
}[];
meta: import("./entities/product-meta.entity").ProductMeta | {
shortDescription: string | null;
description: string | null;
seo: {
title: string;
description: string | null;
} | undefined;
share: {
title: string;
description: string | null;
imageUrl: string | null | undefined;
};
};
brandInfo: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
primaryCategory: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
categories: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
}[];
id: string;
sku: string;
title: string;
slug: string;
technicalCode: string;
brand: string;
brandEntity?: import("./entities/brand.entity").Brand | null;
basePriceUSD: number;
salePriceUSD?: number | null;
stock: number;
featured: boolean;
type: import("./enums/product-type.enum").ProductType;
status: import("./enums/product-status.enum").ProductStatus;
mainImageUrl?: string | null;
threeDModelUrl?: string | null;
imageGalleryUrls: string[];
tags: string[];
averageRating: number;
reviewsCount: number;
attributeValues: import("./entities/product-attribute-value.entity").ProductAttributeValue[];
reviews: import("./entities/product-review.entity").ProductReview[];
createdAt: Date;
updatedAt: Date;
}[];
meta: {
total: number;
page: number;
limit: number;
};
}>;
checkSlug(query: CheckProductSlugDto): Promise<boolean>;
findReviews(filters: FilterProductReviewsDto): Promise<{
items: import("./entities/product-review.entity").ProductReview[];
meta: {
total: number;
page: number;
limit: number;
};
}>;
updateReview(reviewId: string, dto: ModerateProductReviewDto): Promise<import("./entities/product-review.entity").ProductReview>;
removeReview(reviewId: string): Promise<{
message: string;
}>;
findOne(id: string): Promise<{
attributes: {
id: string;
attributeId: string;
name: string;
slug: string;
dataType: import("./enums/attribute-data-type.enum").AttributeDataType;
unit: string | null;
options: string[];
isFilterable: boolean;
isVisible: boolean;
valueText: string | null;
valueNumber: number | null;
valueBoolean: boolean | null;
valueJson: string[] | Record<string, unknown> | null;
}[];
meta: import("./entities/product-meta.entity").ProductMeta | {
shortDescription: string | null;
description: string | null;
seo: {
title: string;
description: string | null;
} | undefined;
share: {
title: string;
description: string | null;
imageUrl: string | null | undefined;
};
};
brandInfo: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
primaryCategory: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
categories: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
}[];
id: string;
sku: string;
title: string;
slug: string;
technicalCode: string;
brand: string;
brandEntity?: import("./entities/brand.entity").Brand | null;
basePriceUSD: number;
salePriceUSD?: number | null;
stock: number;
featured: boolean;
type: import("./enums/product-type.enum").ProductType;
status: import("./enums/product-status.enum").ProductStatus;
mainImageUrl?: string | null;
threeDModelUrl?: string | null;
imageGalleryUrls: string[];
tags: string[];
averageRating: number;
reviewsCount: number;
attributeValues: import("./entities/product-attribute-value.entity").ProductAttributeValue[];
reviews: import("./entities/product-review.entity").ProductReview[];
createdAt: Date;
updatedAt: Date;
}>;
update(id: string, dto: UpdateProductDto, files: {
mainImage?: Express.Multer.File[];
images?: Express.Multer.File[];
model3d?: Express.Multer.File[];
}): Promise<{
attributes: {
id: string;
attributeId: string;
name: string;
slug: string;
dataType: import("./enums/attribute-data-type.enum").AttributeDataType;
unit: string | null;
options: string[];
isFilterable: boolean;
isVisible: boolean;
valueText: string | null;
valueNumber: number | null;
valueBoolean: boolean | null;
valueJson: string[] | Record<string, unknown> | null;
}[];
meta: import("./entities/product-meta.entity").ProductMeta | {
shortDescription: string | null;
description: string | null;
seo: {
title: string;
description: string | null;
} | undefined;
share: {
title: string;
description: string | null;
imageUrl: string | null | undefined;
};
};
brandInfo: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
primaryCategory: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
categories: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
}[];
id: string;
sku: string;
title: string;
slug: string;
technicalCode: string;
brand: string;
brandEntity?: import("./entities/brand.entity").Brand | null;
basePriceUSD: number;
salePriceUSD?: number | null;
stock: number;
featured: boolean;
type: import("./enums/product-type.enum").ProductType;
status: import("./enums/product-status.enum").ProductStatus;
mainImageUrl?: string | null;
threeDModelUrl?: string | null;
imageGalleryUrls: string[];
tags: string[];
averageRating: number;
reviewsCount: number;
attributeValues: import("./entities/product-attribute-value.entity").ProductAttributeValue[];
reviews: import("./entities/product-review.entity").ProductReview[];
createdAt: Date;
updatedAt: Date;
}>;
remove(id: string): Promise<{
message: string;
}>;
}

View File

@@ -0,0 +1,165 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AdminProductsController = void 0;
const common_1 = require("@nestjs/common");
const platform_express_1 = require("@nestjs/platform-express");
const swagger_1 = require("@nestjs/swagger");
const permissions_decorator_1 = require("../../common/decorators/permissions.decorator");
const roles_decorator_1 = require("../../common/decorators/roles.decorator");
const permissions_guard_1 = require("../../common/guards/permissions.guard");
const roles_guard_1 = require("../../common/guards/roles.guard");
const jwt_auth_guard_1 = require("../auth/guards/jwt-auth.guard");
const user_role_enum_1 = require("../users/enums/user-role.enum");
const check_product_slug_dto_1 = require("./dto/check-product-slug.dto");
const create_product_dto_1 = require("./dto/create-product.dto");
const filter_product_reviews_dto_1 = require("./dto/filter-product-reviews.dto");
const filter_products_dto_1 = require("./dto/filter-products.dto");
const moderate_product_review_dto_1 = require("./dto/moderate-product-review.dto");
const update_product_dto_1 = require("./dto/update-product.dto");
const products_service_1 = require("./products.service");
let AdminProductsController = class AdminProductsController {
productsService;
constructor(productsService) {
this.productsService = productsService;
}
create(dto, files) {
return this.productsService.create(dto, files);
}
findAll(filters) {
return this.productsService.findAdmin(filters);
}
checkSlug(query) {
return this.productsService.checkSlugAvailability(query.slug, query.excludeId);
}
findReviews(filters) {
return this.productsService.findAdminReviews(filters);
}
updateReview(reviewId, dto) {
return this.productsService.updateReview(reviewId, dto);
}
removeReview(reviewId) {
return this.productsService.removeReview(reviewId);
}
findOne(id) {
return this.productsService.findAdminOne(id);
}
update(id, dto, files) {
return this.productsService.update(id, dto, files);
}
remove(id) {
return this.productsService.remove(id);
}
};
exports.AdminProductsController = AdminProductsController;
__decorate([
(0, common_1.Post)(),
(0, swagger_1.ApiOperation)({ summary: 'Create a product for admin panel' }),
(0, swagger_1.ApiConsumes)('multipart/form-data'),
(0, swagger_1.ApiBody)({ type: create_product_dto_1.CreateProductDto }),
(0, common_1.UseInterceptors)((0, platform_express_1.FileFieldsInterceptor)([
{ name: 'mainImage', maxCount: 1 },
{ name: 'images', maxCount: 10 },
{ name: 'model3d', maxCount: 1 },
])),
__param(0, (0, common_1.Body)()),
__param(1, (0, common_1.UploadedFiles)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [create_product_dto_1.CreateProductDto, Object]),
__metadata("design:returntype", void 0)
], AdminProductsController.prototype, "create", null);
__decorate([
(0, common_1.Get)(),
(0, swagger_1.ApiOperation)({ summary: 'List all products for admin panel, including drafts' }),
__param(0, (0, common_1.Query)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [filter_products_dto_1.FilterProductsDto]),
__metadata("design:returntype", void 0)
], AdminProductsController.prototype, "findAll", null);
__decorate([
(0, common_1.Get)('check-slug'),
(0, swagger_1.ApiOperation)({ summary: 'Check whether a product slug is available for admin create/edit' }),
__param(0, (0, common_1.Query)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [check_product_slug_dto_1.CheckProductSlugDto]),
__metadata("design:returntype", void 0)
], AdminProductsController.prototype, "checkSlug", null);
__decorate([
(0, common_1.Get)('reviews/list'),
(0, swagger_1.ApiOperation)({ summary: 'List product reviews for moderation' }),
__param(0, (0, common_1.Query)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [filter_product_reviews_dto_1.FilterProductReviewsDto]),
__metadata("design:returntype", void 0)
], AdminProductsController.prototype, "findReviews", null);
__decorate([
(0, common_1.Patch)('reviews/:reviewId'),
(0, swagger_1.ApiOperation)({ summary: 'Approve or pin a product review' }),
__param(0, (0, common_1.Param)('reviewId')),
__param(1, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, moderate_product_review_dto_1.ModerateProductReviewDto]),
__metadata("design:returntype", void 0)
], AdminProductsController.prototype, "updateReview", null);
__decorate([
(0, common_1.Delete)('reviews/:reviewId'),
(0, swagger_1.ApiOperation)({ summary: 'Delete a product review' }),
__param(0, (0, common_1.Param)('reviewId')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], AdminProductsController.prototype, "removeReview", null);
__decorate([
(0, common_1.Get)(':id'),
(0, swagger_1.ApiOperation)({ summary: 'Get one product for admin panel' }),
__param(0, (0, common_1.Param)('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], AdminProductsController.prototype, "findOne", null);
__decorate([
(0, common_1.Patch)(':id'),
(0, swagger_1.ApiOperation)({ summary: 'Update a product for admin panel' }),
(0, swagger_1.ApiConsumes)('multipart/form-data'),
(0, swagger_1.ApiBody)({ type: update_product_dto_1.UpdateProductDto }),
(0, common_1.UseInterceptors)((0, platform_express_1.FileFieldsInterceptor)([
{ name: 'mainImage', maxCount: 1 },
{ name: 'images', maxCount: 10 },
{ name: 'model3d', maxCount: 1 },
])),
__param(0, (0, common_1.Param)('id')),
__param(1, (0, common_1.Body)()),
__param(2, (0, common_1.UploadedFiles)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, update_product_dto_1.UpdateProductDto, Object]),
__metadata("design:returntype", void 0)
], AdminProductsController.prototype, "update", null);
__decorate([
(0, common_1.Delete)(':id'),
(0, swagger_1.ApiOperation)({ summary: 'Delete a product and its assets' }),
__param(0, (0, common_1.Param)('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], AdminProductsController.prototype, "remove", null);
exports.AdminProductsController = AdminProductsController = __decorate([
(0, swagger_1.ApiTags)('Admin Products'),
(0, swagger_1.ApiBearerAuth)(),
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard, roles_guard_1.RolesGuard, permissions_guard_1.PermissionsGuard),
(0, roles_decorator_1.Roles)(user_role_enum_1.UserRole.ADMIN),
(0, permissions_decorator_1.Permissions)('products.manage'),
(0, common_1.Controller)('admin/products'),
__metadata("design:paramtypes", [products_service_1.ProductsService])
], AdminProductsController);
//# sourceMappingURL=admin-products.controller.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"admin-products.controller.js","sourceRoot":"","sources":["../../../src/modules/catalog/admin-products.controller.ts"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AAK,CAAC;IACb,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,iCAAiC,EAAE,CAAC;IACrD,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;qDAElB;kCA7FU,uBAAuB;IANnC,IAAA,iBAAO,EAAC,gBAAgB,CAAC;IACzB,IAAA,uBAAa,GAAE;IACf,IAAA,kBAAS,EAAC,6BAAY,EAAE,wBAAU,EAAE,oCAAgB,CAAC;IACrD,IAAA,uBAAK,EAAC,yBAAQ,CAAC,KAAK,CAAC;IACrB,IAAA,mCAAW,EAAC,iBAAiB,CAAC;IAC9B,IAAA,mBAAU,EAAC,gBAAgB,CAAC;qCAEmB,kCAAe;GADlD,uBAAuB,CA8FnC"}

View File

@@ -0,0 +1,13 @@
import { CreateAttributeDefinitionDto } from './dto/create-attribute-definition.dto';
import { UpdateAttributeDefinitionDto } from './dto/update-attribute-definition.dto';
import { ProductsService } from './products.service';
export declare class AttributeDefinitionsController {
private readonly productsService;
constructor(productsService: ProductsService);
findAll(): Promise<import("./entities/attribute-definition.entity").AttributeDefinition[]>;
create(dto: CreateAttributeDefinitionDto): Promise<import("./entities/attribute-definition.entity").AttributeDefinition>;
update(id: string, dto: UpdateAttributeDefinitionDto): Promise<import("./entities/attribute-definition.entity").AttributeDefinition>;
remove(id: string): Promise<{
message: string;
}>;
}

View File

@@ -0,0 +1,87 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AttributeDefinitionsController = void 0;
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const permissions_decorator_1 = require("../../common/decorators/permissions.decorator");
const roles_decorator_1 = require("../../common/decorators/roles.decorator");
const permissions_guard_1 = require("../../common/guards/permissions.guard");
const roles_guard_1 = require("../../common/guards/roles.guard");
const jwt_auth_guard_1 = require("../auth/guards/jwt-auth.guard");
const user_role_enum_1 = require("../users/enums/user-role.enum");
const create_attribute_definition_dto_1 = require("./dto/create-attribute-definition.dto");
const update_attribute_definition_dto_1 = require("./dto/update-attribute-definition.dto");
const products_service_1 = require("./products.service");
let AttributeDefinitionsController = class AttributeDefinitionsController {
productsService;
constructor(productsService) {
this.productsService = productsService;
}
findAll() {
return this.productsService.listAttributeDefinitions();
}
create(dto) {
return this.productsService.createAttributeDefinition(dto);
}
update(id, dto) {
return this.productsService.updateAttributeDefinition(id, dto);
}
remove(id) {
return this.productsService.removeAttributeDefinition(id);
}
};
exports.AttributeDefinitionsController = AttributeDefinitionsController;
__decorate([
(0, common_1.Get)(),
(0, swagger_1.ApiOperation)({ summary: 'List reusable product attribute definitions' }),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], AttributeDefinitionsController.prototype, "findAll", null);
__decorate([
(0, common_1.Post)(),
(0, swagger_1.ApiOperation)({ summary: 'Create reusable product attribute definition' }),
__param(0, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [create_attribute_definition_dto_1.CreateAttributeDefinitionDto]),
__metadata("design:returntype", void 0)
], AttributeDefinitionsController.prototype, "create", null);
__decorate([
(0, common_1.Patch)(':id'),
(0, swagger_1.ApiOperation)({ summary: 'Update reusable product attribute definition' }),
__param(0, (0, common_1.Param)('id')),
__param(1, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, update_attribute_definition_dto_1.UpdateAttributeDefinitionDto]),
__metadata("design:returntype", void 0)
], AttributeDefinitionsController.prototype, "update", null);
__decorate([
(0, common_1.Delete)(':id'),
(0, swagger_1.ApiOperation)({ summary: 'Delete reusable product attribute definition' }),
__param(0, (0, common_1.Param)('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], AttributeDefinitionsController.prototype, "remove", null);
exports.AttributeDefinitionsController = AttributeDefinitionsController = __decorate([
(0, swagger_1.ApiTags)('Admin Product Attributes'),
(0, swagger_1.ApiBearerAuth)(),
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard, roles_guard_1.RolesGuard, permissions_guard_1.PermissionsGuard),
(0, roles_decorator_1.Roles)(user_role_enum_1.UserRole.ADMIN),
(0, permissions_decorator_1.Permissions)('products.manage'),
(0, common_1.Controller)('admin/product-attributes'),
__metadata("design:paramtypes", [products_service_1.ProductsService])
], AttributeDefinitionsController);
//# sourceMappingURL=attribute-definitions.controller.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"attribute-definitions.controller.js","sourceRoot":"","sources":["../../../src/modules/catalog/attribute-definitions.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CASwB;AACxB,6CAAuE;AACvE,yFAA4E;AAC5E,6EAAgE;AAChE,6EAAyE;AACzE,iEAA6D;AAC7D,kEAA6D;AAC7D,kEAAyD;AACzD,2FAAqF;AACrF,2FAAqF;AACrF,yDAAqD;AAQ9C,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IACZ;IAA7B,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAIjE,OAAO;QACL,OAAO,IAAI,CAAC,eAAe,CAAC,wBAAwB,EAAE,CAAC;IACzD,CAAC;IAID,MAAM,CAAS,GAAiC;QAC9C,OAAO,IAAI,CAAC,eAAe,CAAC,yBAAyB,CAAC,GAAG,CAAC,C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}

View File

@@ -0,0 +1,18 @@
import { BrandService } from './brand.service';
import { CreateBrandDto } from './dto/create-brand.dto';
import { UpdateBrandDto } from './dto/update-brand.dto';
export declare class BrandController {
private readonly brandService;
constructor(brandService: BrandService);
create(dto: CreateBrandDto, files: {
image?: Express.Multer.File[];
}): Promise<import("./entities/brand.entity").Brand>;
findAll(): Promise<import("./entities/brand.entity").Brand[]>;
findOne(id: string): Promise<import("./entities/brand.entity").Brand>;
update(id: string, dto: UpdateBrandDto, files: {
image?: Express.Multer.File[];
}): Promise<import("./entities/brand.entity").Brand>;
remove(id: string): Promise<{
message: string;
}>;
}

112
dist/modules/catalog/brand.controller.js vendored Normal file
View File

@@ -0,0 +1,112 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BrandController = void 0;
const common_1 = require("@nestjs/common");
const platform_express_1 = require("@nestjs/platform-express");
const swagger_1 = require("@nestjs/swagger");
const permissions_decorator_1 = require("../../common/decorators/permissions.decorator");
const roles_decorator_1 = require("../../common/decorators/roles.decorator");
const permissions_guard_1 = require("../../common/guards/permissions.guard");
const roles_guard_1 = require("../../common/guards/roles.guard");
const jwt_auth_guard_1 = require("../auth/guards/jwt-auth.guard");
const user_role_enum_1 = require("../users/enums/user-role.enum");
const brand_service_1 = require("./brand.service");
const create_brand_dto_1 = require("./dto/create-brand.dto");
const update_brand_dto_1 = require("./dto/update-brand.dto");
let BrandController = class BrandController {
brandService;
constructor(brandService) {
this.brandService = brandService;
}
create(dto, files) {
return this.brandService.create(dto, files);
}
findAll() {
return this.brandService.findAll();
}
findOne(id) {
return this.brandService.findOne(id);
}
update(id, dto, files) {
return this.brandService.update(id, dto, files);
}
remove(id) {
return this.brandService.remove(id);
}
};
exports.BrandController = BrandController;
__decorate([
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard, roles_guard_1.RolesGuard, permissions_guard_1.PermissionsGuard),
(0, swagger_1.ApiBearerAuth)(),
(0, roles_decorator_1.Roles)(user_role_enum_1.UserRole.ADMIN),
(0, permissions_decorator_1.Permissions)('brands.manage'),
(0, common_1.Post)(),
(0, swagger_1.ApiOperation)({ summary: 'Create brand with optional uploaded or existing image' }),
(0, swagger_1.ApiConsumes)('multipart/form-data'),
(0, swagger_1.ApiBody)({ type: create_brand_dto_1.CreateBrandDto }),
(0, common_1.UseInterceptors)((0, platform_express_1.FileFieldsInterceptor)([{ name: 'image', maxCount: 1 }])),
__param(0, (0, common_1.Body)()),
__param(1, (0, common_1.UploadedFiles)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [create_brand_dto_1.CreateBrandDto, Object]),
__metadata("design:returntype", void 0)
], BrandController.prototype, "create", null);
__decorate([
(0, common_1.Get)(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], BrandController.prototype, "findAll", null);
__decorate([
(0, common_1.Get)(':id'),
__param(0, (0, common_1.Param)('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], BrandController.prototype, "findOne", null);
__decorate([
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard, roles_guard_1.RolesGuard, permissions_guard_1.PermissionsGuard),
(0, swagger_1.ApiBearerAuth)(),
(0, roles_decorator_1.Roles)(user_role_enum_1.UserRole.ADMIN),
(0, permissions_decorator_1.Permissions)('brands.manage'),
(0, common_1.Patch)(':id'),
(0, swagger_1.ApiOperation)({ summary: 'Update brand and brand image' }),
(0, swagger_1.ApiConsumes)('multipart/form-data'),
(0, swagger_1.ApiBody)({ type: update_brand_dto_1.UpdateBrandDto }),
(0, common_1.UseInterceptors)((0, platform_express_1.FileFieldsInterceptor)([{ name: 'image', maxCount: 1 }])),
__param(0, (0, common_1.Param)('id')),
__param(1, (0, common_1.Body)()),
__param(2, (0, common_1.UploadedFiles)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, update_brand_dto_1.UpdateBrandDto, Object]),
__metadata("design:returntype", void 0)
], BrandController.prototype, "update", null);
__decorate([
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard, roles_guard_1.RolesGuard, permissions_guard_1.PermissionsGuard),
(0, swagger_1.ApiBearerAuth)(),
(0, roles_decorator_1.Roles)(user_role_enum_1.UserRole.ADMIN),
(0, permissions_decorator_1.Permissions)('brands.manage'),
(0, common_1.Delete)(':id'),
__param(0, (0, common_1.Param)('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], BrandController.prototype, "remove", null);
exports.BrandController = BrandController = __decorate([
(0, swagger_1.ApiTags)('Brands'),
(0, common_1.Controller)('brands'),
__metadata("design:paramtypes", [brand_service_1.BrandService])
], BrandController);
//# sourceMappingURL=brand.controller.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"brand.controller.js","sourceRoot":"","sources":["../../../src/modules/catalog/brand.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAWwB;AACxB,+DAAiE;AACjE,6CAMyB;AACzB,yFAA4E;AAC5E,6EAAgE;AAChE,6EAAyE;AACzE,iEAA6D;AAC7D,kEAA6D;AAC7D,kEAAyD;AACzD,mDAA+C;AAC/C,6DAAwD;AACxD,6DAAwD;AAIjD,IAAM,eAAe,GAArB,MAAM,eAAe;IACG;IAA7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ules/catalog/brand.service.d.ts vendored Normal file
View File

@@ -0,0 +1,22 @@
import { Repository } from 'typeorm';
import { StorageService } from '../storage/storage.service';
import { CreateBrandDto } from './dto/create-brand.dto';
import { UpdateBrandDto } from './dto/update-brand.dto';
import { Brand } from './entities/brand.entity';
export declare class BrandService {
private readonly brandsRepository;
private readonly storageService;
constructor(brandsRepository: Repository<Brand>, storageService: StorageService);
create(dto: CreateBrandDto, files?: {
image?: Express.Multer.File[];
}): Promise<Brand>;
findAll(): Promise<Brand[]>;
findOne(id: string): Promise<Brand>;
update(id: string, dto: UpdateBrandDto, files?: {
image?: Express.Multer.File[];
}): Promise<Brand>;
remove(id: string): Promise<{
message: string;
}>;
private replaceImage;
}

89
dist/modules/catalog/brand.service.js vendored Normal file
View File

@@ -0,0 +1,89 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BrandService = void 0;
const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const typeorm_2 = require("typeorm");
const storage_service_1 = require("../storage/storage.service");
const brand_entity_1 = require("./entities/brand.entity");
let BrandService = class BrandService {
brandsRepository;
storageService;
constructor(brandsRepository, storageService) {
this.brandsRepository = brandsRepository;
this.storageService = storageService;
}
async create(dto, files) {
const imageUpload = files?.image?.[0]
? await this.storageService.uploadPublicFile(files.image[0], 'brands')
: null;
const brand = this.brandsRepository.create({
name: dto.name,
slug: dto.slug,
imageUrl: imageUpload?.url ?? dto.existingImageUrl ?? null,
type: dto.type,
});
return this.brandsRepository.save(brand);
}
findAll() {
return this.brandsRepository.find({
order: { createdAt: 'DESC' },
});
}
async findOne(id) {
const brand = await this.brandsRepository.findOne({ where: { id } });
if (!brand) {
throw new common_1.NotFoundException('Brand not found');
}
return brand;
}
async update(id, dto, files) {
const brand = await this.findOne(id);
if (files?.image?.[0]) {
const imageUpload = await this.storageService.uploadPublicFile(files.image[0], 'brands');
await this.replaceImage(brand.imageUrl, imageUpload.url);
brand.imageUrl = imageUpload.url;
}
else if (dto.existingImageUrl !== undefined) {
await this.replaceImage(brand.imageUrl, dto.existingImageUrl || null);
brand.imageUrl = dto.existingImageUrl || null;
}
Object.assign(brand, {
name: dto.name ?? brand.name,
slug: dto.slug ?? brand.slug,
type: dto.type ?? brand.type,
});
return this.brandsRepository.save(brand);
}
async remove(id) {
const brand = await this.findOne(id);
await this.storageService.deletePublicFileByUrl(brand.imageUrl);
await this.brandsRepository.remove(brand);
return { message: 'Brand deleted successfully' };
}
async replaceImage(currentUrl, nextUrl) {
if (currentUrl && currentUrl !== nextUrl) {
await this.storageService.deletePublicFileByUrl(currentUrl);
}
}
};
exports.BrandService = BrandService;
exports.BrandService = BrandService = __decorate([
(0, common_1.Injectable)(),
__param(0, (0, typeorm_1.InjectRepository)(brand_entity_1.Brand)),
__metadata("design:paramtypes", [typeorm_2.Repository,
storage_service_1.StorageService])
], BrandService);
//# sourceMappingURL=brand.service.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"brand.service.js","sourceRoot":"","sources":["../../../src/modules/catalog/brand.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAGwB;AACxB,6CAAmD;AACnD,qCAAqC;AACrC,gEAA4D;AAG5D,0DAAgD;AAGzC,IAAM,YAAY,GAAlB,MAAM,YAAY;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C,KAAK,CAAC,CAAC;QAC1C,OAAO,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;IACnD,CAAC;IAEO,KAAK,CAAC,YAAY,CAAC,UAA0B,EAAE,OAAuB;QAC5E,IAAI,UAAU,IAAI,UAAU,KAAK,OAAO,EAAE,CAAC;YACzC,MAAM,IAAI,CAAC,cAAc,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;CACF,CAAA;AAzEY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,oBAAK,CAAC,CAAA;qCACW,oBAAU;QACZ,gCAAc;GAJtC,YAAY,CAyExB"}

View File

@@ -0,0 +1,2 @@
export declare class CatalogModule {
}

56
dist/modules/catalog/catalog.module.js vendored Normal file
View File

@@ -0,0 +1,56 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CatalogModule = void 0;
const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const storage_module_1 = require("../storage/storage.module");
const admin_products_controller_1 = require("./admin-products.controller");
const attribute_definitions_controller_1 = require("./attribute-definitions.controller");
const brand_controller_1 = require("./brand.controller");
const brand_service_1 = require("./brand.service");
const category_controller_1 = require("./category.controller");
const category_service_1 = require("./category.service");
const attribute_definition_entity_1 = require("./entities/attribute-definition.entity");
const brand_entity_1 = require("./entities/brand.entity");
const category_entity_1 = require("./entities/category.entity");
const product_attribute_value_entity_1 = require("./entities/product-attribute-value.entity");
const product_meta_entity_1 = require("./entities/product-meta.entity");
const product_entity_1 = require("./entities/product.entity");
const product_review_entity_1 = require("./entities/product-review.entity");
const products_controller_1 = require("./products.controller");
const products_service_1 = require("./products.service");
let CatalogModule = class CatalogModule {
};
exports.CatalogModule = CatalogModule;
exports.CatalogModule = CatalogModule = __decorate([
(0, common_1.Module)({
imports: [
typeorm_1.TypeOrmModule.forFeature([
category_entity_1.Category,
brand_entity_1.Brand,
product_entity_1.Product,
product_review_entity_1.ProductReview,
product_meta_entity_1.ProductMeta,
attribute_definition_entity_1.AttributeDefinition,
product_attribute_value_entity_1.ProductAttributeValue,
]),
storage_module_1.StorageModule,
],
controllers: [
category_controller_1.CategoryController,
brand_controller_1.BrandController,
products_controller_1.ProductsController,
admin_products_controller_1.AdminProductsController,
attribute_definitions_controller_1.AttributeDefinitionsController,
],
providers: [category_service_1.CategoryService, brand_service_1.BrandService, products_service_1.ProductsService],
exports: [typeorm_1.TypeOrmModule, category_service_1.CategoryService, brand_service_1.BrandService, products_service_1.ProductsService],
})
], CatalogModule);
//# sourceMappingURL=catalog.module.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"catalog.module.js","sourceRoot":"","sources":["../../../src/modules/catalog/catalog.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,8DAA0D;AAC1D,2EAAsE;AACtE,yFAAoF;AACpF,yDAAqD;AACrD,mDAA+C;AAC/C,+DAA2D;AAC3D,yDAAqD;AACrD,wFAA6E;AAC7E,0DAAgD;AAChD,gEAAsD;AACtD,8FAAkF;AAClF,wEAA6D;AAC7D,8DAAoD;AACpD,4EAAiE;AACjE,+DAA2D;AAC3D,yDAAqD;AAyB9C,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IAvBzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,uBAAa,CAAC,UAAU,CAAC;gBACvB,0BAAQ;gBACR,oBAAK;gBACL,wBAAO;gBACP,qCAAa;gBACb,iCAAW;gBACX,iDAAmB;gBACnB,sDAAqB;aACtB,CAAC;YACF,8BAAa;SACd;QACD,WAAW,EAAE;YACX,wCAAkB;YAClB,kCAAe;YACf,wCAAkB;YAClB,mDAAuB;YACvB,iEAA8B;SAC/B;QACD,SAAS,EAAE,CAAC,kCAAe,EAAE,4BAAY,EAAE,kCAAe,CAAC;QAC3D,OAAO,EAAE,CAAC,uBAAa,EAAE,kCAAe,EAAE,4BAAY,EAAE,kCAAe,CAAC;KACzE,CAAC;GACW,aAAa,CAAG"}

View File

@@ -0,0 +1,18 @@
import { CategoryService } from './category.service';
import { CreateCategoryDto } from './dto/create-category.dto';
import { UpdateCategoryDto } from './dto/update-category.dto';
export declare class CategoryController {
private readonly categoryService;
constructor(categoryService: CategoryService);
create(dto: CreateCategoryDto, files: {
image?: Express.Multer.File[];
}): Promise<import("./entities/category.entity").Category>;
findAll(): Promise<import("./entities/category.entity").Category[]>;
findOne(id: string): Promise<import("./entities/category.entity").Category>;
update(id: string, dto: UpdateCategoryDto, files: {
image?: Express.Multer.File[];
}): Promise<import("./entities/category.entity").Category>;
remove(id: string): Promise<{
message: string;
}>;
}

View File

@@ -0,0 +1,112 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CategoryController = void 0;
const common_1 = require("@nestjs/common");
const platform_express_1 = require("@nestjs/platform-express");
const swagger_1 = require("@nestjs/swagger");
const permissions_decorator_1 = require("../../common/decorators/permissions.decorator");
const roles_decorator_1 = require("../../common/decorators/roles.decorator");
const permissions_guard_1 = require("../../common/guards/permissions.guard");
const roles_guard_1 = require("../../common/guards/roles.guard");
const jwt_auth_guard_1 = require("../auth/guards/jwt-auth.guard");
const user_role_enum_1 = require("../users/enums/user-role.enum");
const category_service_1 = require("./category.service");
const create_category_dto_1 = require("./dto/create-category.dto");
const update_category_dto_1 = require("./dto/update-category.dto");
let CategoryController = class CategoryController {
categoryService;
constructor(categoryService) {
this.categoryService = categoryService;
}
create(dto, files) {
return this.categoryService.create(dto, files);
}
findAll() {
return this.categoryService.findAll();
}
findOne(id) {
return this.categoryService.findOne(id);
}
update(id, dto, files) {
return this.categoryService.update(id, dto, files);
}
remove(id) {
return this.categoryService.remove(id);
}
};
exports.CategoryController = CategoryController;
__decorate([
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard, roles_guard_1.RolesGuard, permissions_guard_1.PermissionsGuard),
(0, swagger_1.ApiBearerAuth)(),
(0, roles_decorator_1.Roles)(user_role_enum_1.UserRole.ADMIN),
(0, permissions_decorator_1.Permissions)('categories.manage'),
(0, common_1.Post)(),
(0, swagger_1.ApiOperation)({ summary: 'Create category with optional uploaded or existing image' }),
(0, swagger_1.ApiConsumes)('multipart/form-data'),
(0, swagger_1.ApiBody)({ type: create_category_dto_1.CreateCategoryDto }),
(0, common_1.UseInterceptors)((0, platform_express_1.FileFieldsInterceptor)([{ name: 'image', maxCount: 1 }])),
__param(0, (0, common_1.Body)()),
__param(1, (0, common_1.UploadedFiles)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [create_category_dto_1.CreateCategoryDto, Object]),
__metadata("design:returntype", void 0)
], CategoryController.prototype, "create", null);
__decorate([
(0, common_1.Get)(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], CategoryController.prototype, "findAll", null);
__decorate([
(0, common_1.Get)(':id'),
__param(0, (0, common_1.Param)('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], CategoryController.prototype, "findOne", null);
__decorate([
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard, roles_guard_1.RolesGuard, permissions_guard_1.PermissionsGuard),
(0, swagger_1.ApiBearerAuth)(),
(0, roles_decorator_1.Roles)(user_role_enum_1.UserRole.ADMIN),
(0, permissions_decorator_1.Permissions)('categories.manage'),
(0, common_1.Patch)(':id'),
(0, swagger_1.ApiOperation)({ summary: 'Update category and category image' }),
(0, swagger_1.ApiConsumes)('multipart/form-data'),
(0, swagger_1.ApiBody)({ type: update_category_dto_1.UpdateCategoryDto }),
(0, common_1.UseInterceptors)((0, platform_express_1.FileFieldsInterceptor)([{ name: 'image', maxCount: 1 }])),
__param(0, (0, common_1.Param)('id')),
__param(1, (0, common_1.Body)()),
__param(2, (0, common_1.UploadedFiles)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, update_category_dto_1.UpdateCategoryDto, Object]),
__metadata("design:returntype", void 0)
], CategoryController.prototype, "update", null);
__decorate([
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard, roles_guard_1.RolesGuard, permissions_guard_1.PermissionsGuard),
(0, swagger_1.ApiBearerAuth)(),
(0, roles_decorator_1.Roles)(user_role_enum_1.UserRole.ADMIN),
(0, permissions_decorator_1.Permissions)('categories.manage'),
(0, common_1.Delete)(':id'),
__param(0, (0, common_1.Param)('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], CategoryController.prototype, "remove", null);
exports.CategoryController = CategoryController = __decorate([
(0, swagger_1.ApiTags)('Categories'),
(0, common_1.Controller)('categories'),
__metadata("design:paramtypes", [category_service_1.CategoryService])
], CategoryController);
//# sourceMappingURL=category.controller.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"category.controller.js","sourceRoot":"","sources":["../../../src/modules/catalog/category.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAWwB;AACxB,+DAAiE;AACjE,6CAMyB;AACzB,yFAA4E;AAC5E,6EAAgE;AAChE,6EAAyE;AACzE,iEAA6D;AAC7D,kEAA6D;AAC7D,kEAAyD;AACzD,yDAAqD;AACrD,mEAA8D;AAC9D,mEAA8D;AAIvD,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IACA;IAA7B,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAWjE,MAAM,CACI,GAAsB,EACb,KAAwC;QAEzD,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;IAGD,OAAO;QACL,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;IACxC,CAAC;IAGD,OAAO,CAAc,EAAU;QAC7B,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC;IAWD,MAAM,CACS,EAAU,EACf,GAAsB,EACb,KAAwC;QAEzD,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACrD,CAAC;IAOD,MAAM,CAAc,EAAU;QAC5B,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACzC,CAAC;CACF,CAAA;AAtDY,gDAAkB;AAY7B;IATC,IAAA,kBAAS,EAAC,6BAAY,EAAE,wBAAU,EAAE,oCAAgB,CAAC;IACrD,IAAA,uBAAa,GAAE;IACf,IAAA,uBAAK,EAAC,yBAAQ,CAAC,KAAK,CAAC;IACrB,IAAA,mCAAW,EAAC,mBAAmB,CAAC;IAChC,IAAA,aAAI,GAAE;I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,wBAAU,EAAE,oCAAgB,CAAC;IACrD,IAAA,uBAAa,GAAE;IACf,IAAA,uBAAK,EAAC,yBAAQ,CAAC,KAAK,CAAC;IACrB,IAAA,mCAAW,EAAC,mBAAmB,CAAC;IAChC,IAAA,eAAM,EAAC,KAAK,CAAC;IACN,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;gDAElB;6BArDU,kBAAkB;IAF9B,IAAA,iBAAO,EAAC,YAAY,CAAC;IACrB,IAAA,mBAAU,EAAC,YAAY,CAAC;qCAEuB,kCAAe;GADlD,kBAAkB,CAsD9B"}

View File

@@ -0,0 +1,22 @@
import { Repository } from 'typeorm';
import { StorageService } from '../storage/storage.service';
import { CreateCategoryDto } from './dto/create-category.dto';
import { UpdateCategoryDto } from './dto/update-category.dto';
import { Category } from './entities/category.entity';
export declare class CategoryService {
private readonly categoriesRepository;
private readonly storageService;
constructor(categoriesRepository: Repository<Category>, storageService: StorageService);
create(dto: CreateCategoryDto, files?: {
image?: Express.Multer.File[];
}): Promise<Category>;
findAll(): Promise<Category[]>;
findOne(id: string): Promise<Category>;
update(id: string, dto: UpdateCategoryDto, files?: {
image?: Express.Multer.File[];
}): Promise<Category>;
remove(id: string): Promise<{
message: string;
}>;
private replaceImage;
}

117
dist/modules/catalog/category.service.js vendored Normal file
View File

@@ -0,0 +1,117 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CategoryService = void 0;
const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const typeorm_2 = require("typeorm");
const storage_service_1 = require("../storage/storage.service");
const category_entity_1 = require("./entities/category.entity");
let CategoryService = class CategoryService {
categoriesRepository;
storageService;
constructor(categoriesRepository, storageService) {
this.categoriesRepository = categoriesRepository;
this.storageService = storageService;
}
async create(dto, files) {
const parent = dto.parentId
? await this.categoriesRepository.findOne({ where: { id: dto.parentId } })
: null;
if (dto.parentId && !parent) {
throw new common_1.NotFoundException('Parent category not found');
}
if (parent && parent.type !== dto.type) {
throw new common_1.BadRequestException('Child category type must match parent category type');
}
const imageUpload = files?.image?.[0]
? await this.storageService.uploadPublicFile(files.image[0], 'categories')
: null;
const category = this.categoriesRepository.create({
name: dto.name,
slug: dto.slug,
imageUrl: imageUpload?.url ?? dto.existingImageUrl ?? null,
type: dto.type,
parent,
});
return this.categoriesRepository.save(category);
}
findAll() {
return this.categoriesRepository.find({
relations: { parent: true, children: true },
order: { createdAt: 'DESC' },
});
}
async findOne(id) {
const category = await this.categoriesRepository.findOne({
where: { id },
relations: { parent: true, children: true },
});
if (!category) {
throw new common_1.NotFoundException('Category not found');
}
return category;
}
async update(id, dto, files) {
const category = await this.findOne(id);
let parent = category.parent ?? null;
if (dto.parentId !== undefined) {
parent = dto.parentId
? await this.categoriesRepository.findOne({ where: { id: dto.parentId } })
: null;
if (dto.parentId && !parent) {
throw new common_1.NotFoundException('Parent category not found');
}
}
const nextType = dto.type ?? category.type;
if (parent && parent.type !== nextType) {
throw new common_1.BadRequestException('Child category type must match parent category type');
}
if (files?.image?.[0]) {
const imageUpload = await this.storageService.uploadPublicFile(files.image[0], 'categories');
await this.replaceImage(category.imageUrl, imageUpload.url);
category.imageUrl = imageUpload.url;
}
else if (dto.existingImageUrl !== undefined) {
await this.replaceImage(category.imageUrl, dto.existingImageUrl || null);
category.imageUrl = dto.existingImageUrl || null;
}
Object.assign(category, {
name: dto.name ?? category.name,
slug: dto.slug ?? category.slug,
type: nextType,
parent,
});
return this.categoriesRepository.save(category);
}
async remove(id) {
const category = await this.findOne(id);
await this.storageService.deletePublicFileByUrl(category.imageUrl);
await this.categoriesRepository.remove(category);
return { message: 'Category deleted successfully' };
}
async replaceImage(currentUrl, nextUrl) {
if (currentUrl && currentUrl !== nextUrl) {
await this.storageService.deletePublicFileByUrl(currentUrl);
}
}
};
exports.CategoryService = CategoryService;
exports.CategoryService = CategoryService = __decorate([
(0, common_1.Injectable)(),
__param(0, (0, typeorm_1.InjectRepository)(category_entity_1.Category)),
__metadata("design:paramtypes", [typeorm_2.Repository,
storage_service_1.StorageService])
], CategoryService);
//# sourceMappingURL=category.service.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"category.service.js","sourceRoot":"","sources":["../../../src/modules/catalog/category.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAIwB;AACxB,6CAAmD;AACnD,qCAAqC;AACrC,gEAA4D;AAG5D,gEAAsD;AAG/C,IAAM,eAAe,GAArB,MAAM,eAAe;IAGP;IACA;IAHnB,YAEmB,oBAA0C,EAC1C,cAA8B;QAD9B,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,mBAAc,GAAd,cAAc,CAAgB;IAC9C,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,GAAsB,EAAE,KAAyC;QAC5E,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ;YACzB,CAAC,CAAC,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC;YAC1E,CAAC,CAAC,IAAI,CAAC;QAET,IAAI,GAAG,CAAC,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;YAC5B,MAAM,IAAI,0BAAiB,CAAC,2BAA2B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JtC,eAAe,CAgH3B"}

View File

@@ -0,0 +1,4 @@
export declare class CheckProductSlugDto {
slug: string;
excludeId?: string;
}

View File

@@ -0,0 +1,32 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CheckProductSlugDto = void 0;
const swagger_1 = require("@nestjs/swagger");
const class_validator_1 = require("class-validator");
class CheckProductSlugDto {
slug;
excludeId;
}
exports.CheckProductSlugDto = CheckProductSlugDto;
__decorate([
(0, swagger_1.ApiProperty)({ example: 'skf-6006-2rs' }),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(180),
__metadata("design:type", String)
], CheckProductSlugDto.prototype, "slug", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: '8dd5d8c7-8a74-4925-894f-6f4a95a83184' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsUUID)(),
__metadata("design:type", String)
], CheckProductSlugDto.prototype, "excludeId", void 0);
//# sourceMappingURL=check-product-slug.dto.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"check-product-slug.dto.js","sourceRoot":"","sources":["../../../../src/modules/catalog/dto/check-product-slug.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAmE;AACnE,qDAA0E;AAE1E,MAAa,mBAAmB;IAI9B,IAAI,CAAS;IAKb,SAAS,CAAU;CACpB;AAVD,kDAUC;AANC;IAHC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IACxC,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,GAAG,CAAC;;iDACF;AAKb;IAHC,IAAA,6BAAmB,EAAC,EAAE,OAAO,EAAE,sCAAsC,EAAE,CAAC;IACxE,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,GAAE;;sDACU"}

View File

@@ -0,0 +1,10 @@
import { AttributeDataType } from '../enums/attribute-data-type.enum';
export declare class CreateAttributeDefinitionDto {
name: string;
slug: string;
dataType: AttributeDataType;
unit?: string;
options?: string[];
isFilterable?: boolean;
isVisible?: boolean;
}

View File

@@ -0,0 +1,74 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateAttributeDefinitionDto = void 0;
const swagger_1 = require("@nestjs/swagger");
const class_transformer_1 = require("class-transformer");
const class_validator_1 = require("class-validator");
const json_transform_util_1 = require("../../../common/utils/json-transform.util");
const attribute_data_type_enum_1 = require("../enums/attribute-data-type.enum");
class CreateAttributeDefinitionDto {
name;
slug;
dataType;
unit;
options;
isFilterable;
isVisible;
}
exports.CreateAttributeDefinitionDto = CreateAttributeDefinitionDto;
__decorate([
(0, swagger_1.ApiProperty)({ example: 'Weight' }),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(120),
__metadata("design:type", String)
], CreateAttributeDefinitionDto.prototype, "name", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: 'weight' }),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(140),
__metadata("design:type", String)
], CreateAttributeDefinitionDto.prototype, "slug", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ enum: attribute_data_type_enum_1.AttributeDataType }),
(0, class_validator_1.IsEnum)(attribute_data_type_enum_1.AttributeDataType),
__metadata("design:type", String)
], CreateAttributeDefinitionDto.prototype, "dataType", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 'kg' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(50),
__metadata("design:type", String)
], CreateAttributeDefinitionDto.prototype, "unit", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ type: [String] }),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(json_transform_util_1.parseJsonValue),
(0, class_validator_1.IsArray)(),
(0, class_validator_1.IsString)({ each: true }),
__metadata("design:type", Array)
], CreateAttributeDefinitionDto.prototype, "options", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: true }),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(({ value }) => typeof value === 'boolean' ? value : String(value).toLowerCase() === 'true'),
(0, class_validator_1.IsBoolean)(),
__metadata("design:type", Boolean)
], CreateAttributeDefinitionDto.prototype, "isFilterable", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: true }),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(({ value }) => typeof value === 'boolean' ? value : String(value).toLowerCase() === 'true'),
(0, class_validator_1.IsBoolean)(),
__metadata("design:type", Boolean)
], CreateAttributeDefinitionDto.prototype, "isVisible", void 0);
//# sourceMappingURL=create-attribute-definition.dto.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"create-attribute-definition.dto.js","sourceRoot":"","sources":["../../../../src/modules/catalog/dto/create-att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,EAAE,EAAE,CACvB,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,CAC5E;IACA,IAAA,2BAAS,GAAE;;kEACW;AAQvB;IANC,IAAA,6BAAmB,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACtC,IAAA,4BAAU,GAAE;IACZ,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CACvB,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,CAC5E;IACA,IAAA,2BAAS,GAAE;;+DACQ"}

View File

@@ -0,0 +1,7 @@
import { ProductType } from '../enums/product-type.enum';
export declare class CreateBrandDto {
name: string;
slug: string;
existingImageUrl?: string;
type: ProductType;
}

View File

@@ -0,0 +1,49 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateBrandDto = void 0;
const swagger_1 = require("@nestjs/swagger");
const class_validator_1 = require("class-validator");
const product_type_enum_1 = require("../enums/product-type.enum");
class CreateBrandDto {
name;
slug;
existingImageUrl;
type;
}
exports.CreateBrandDto = CreateBrandDto;
__decorate([
(0, swagger_1.ApiProperty)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MinLength)(2),
(0, class_validator_1.MaxLength)(150),
__metadata("design:type", String)
], CreateBrandDto.prototype, "name", void 0);
__decorate([
(0, swagger_1.ApiProperty)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MinLength)(2),
(0, class_validator_1.MaxLength)(180),
__metadata("design:type", String)
], CreateBrandDto.prototype, "slug", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 'https://cdn.example.com/media/image/root/brand.jpg' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(500),
__metadata("design:type", String)
], CreateBrandDto.prototype, "existingImageUrl", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ enum: product_type_enum_1.ProductType }),
(0, class_validator_1.IsEnum)(product_type_enum_1.ProductType),
__metadata("design:type", String)
], CreateBrandDto.prototype, "type", void 0);
//# sourceMappingURL=create-brand.dto.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"create-brand.dto.js","sourceRoot":"","sources":["../../../../src/modules/catalog/dto/create-brand.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAmE;AACnE,qDAOyB;AACzB,kEAAyD;AAEzD,MAAa,cAAc;IAKzB,IAAI,CAAS;IAMb,IAAI,CAAS;IAMb,gBAAgB,CAAU;IAI1B,IAAI,CAAc;CACnB;AAtBD,wCAsBC;AAjBC;IAJC,IAAA,qBAAW,GAAE;IACb,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,CAAC,CAAC;IACZ,IAAA,2BAAS,EAAC,GAAG,CAAC;;4CACF;AAMb;IAJC,IAAA,qBAAW,GAAE;IACb,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,CAAC,CAAC;IACZ,IAAA,2BAAS,EAAC,GAAG,CAAC;;4CACF;AAMb;IAJC,IAAA,6BAAmB,EAAC,EAAE,OAAO,EAAE,oDAAoD,EAAE,CAAC;IACtF,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,GAAG,CAAC;;wDACW;AAI1B;IAFC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,+BAAW,EAAE,CAAC;IAClC,IAAA,wBAAM,EAAC,+BAAW,CAAC;;4CACF"}

View File

@@ -0,0 +1,8 @@
import { ProductType } from '../enums/product-type.enum';
export declare class CreateCategoryDto {
name: string;
slug: string;
existingImageUrl?: string;
type: ProductType;
parentId?: string;
}

View File

@@ -0,0 +1,56 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateCategoryDto = void 0;
const swagger_1 = require("@nestjs/swagger");
const class_validator_1 = require("class-validator");
const product_type_enum_1 = require("../enums/product-type.enum");
class CreateCategoryDto {
name;
slug;
existingImageUrl;
type;
parentId;
}
exports.CreateCategoryDto = CreateCategoryDto;
__decorate([
(0, swagger_1.ApiProperty)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MinLength)(2),
(0, class_validator_1.MaxLength)(150),
__metadata("design:type", String)
], CreateCategoryDto.prototype, "name", void 0);
__decorate([
(0, swagger_1.ApiProperty)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MinLength)(2),
(0, class_validator_1.MaxLength)(180),
__metadata("design:type", String)
], CreateCategoryDto.prototype, "slug", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 'https://cdn.example.com/media/image/root/category.jpg' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(500),
__metadata("design:type", String)
], CreateCategoryDto.prototype, "existingImageUrl", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ enum: product_type_enum_1.ProductType }),
(0, class_validator_1.IsEnum)(product_type_enum_1.ProductType),
__metadata("design:type", String)
], CreateCategoryDto.prototype, "type", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)(),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsUUID)(),
__metadata("design:type", String)
], CreateCategoryDto.prototype, "parentId", void 0);
//# sourceMappingURL=create-category.dto.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"create-category.dto.js","sourceRoot":"","sources":["../../../../src/modules/catalog/dto/create-category.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAmE;AACnE,qDAA6F;AAC7F,kEAAyD;AAEzD,MAAa,iBAAiB;IAK5B,IAAI,CAAS;IAMb,IAAI,CAAS;IAMb,gBAAgB,CAAU;IAI1B,IAAI,CAAc;IAKlB,QAAQ,CAAU;CACnB;AA3BD,8CA2BC;AAtBC;IAJC,IAAA,qBAAW,GAAE;IACb,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,CAAC,CAAC;IACZ,IAAA,2BAAS,EAAC,GAAG,CAAC;;+CACF;AAMb;IAJC,IAAA,qBAAW,GAAE;IACb,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,CAAC,CAAC;IACZ,IAAA,2BAAS,EAAC,GAAG,CAAC;;+CACF;AAMb;IAJC,IAAA,6BAAmB,EAAC,EAAE,OAAO,EAAE,uDAAuD,EAAE,CAAC;IACzF,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,GAAG,CAAC;;2DACW;AAI1B;IAFC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,+BAAW,EAAE,CAAC;IAClC,IAAA,wBAAM,EAAC,+BAAW,CAAC;;+CACF;AAKlB;IAHC,IAAA,6BAAmB,GAAE;IACrB,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,GAAE;;mDACS"}

View File

@@ -0,0 +1,7 @@
export declare class CreateProductReviewDto {
name: string;
email?: string;
rating: number;
title?: string;
comment: string;
}

View File

@@ -0,0 +1,55 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateProductReviewDto = void 0;
const swagger_1 = require("@nestjs/swagger");
const class_validator_1 = require("class-validator");
class CreateProductReviewDto {
name;
email;
rating;
title;
comment;
}
exports.CreateProductReviewDto = CreateProductReviewDto;
__decorate([
(0, swagger_1.ApiProperty)({ example: 'Ali Rezaei' }),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(120),
__metadata("design:type", String)
], CreateProductReviewDto.prototype, "name", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 'ali@example.com' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsEmail)(),
(0, class_validator_1.MaxLength)(160),
__metadata("design:type", String)
], CreateProductReviewDto.prototype, "email", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: 5, minimum: 1, maximum: 5 }),
(0, class_validator_1.IsInt)(),
(0, class_validator_1.Min)(1),
(0, class_validator_1.Max)(5),
__metadata("design:type", Number)
], CreateProductReviewDto.prototype, "rating", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 'Excellent quality' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(160),
__metadata("design:type", String)
], CreateProductReviewDto.prototype, "title", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: 'Good quality product with solid packaging.' }),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], CreateProductReviewDto.prototype, "comment", void 0);
//# sourceMappingURL=create-product-review.dto.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"create-product-review.dto.js","sourceRoot":"","sources":["../../../../src/modules/catalog/dto/create-product-review.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAmE;AACnE,qDAQyB;AAEzB,MAAa,sBAAsB;IAIjC,IAAI,CAAS;IAMb,KAAK,CAAU;IAMf,MAAM,CAAS;IAMf,KAAK,CAAU;IAIf,OAAO,CAAS;CACjB;AA3BD,wDA2BC;AAvBC;IAHC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;IACtC,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,GAAG,CAAC;;oDACF;AAMb;IAJC,IAAA,6BAAmB,EAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC;IACnD,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,GAAE;IACT,IAAA,2BAAS,EAAC,GAAG,CAAC;;qDACA;AAMf;IAJC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACnD,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAG,EAAC,CAAC,CAAC;IACN,IAAA,qBAAG,EAAC,CAAC,CAAC;;sDACQ;AAMf;IAJC,IAAA,6BAAmB,EAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;IACrD,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,GAAG,CAAC;;qDACA;AAIf;IAFC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,4CAA4C,EAAE,CAAC;IACtE,IAAA,0BAAQ,GAAE;;uDACK"}

View File

@@ -0,0 +1,26 @@
import { ProductStatus } from '../enums/product-status.enum';
import { ProductType } from '../enums/product-type.enum';
import { ProductAttributeInputDto } from './product-attribute-input.dto';
import { ProductMetaDto } from './product-meta.dto';
export declare class CreateProductDto {
sku: string;
title: string;
slug: string;
technicalCode: string;
brand?: string;
brandId?: string;
basePriceUSD: number;
salePriceUSD?: number;
stock: number;
type: ProductType;
status?: ProductStatus;
featured?: boolean;
primaryCategoryId?: string;
categoryIds?: string[];
tags?: string[];
meta?: ProductMetaDto;
attributes?: ProductAttributeInputDto[];
existingGalleryUrls?: string[];
existingMainImageUrl?: string;
existingThreeDModelUrl?: string;
}

View File

@@ -0,0 +1,198 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateProductDto = void 0;
const swagger_1 = require("@nestjs/swagger");
const class_transformer_1 = require("class-transformer");
const class_validator_1 = require("class-validator");
const json_transform_util_1 = require("../../../common/utils/json-transform.util");
const product_status_enum_1 = require("../enums/product-status.enum");
const product_type_enum_1 = require("../enums/product-type.enum");
const product_attribute_input_dto_1 = require("./product-attribute-input.dto");
const product_meta_dto_1 = require("./product-meta.dto");
class CreateProductDto {
sku;
title;
slug;
technicalCode;
brand;
brandId;
basePriceUSD;
salePriceUSD;
stock;
type;
status;
featured;
primaryCategoryId;
categoryIds;
tags;
meta;
attributes;
existingGalleryUrls;
existingMainImageUrl;
existingThreeDModelUrl;
}
exports.CreateProductDto = CreateProductDto;
__decorate([
(0, swagger_1.ApiProperty)({ example: 'BRG-6006-2RS' }),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(80),
__metadata("design:type", String)
], CreateProductDto.prototype, "sku", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: 'SKF 6006-2RS Deep Groove Bearing' }),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(160),
__metadata("design:type", String)
], CreateProductDto.prototype, "title", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: 'skf-6006-2rs' }),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(180),
__metadata("design:type", String)
], CreateProductDto.prototype, "slug", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: 'SKF-6006' }),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(120),
__metadata("design:type", String)
], CreateProductDto.prototype, "technicalCode", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: 'SKF' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(120),
__metadata("design:type", String)
], CreateProductDto.prototype, "brand", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: '1cc8af97-a766-49af-80f4-912710ef9b2f' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsUUID)(),
__metadata("design:type", String)
], CreateProductDto.prototype, "brandId", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: 42.5 }),
(0, class_transformer_1.Transform)(({ value }) => Number(value)),
(0, class_validator_1.IsNumber)(),
(0, class_validator_1.Min)(0),
__metadata("design:type", Number)
], CreateProductDto.prototype, "basePriceUSD", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 39.99 }),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(({ value }) => Number(value)),
(0, class_validator_1.IsNumber)(),
(0, class_validator_1.Min)(0),
__metadata("design:type", Number)
], CreateProductDto.prototype, "salePriceUSD", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ example: 28 }),
(0, class_transformer_1.Transform)(({ value }) => Number(value)),
(0, class_validator_1.IsInt)(),
(0, class_validator_1.Min)(0),
__metadata("design:type", Number)
], CreateProductDto.prototype, "stock", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ enum: product_type_enum_1.ProductType }),
(0, class_validator_1.IsEnum)(product_type_enum_1.ProductType),
__metadata("design:type", String)
], CreateProductDto.prototype, "type", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ enum: product_status_enum_1.ProductStatus, example: product_status_enum_1.ProductStatus.DRAFT }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsEnum)(product_status_enum_1.ProductStatus),
__metadata("design:type", String)
], CreateProductDto.prototype, "status", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: true }),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(({ value }) => typeof value === 'boolean' ? value : String(value).toLowerCase() === 'true'),
(0, class_validator_1.IsBoolean)(),
__metadata("design:type", Boolean)
], CreateProductDto.prototype, "featured", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: '1cc8af97-a766-49af-80f4-912710ef9b2f' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsUUID)(),
__metadata("design:type", String)
], CreateProductDto.prototype, "primaryCategoryId", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({
example: [
'1cc8af97-a766-49af-80f4-912710ef9b2f',
'2cc8af97-a766-49af-80f4-912710ef9b2f',
],
type: [String],
}),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(json_transform_util_1.parseJsonValue),
(0, class_validator_1.IsArray)(),
(0, class_validator_1.ArrayUnique)(),
(0, class_validator_1.IsUUID)('4', { each: true }),
__metadata("design:type", Array)
], CreateProductDto.prototype, "categoryIds", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({
example: ['bearing', 'skf', 'industrial'],
type: [String],
}),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(json_transform_util_1.parseJsonValue),
(0, class_validator_1.IsArray)(),
(0, class_validator_1.ArrayMaxSize)(30),
(0, class_validator_1.ArrayUnique)(),
(0, class_validator_1.IsString)({ each: true }),
__metadata("design:type", Array)
], CreateProductDto.prototype, "tags", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ type: product_meta_dto_1.ProductMetaDto }),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(json_transform_util_1.parseJsonValue),
(0, class_validator_1.ValidateNested)(),
(0, class_transformer_1.Type)(() => product_meta_dto_1.ProductMetaDto),
__metadata("design:type", product_meta_dto_1.ProductMetaDto)
], CreateProductDto.prototype, "meta", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ type: [product_attribute_input_dto_1.ProductAttributeInputDto] }),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(json_transform_util_1.parseJsonValue),
(0, class_validator_1.IsArray)(),
(0, class_validator_1.ValidateNested)({ each: true }),
(0, class_transformer_1.Type)(() => product_attribute_input_dto_1.ProductAttributeInputDto),
__metadata("design:type", Array)
], CreateProductDto.prototype, "attributes", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({
example: ['https://cdn.example.com/products/gallery/1.jpg'],
type: [String],
}),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(json_transform_util_1.parseJsonValue),
(0, class_validator_1.IsArray)(),
(0, class_validator_1.ArrayMaxSize)(20),
(0, class_validator_1.IsString)({ each: true }),
__metadata("design:type", Array)
], CreateProductDto.prototype, "existingGalleryUrls", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 'https://cdn.example.com/products/main.jpg' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.IsNotEmpty)(),
__metadata("design:type", String)
], CreateProductDto.prototype, "existingMainImageUrl", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 'https://cdn.example.com/products/model.glb' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.IsNotEmpty)(),
__metadata("design:type", String)
], CreateProductDto.prototype, "existingThreeDModelUrl", void 0);
//# sourceMappingURL=create-product.dto.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"create-product.dto.js","sourceRoot":"","sources":["../../../../src/modules/catalog/dto/create-product.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAmE;AACnE,yDAAoD;AACpD,qDAeyB;AACzB,mFAA2E;AAC3E,sEAA6D;AAC7D,kEAAyD;AACzD,+EAAyE;AACzE,yDAAoD;AAEpD,MAAa,gBAAgB;IAI3B,GAAG,CAAS;IAKZ,KAAK,CAAS;IAKd,IAAI,CAAS;IAKb,aAAa,CAAS;IAMtB,KAAK,CAAU;IAKf,OAAO,CAAU;IAMjB,YAAY,CAAS;IAOrB,YAAY,CAAU;IAMtB,KAAK,CAAS;IAId,IAAI,CAAc;IAKlB,MAAM,CAAiB;IAQvB,QAAQ,CAAW;IAKnB,iBAAiB,CAAU;IAc3B,WAAW,CAAY;IAYvB,IAAI,CAAY;IAOhB,IAAI,CAAkB;IAQtB,UAAU,CAA8B;IAWxC,mBAAmB,CAAY;IAM/B,oBAAoB,CAAU;IAM9B,sBAAsB,CAAU;CACjC;AAxID,4CAwIC;AApIC;IAHC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IACxC,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,EAAE,CAAC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,EAAE,IAAI,EAAE,CAAC;;6DACM;AAM/B;IAJC,IAAA,6BAAmB,EAAC,EAAE,OAAO,EAAE,2CAA2C,EAAE,CAAC;IAC7E,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;8DACiB;AAM9B;IAJC,IAAA,6BAAmB,EAAC,EAAE,OAAO,EAAE,4CAA4C,EAAE,CAAC;IAC9E,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;gEACmB"}

View File

@@ -0,0 +1,7 @@
export declare class FilterProductReviewsDto {
productId?: string;
isApproved?: boolean;
isPinned?: boolean;
page?: number;
limit?: number;
}

View File

@@ -0,0 +1,54 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FilterProductReviewsDto = void 0;
const class_transformer_1 = require("class-transformer");
const class_validator_1 = require("class-validator");
class FilterProductReviewsDto {
productId;
isApproved;
isPinned;
page = 1;
limit = 20;
}
exports.FilterProductReviewsDto = FilterProductReviewsDto;
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsUUID)(),
__metadata("design:type", String)
], FilterProductReviewsDto.prototype, "productId", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(({ value }) => typeof value === 'boolean' ? value : String(value).toLowerCase() === 'true'),
(0, class_validator_1.IsBoolean)(),
__metadata("design:type", Boolean)
], FilterProductReviewsDto.prototype, "isApproved", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(({ value }) => typeof value === 'boolean' ? value : String(value).toLowerCase() === 'true'),
(0, class_validator_1.IsBoolean)(),
__metadata("design:type", Boolean)
], FilterProductReviewsDto.prototype, "isPinned", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(({ value }) => Number(value)),
(0, class_validator_1.IsInt)(),
(0, class_validator_1.Min)(1),
__metadata("design:type", Number)
], FilterProductReviewsDto.prototype, "page", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(({ value }) => Number(value)),
(0, class_validator_1.IsInt)(),
(0, class_validator_1.Min)(1),
__metadata("design:type", Number)
], FilterProductReviewsDto.prototype, "limit", void 0);
//# sourceMappingURL=filter-product-reviews.dto.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"filter-product-reviews.dto.js","sourceRoot":"","sources":["../../../../src/modules/catalog/dto/filter-product-reviews.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA8C;AAC9C,qDAMyB;AAEzB,MAAa,uBAAuB;IAGlC,SAAS,CAAU;IAOnB,UAAU,CAAW;IAOrB,QAAQ,CAAW;IAMnB,IAAI,GAAY,CAAC,CAAC;IAMlB,KAAK,GAAY,EAAE,CAAC;CACrB;AA9BD,0DA8BC;AA3BC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,GAAE;;0DACU;AAOnB;IALC,IAAA,4BAAU,GAAE;IACZ,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CACvB,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,CAC5E;IACA,IAAA,2BAAS,GAAE;;2DACS;AAOrB;IALC,IAAA,4BAAU,GAAE;IACZ,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CACvB,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,CAC5E;IACA,IAAA,2BAAS,GAAE;;yDACO;AAMnB;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvC,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAG,EAAC,CAAC,CAAC;;qDACW;AAMlB;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvC,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAG,EAAC,CAAC,CAAC;;sDACa"}

View File

@@ -0,0 +1,15 @@
import { ProductStatus } from '../enums/product-status.enum';
import { ProductType } from '../enums/product-type.enum';
export declare class FilterProductsDto {
search?: string;
type?: ProductType;
status?: ProductStatus;
categoryId?: string;
brandId?: string;
brand?: string;
attributes?: Record<string, unknown>;
tags?: string[];
featured?: boolean;
page?: number;
limit?: number;
}

View File

@@ -0,0 +1,95 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FilterProductsDto = void 0;
const class_transformer_1 = require("class-transformer");
const class_validator_1 = require("class-validator");
const json_transform_util_1 = require("../../../common/utils/json-transform.util");
const product_status_enum_1 = require("../enums/product-status.enum");
const product_type_enum_1 = require("../enums/product-type.enum");
class FilterProductsDto {
search;
type;
status;
categoryId;
brandId;
brand;
attributes;
tags;
featured;
page = 1;
limit = 20;
}
exports.FilterProductsDto = FilterProductsDto;
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], FilterProductsDto.prototype, "search", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsEnum)(product_type_enum_1.ProductType),
__metadata("design:type", String)
], FilterProductsDto.prototype, "type", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsEnum)(product_status_enum_1.ProductStatus),
__metadata("design:type", String)
], FilterProductsDto.prototype, "status", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsUUID)(),
__metadata("design:type", String)
], FilterProductsDto.prototype, "categoryId", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsUUID)(),
__metadata("design:type", String)
], FilterProductsDto.prototype, "brandId", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], FilterProductsDto.prototype, "brand", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(json_transform_util_1.parseJsonValue),
(0, class_validator_1.IsObject)(),
__metadata("design:type", Object)
], FilterProductsDto.prototype, "attributes", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(json_transform_util_1.parseJsonValue),
(0, class_validator_1.IsArray)(),
(0, class_validator_1.IsString)({ each: true }),
__metadata("design:type", Array)
], FilterProductsDto.prototype, "tags", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(({ value }) => typeof value === 'boolean' ? value : String(value).toLowerCase() === 'true'),
(0, class_validator_1.IsBoolean)(),
__metadata("design:type", Boolean)
], FilterProductsDto.prototype, "featured", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(({ value }) => Number(value)),
(0, class_validator_1.IsInt)(),
(0, class_validator_1.Min)(1),
__metadata("design:type", Number)
], FilterProductsDto.prototype, "page", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(({ value }) => Number(value)),
(0, class_validator_1.IsInt)(),
(0, class_validator_1.Min)(1),
__metadata("design:type", Number)
], FilterProductsDto.prototype, "limit", void 0);
//# sourceMappingURL=filter-products.dto.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"filter-products.dto.js","sourceRoot":"","sources":["../../../../src/modules/catalog/dto/filter-products.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA8C;AAC9C,qDAUyB;AACzB,mFAA2E;AAC3E,sEAA6D;AAC7D,kEAAyD;AAEzD,MAAa,iBAAiB;IAG5B,MAAM,CAAU;IAIhB,IAAI,CAAe;IAInB,MAAM,CAAiB;IAIvB,UAAU,CAAU;IAIpB,OAAO,CAAU;IAIjB,KAAK,CAAU;IAKf,UAAU,CAA2B;IAMrC,IAAI,CAAY;IAOhB,QAAQ,CAAW;IAMnB,IAAI,GAAY,CAAC,CAAC;IAMlB,KAAK,GAAY,EAAE,CAAC;CACrB;AAtDD,8CAsDC;AAnDC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;iDACK;AAIhB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,EAAC,+BAAW,CAAC;;+CACD;AAInB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,EAAC,mCAAa,CAAC;;iDACC;AAIvB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,GAAE;;qDACW;AAIpB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,GAAE;;kDACQ;AAIjB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;gDACI;AAKf;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,6BAAS,EAAC,oCAAc,CAAC;IACzB,IAAA,0BAAQ,GAAE;;qDAC0B;AAMrC;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,6BAAS,EAAC,oCAAc,CAAC;IACzB,IAAA,yBAAO,GAAE;IACT,IAAA,0BAAQ,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;+CACT;AAOhB;IALC,IAAA,4BAAU,GAAE;IACZ,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CACvB,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,CAC5E;IACA,IAAA,2BAAS,GAAE;;mDACO;AAMnB;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvC,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAG,EAAC,CAAC,CAAC;;+CACW;AAMlB;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvC,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAG,EAAC,CAAC,CAAC;;gDACa"}

View File

@@ -0,0 +1,4 @@
export declare class ModerateProductReviewDto {
isApproved?: boolean;
isPinned?: boolean;
}

View File

@@ -0,0 +1,35 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ModerateProductReviewDto = void 0;
const swagger_1 = require("@nestjs/swagger");
const class_transformer_1 = require("class-transformer");
const class_validator_1 = require("class-validator");
class ModerateProductReviewDto {
isApproved;
isPinned;
}
exports.ModerateProductReviewDto = ModerateProductReviewDto;
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: true }),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(({ value }) => typeof value === 'boolean' ? value : String(value).toLowerCase() === 'true'),
(0, class_validator_1.IsBoolean)(),
__metadata("design:type", Boolean)
], ModerateProductReviewDto.prototype, "isApproved", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: false }),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(({ value }) => typeof value === 'boolean' ? value : String(value).toLowerCase() === 'true'),
(0, class_validator_1.IsBoolean)(),
__metadata("design:type", Boolean)
], ModerateProductReviewDto.prototype, "isPinned", void 0);
//# sourceMappingURL=moderate-product-review.dto.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"moderate-product-review.dto.js","sourceRoot":"","sources":["../../../../src/modules/catalog/dto/moderate-product-review.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAsD;AACtD,yDAA8C;AAC9C,qDAAwD;AAExD,MAAa,wBAAwB;IAOnC,UAAU,CAAW;IAQrB,QAAQ,CAAW;CACpB;AAhBD,4DAgBC;AATC;IANC,IAAA,6BAAmB,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACtC,IAAA,4BAAU,GAAE;IACZ,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CACvB,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,CAC5E;IACA,IAAA,2BAAS,GAAE;;4DACS;AAQrB;IANC,IAAA,6BAAmB,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IACvC,IAAA,4BAAU,GAAE;IACZ,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CACvB,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,CAC5E;IACA,IAAA,2BAAS,GAAE;;0DACO"}

View File

@@ -0,0 +1,20 @@
import { AttributeDataType } from '../enums/attribute-data-type.enum';
export declare class ProductAttributeInputDto {
attributeId?: string;
name?: string;
slug?: string;
dataType?: AttributeDataType;
unit?: string;
options?: string[];
isFilterable?: boolean;
isVisible?: boolean;
defaultValueText?: string;
defaultValueNumber?: number;
defaultValueBoolean?: boolean;
defaultValueJson?: Record<string, unknown> | string[];
valueText?: string;
valueNumber?: number;
valueBoolean?: boolean;
valueJson?: Record<string, unknown> | string[];
overrideUnit?: string;
}

View File

@@ -0,0 +1,153 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProductAttributeInputDto = void 0;
const swagger_1 = require("@nestjs/swagger");
const class_transformer_1 = require("class-transformer");
const class_validator_1 = require("class-validator");
const json_transform_util_1 = require("../../../common/utils/json-transform.util");
const attribute_data_type_enum_1 = require("../enums/attribute-data-type.enum");
class ProductAttributeInputDto {
attributeId;
name;
slug;
dataType;
unit;
options;
isFilterable;
isVisible;
defaultValueText;
defaultValueNumber;
defaultValueBoolean;
defaultValueJson;
valueText;
valueNumber;
valueBoolean;
valueJson;
overrideUnit;
}
exports.ProductAttributeInputDto = ProductAttributeInputDto;
__decorate([
(0, swagger_1.ApiPropertyOptional)(),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsUUID)(),
__metadata("design:type", String)
], ProductAttributeInputDto.prototype, "attributeId", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 'Weight' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(120),
__metadata("design:type", String)
], ProductAttributeInputDto.prototype, "name", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 'weight' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(140),
__metadata("design:type", String)
], ProductAttributeInputDto.prototype, "slug", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ enum: attribute_data_type_enum_1.AttributeDataType }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsEnum)(attribute_data_type_enum_1.AttributeDataType),
__metadata("design:type", String)
], ProductAttributeInputDto.prototype, "dataType", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 'kg' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(50),
__metadata("design:type", String)
], ProductAttributeInputDto.prototype, "unit", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ type: [String], example: ['Red', 'Blue'] }),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(json_transform_util_1.parseJsonValue),
(0, class_validator_1.IsArray)(),
(0, class_validator_1.IsString)({ each: true }),
__metadata("design:type", Array)
], ProductAttributeInputDto.prototype, "options", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: true }),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(({ value }) => typeof value === 'boolean' ? value : String(value).toLowerCase() === 'true'),
(0, class_validator_1.IsBoolean)(),
__metadata("design:type", Boolean)
], ProductAttributeInputDto.prototype, "isFilterable", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: true }),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(({ value }) => typeof value === 'boolean' ? value : String(value).toLowerCase() === 'true'),
(0, class_validator_1.IsBoolean)(),
__metadata("design:type", Boolean)
], ProductAttributeInputDto.prototype, "isVisible", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: '1.25' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], ProductAttributeInputDto.prototype, "defaultValueText", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 1.25 }),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Type)(() => Number),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], ProductAttributeInputDto.prototype, "defaultValueNumber", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: true }),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(({ value }) => typeof value === 'boolean' ? value : String(value).toLowerCase() === 'true'),
(0, class_validator_1.IsBoolean)(),
__metadata("design:type", Boolean)
], ProductAttributeInputDto.prototype, "defaultValueBoolean", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: ['6305', '6306'] }),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(json_transform_util_1.parseJsonValue),
(0, class_validator_1.IsObject)(),
__metadata("design:type", Object)
], ProductAttributeInputDto.prototype, "defaultValueJson", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: '1.40' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], ProductAttributeInputDto.prototype, "valueText", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 1.4 }),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Type)(() => Number),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], ProductAttributeInputDto.prototype, "valueNumber", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: false }),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(({ value }) => typeof value === 'boolean' ? value : String(value).toLowerCase() === 'true'),
(0, class_validator_1.IsBoolean)(),
__metadata("design:type", Boolean)
], ProductAttributeInputDto.prototype, "valueBoolean", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: ['2RS', 'ZZ'] }),
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Transform)(json_transform_util_1.parseJsonValue),
__metadata("design:type", Object)
], ProductAttributeInputDto.prototype, "valueJson", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 'g' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(50),
__metadata("design:type", String)
], ProductAttributeInputDto.prototype, "overrideUnit", void 0);
//# sourceMappingURL=product-attribute-input.dto.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"product-attribute-input.dto.js","sourceRoot":"","sources":["../../../../src/modules/catalog/dto/product-attribute-input.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAsD;AACtD,yDAAoD;AACpD,qDAUy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;2DACqB;AAM/C;IAJC,IAAA,6BAAmB,EAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;IACrC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,EAAE,CAAC;;8DACQ"}

View File

@@ -0,0 +1,9 @@
export declare class ProductMetaDto {
shortDescription?: string;
description?: string;
metaTitle?: string;
metaDescription?: string;
shareTitle?: string;
shareDescription?: string;
shareImageUrl?: string;
}

View File

@@ -0,0 +1,73 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProductMetaDto = void 0;
const swagger_1 = require("@nestjs/swagger");
const class_validator_1 = require("class-validator");
class ProductMetaDto {
shortDescription;
description;
metaTitle;
metaDescription;
shareTitle;
shareDescription;
shareImageUrl;
}
exports.ProductMetaDto = ProductMetaDto;
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 'Industrial bearing for motors and gearboxes' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(320),
__metadata("design:type", String)
], ProductMetaDto.prototype, "shortDescription", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 'Full product description in HTML or plain text' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], ProductMetaDto.prototype, "description", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 'SKF 6006-2RS | Buy Industrial Bearing' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(160),
__metadata("design:type", String)
], ProductMetaDto.prototype, "metaTitle", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 'Buy SKF 6006-2RS with verified specs and fast delivery.' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(320),
__metadata("design:type", String)
], ProductMetaDto.prototype, "metaDescription", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 'SKF 6006-2RS Deep Groove Bearing' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(160),
__metadata("design:type", String)
], ProductMetaDto.prototype, "shareTitle", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 'Industrial bearing with verified specs and fast delivery.' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(320),
__metadata("design:type", String)
], ProductMetaDto.prototype, "shareDescription", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ example: 'https://cdn.example.com/products/share.jpg' }),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
(0, class_validator_1.MaxLength)(500),
__metadata("design:type", String)
], ProductMetaDto.prototype, "shareImageUrl", void 0);
//# sourceMappingURL=product-meta.dto.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"product-meta.dto.js","sourceRoot":"","sources":["../../../../src/modules/catalog/dto/product-meta.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAsD;AACtD,qDAAkE;AAElE,MAAa,cAAc;IAKzB,gBAAgB,CAAU;IAK1B,WAAW,CAAU;IAMrB,SAAS,CAAU;IAMnB,eAAe,CAAU;IAMzB,UAAU,CAAU;IAMpB,gBAAgB,CAAU;IAM1B,aAAa,CA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UpdateAttributeDefinitionDto_base: import("@nestjs/common").Type<Partial<CreateAttributeDefinitionDto>>;
export declare class UpdateAttributeDefinitionDto extends UpdateAttributeDefinitionDto_base {
}
export {};

View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateAttributeDefinitionDto = void 0;
const swagger_1 = require("@nestjs/swagger");
const create_attribute_definition_dto_1 = require("./create-attribute-definition.dto");
class UpdateAttributeDefinitionDto extends (0, swagger_1.PartialType)(create_attribute_definition_dto_1.CreateAttributeDefinitionDto) {
}
exports.UpdateAttributeDefinitionDto = UpdateAttributeDefinitionDto;
//# sourceMappingURL=update-attribute-definition.dto.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"update-attribute-definition.dto.js","sourceRoot":"","sources":["../../../../src/modules/catalog/dto/update-attribute-definition.dto.ts"],"names":[],"mappings":";;;AAAA,6CAA8C;AAC9C,uFAAiF;AAEjF,MAAa,4BAA6B,SAAQ,IAAA,qBAAW,EAC3D,8DAA4B,CAC7B;CAAG;AAFJ,oEAEI"}

View File

@@ -0,0 +1,5 @@
import { CreateBrandDto } from './create-brand.dto';
declare const UpdateBrandDto_base: import("@nestjs/common").Type<Partial<CreateBrandDto>>;
export declare class UpdateBrandDto extends UpdateBrandDto_base {
}
export {};

View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateBrandDto = void 0;
const swagger_1 = require("@nestjs/swagger");
const create_brand_dto_1 = require("./create-brand.dto");
class UpdateBrandDto extends (0, swagger_1.PartialType)(create_brand_dto_1.CreateBrandDto) {
}
exports.UpdateBrandDto = UpdateBrandDto;
//# sourceMappingURL=update-brand.dto.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"update-brand.dto.js","sourceRoot":"","sources":["../../../../src/modules/catalog/dto/update-brand.dto.ts"],"names":[],"mappings":";;;AAAA,6CAA8C;AAC9C,yDAAoD;AAEpD,MAAa,cAAe,SAAQ,IAAA,qBAAW,EAAC,iCAAc,CAAC;CAAG;AAAlE,wCAAkE"}

View File

@@ -0,0 +1,5 @@
import { CreateCategoryDto } from './create-category.dto';
declare const UpdateCategoryDto_base: import("@nestjs/common").Type<Partial<CreateCategoryDto>>;
export declare class UpdateCategoryDto extends UpdateCategoryDto_base {
}
export {};

View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateCategoryDto = void 0;
const swagger_1 = require("@nestjs/swagger");
const create_category_dto_1 = require("./create-category.dto");
class UpdateCategoryDto extends (0, swagger_1.PartialType)(create_category_dto_1.CreateCategoryDto) {
}
exports.UpdateCategoryDto = UpdateCategoryDto;
//# sourceMappingURL=update-category.dto.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"update-category.dto.js","sourceRoot":"","sources":["../../../../src/modules/catalog/dto/update-category.dto.ts"],"names":[],"mappings":";;;AAAA,6CAA8C;AAC9C,+DAA0D;AAE1D,MAAa,iBAAkB,SAAQ,IAAA,qBAAW,EAAC,uCAAiB,CAAC;CAAG;AAAxE,8CAAwE"}

View File

@@ -0,0 +1,5 @@
import { CreateProductDto } from './create-product.dto';
declare const UpdateProductDto_base: import("@nestjs/common").Type<Partial<CreateProductDto>>;
export declare class UpdateProductDto extends UpdateProductDto_base {
}
export {};

View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateProductDto = void 0;
const swagger_1 = require("@nestjs/swagger");
const create_product_dto_1 = require("./create-product.dto");
class UpdateProductDto extends (0, swagger_1.PartialType)(create_product_dto_1.CreateProductDto) {
}
exports.UpdateProductDto = UpdateProductDto;
//# sourceMappingURL=update-product.dto.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"update-product.dto.js","sourceRoot":"","sources":["../../../../src/modules/catalog/dto/update-product.dto.ts"],"names":[],"mappings":";;;AAAA,6CAA8C;AAC9C,6DAAwD;AAExD,MAAa,gBAAiB,SAAQ,IAAA,qBAAW,EAAC,qCAAgB,CAAC;CAAG;AAAtE,4CAAsE"}

View File

@@ -0,0 +1,19 @@
import { AttributeDataType } from '../enums/attribute-data-type.enum';
import { ProductAttributeValue } from './product-attribute-value.entity';
export declare class AttributeDefinition {
id: string;
name: string;
slug: string;
dataType: AttributeDataType;
unit?: string | null;
options: string[];
defaultValueText?: string | null;
defaultValueNumber?: string | null;
defaultValueBoolean?: boolean | null;
defaultValueJson?: Record<string, unknown> | string[] | null;
isFilterable: boolean;
isVisible: boolean;
values: ProductAttributeValue[];
createdAt: Date;
updatedAt: Date;
}

View File

@@ -0,0 +1,102 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AttributeDefinition = void 0;
const typeorm_1 = require("typeorm");
const attribute_data_type_enum_1 = require("../enums/attribute-data-type.enum");
const product_attribute_value_entity_1 = require("./product-attribute-value.entity");
let AttributeDefinition = class AttributeDefinition {
id;
name;
slug;
dataType;
unit;
options;
defaultValueText;
defaultValueNumber;
defaultValueBoolean;
defaultValueJson;
isFilterable;
isVisible;
values;
createdAt;
updatedAt;
};
exports.AttributeDefinition = AttributeDefinition;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], AttributeDefinition.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 120 }),
__metadata("design:type", String)
], AttributeDefinition.prototype, "name", void 0);
__decorate([
(0, typeorm_1.Index)(),
(0, typeorm_1.Column)({ type: 'varchar', length: 140, unique: true }),
__metadata("design:type", String)
], AttributeDefinition.prototype, "slug", void 0);
__decorate([
(0, typeorm_1.Column)({
name: 'data_type',
type: 'enum',
enum: attribute_data_type_enum_1.AttributeDataType,
}),
__metadata("design:type", String)
], AttributeDefinition.prototype, "dataType", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: true }),
__metadata("design:type", Object)
], AttributeDefinition.prototype, "unit", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'jsonb', default: () => "'[]'" }),
__metadata("design:type", Array)
], AttributeDefinition.prototype, "options", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'default_value_text', type: 'varchar', length: 255, nullable: true }),
__metadata("design:type", Object)
], AttributeDefinition.prototype, "defaultValueText", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'default_value_number', type: 'numeric', precision: 12, scale: 3, nullable: true }),
__metadata("design:type", Object)
], AttributeDefinition.prototype, "defaultValueNumber", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'default_value_boolean', type: 'boolean', nullable: true }),
__metadata("design:type", Object)
], AttributeDefinition.prototype, "defaultValueBoolean", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'default_value_json', type: 'jsonb', nullable: true }),
__metadata("design:type", Object)
], AttributeDefinition.prototype, "defaultValueJson", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'is_filterable', type: 'boolean', default: false }),
__metadata("design:type", Boolean)
], AttributeDefinition.prototype, "isFilterable", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'is_visible', type: 'boolean', default: true }),
__metadata("design:type", Boolean)
], AttributeDefinition.prototype, "isVisible", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => product_attribute_value_entity_1.ProductAttributeValue, (value) => value.attribute),
__metadata("design:type", Array)
], AttributeDefinition.prototype, "values", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
__metadata("design:type", Date)
], AttributeDefinition.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
__metadata("design:type", Date)
], AttributeDefinition.prototype, "updatedAt", void 0);
exports.AttributeDefinition = AttributeDefinition = __decorate([
(0, typeorm_1.Entity)({ name: 'attribute_definitions' })
], AttributeDefinition);
//# sourceMappingURL=attribute-definition.entity.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"attribute-definition.entity.js","sourceRoot":"","sources":["../../../../src/modules/catalog/entities/attribute-definition.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAQiB;AACjB,gFAAsE;AACtE,qFAAyE;AAGlE,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAE9B,EAAE,CAAS;IAGX,IAAI,CAAS;IAIb,IAAI,CAAS;IAOb,QAAQ,CAAoB;IAG5B,IAAI,CAAiB;IAGrB,OAAO,CAAW;IAGlB,gBAAgB,CAAiB;IAGjC,kBAAkB,CAAiB;IAGnC,mBAAmB,CAAkB;IAGrC,gBAAgB,CAA6C;IAG7D,YAAY,CAAU;IAGtB,SAAS,CAAU;IAGnB,MAAM,CAA0B;IAGhC,SAAS,CAAO;IAGhB,SAAS,CAAO;CACjB,CAAA;AAlDY,kDAAmB;AAE9B;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;+CACpB;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;iDAC5B;AAIb;IAFC,IAAA,eAAK,GAAE;IACP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;iDAC1C;AAOb;IALC,IAAA,gBAAM,EAAC;QACN,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,4CAAiB;KACxB,CAAC;;qDAC0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AAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BAC9B,IAAI;sDAAC;AAGhB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BAC9B,IAAI;sDAAC;8BAjDL,mBAAmB;IAD/B,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC;GAC7B,mBAAmB,CAkD/B"}

View File

@@ -0,0 +1,12 @@
import { ProductType } from '../enums/product-type.enum';
import { Product } from './product.entity';
export declare class Brand {
id: string;
name: string;
slug: string;
imageUrl?: string | null;
type: ProductType;
products: Product[];
createdAt: Date;
updatedAt: Date;
}

View File

@@ -0,0 +1,65 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Brand = void 0;
const typeorm_1 = require("typeorm");
const product_type_enum_1 = require("../enums/product-type.enum");
const product_entity_1 = require("./product.entity");
let Brand = class Brand {
id;
name;
slug;
imageUrl;
type;
products;
createdAt;
updatedAt;
};
exports.Brand = Brand;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], Brand.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ unique: true, length: 150 }),
__metadata("design:type", String)
], Brand.prototype, "name", void 0);
__decorate([
(0, typeorm_1.Column)({ unique: true, length: 180 }),
__metadata("design:type", String)
], Brand.prototype, "slug", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'image_url', type: 'varchar', length: 500, nullable: true }),
__metadata("design:type", Object)
], Brand.prototype, "imageUrl", void 0);
__decorate([
(0, typeorm_1.Column)({
type: 'enum',
enum: product_type_enum_1.ProductType,
}),
__metadata("design:type", String)
], Brand.prototype, "type", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => product_entity_1.Product, (product) => product.brandEntity),
__metadata("design:type", Array)
], Brand.prototype, "products", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
__metadata("design:type", Date)
], Brand.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
__metadata("design:type", Date)
], Brand.prototype, "updatedAt", void 0);
exports.Brand = Brand = __decorate([
(0, typeorm_1.Entity)({ name: 'brands' })
], Brand);
//# sourceMappingURL=brand.entity.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"brand.entity.js","sourceRoot":"","sources":["../../../../src/modules/catalog/entities/brand.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAOiB;AACjB,kEAAyD;AACzD,qDAA2C;AAGpC,IAAM,KAAK,GAAX,MAAM,KAAK;IAEhB,EAAE,CAAS;IAGX,IAAI,CAAS;IAGb,IAAI,CAAS;IAGb,QAAQ,CAAiB;IAMzB,IAAI,CAAc;IAGlB,QAAQ,CAAY;IAGpB,SAAS,CAAO;IAGhB,SAAS,CAAO;CACjB,CAAA;AA3BY,sBAAK;AAEhB;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;iCACpB;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;mCACzB;AAGb;IADC,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;mCACzB;AAGb;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uCACnD;AAMzB;IAJC,IAAA,gBAAM,EAAC;QACN,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,+BAAW;KAClB,CAAC;;mCACgB;AAGlB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,wBAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC;;uCACvC;AAGpB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BAC9B,IAAI;wCAAC;AAGhB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BAC9B,IAAI;wCAAC;gBA1BL,KAAK;IADjB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;GACd,KAAK,CA2BjB"}

View File

@@ -0,0 +1,15 @@
import { ProductType } from '../enums/product-type.enum';
import { Product } from './product.entity';
export declare class Category {
id: string;
name: string;
slug: string;
imageUrl?: string | null;
type: ProductType;
parent?: Category | null;
children: Category[];
primaryProducts: Product[];
products: Product[];
createdAt: Date;
updatedAt: Date;
}

View File

@@ -0,0 +1,83 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Category = void 0;
const typeorm_1 = require("typeorm");
const product_type_enum_1 = require("../enums/product-type.enum");
const product_entity_1 = require("./product.entity");
let Category = class Category {
id;
name;
slug;
imageUrl;
type;
parent;
children;
primaryProducts;
products;
createdAt;
updatedAt;
};
exports.Category = Category;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], Category.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ unique: true, length: 150 }),
__metadata("design:type", String)
], Category.prototype, "name", void 0);
__decorate([
(0, typeorm_1.Column)({ unique: true, length: 180 }),
__metadata("design:type", String)
], Category.prototype, "slug", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'image_url', type: 'varchar', length: 500, nullable: true }),
__metadata("design:type", Object)
], Category.prototype, "imageUrl", void 0);
__decorate([
(0, typeorm_1.Column)({
type: 'enum',
enum: product_type_enum_1.ProductType,
}),
__metadata("design:type", String)
], Category.prototype, "type", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => Category, (category) => category.children, {
nullable: true,
onDelete: 'SET NULL',
}),
__metadata("design:type", Object)
], Category.prototype, "parent", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => Category, (category) => category.parent),
__metadata("design:type", Array)
], Category.prototype, "children", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => product_entity_1.Product, (product) => product.primaryCategory),
__metadata("design:type", Array)
], Category.prototype, "primaryProducts", void 0);
__decorate([
(0, typeorm_1.ManyToMany)(() => product_entity_1.Product, (product) => product.categories),
__metadata("design:type", Array)
], Category.prototype, "products", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
__metadata("design:type", Date)
], Category.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
__metadata("design:type", Date)
], Category.prototype, "updatedAt", void 0);
exports.Category = Category = __decorate([
(0, typeorm_1.Entity)({ name: 'categories' })
], Category);
//# sourceMappingURL=category.entity.js.map

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AC,MAAM,CAAC;;0CACpC;AAGrB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,wBAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC;;iDACpC;AAG3B;IADC,IAAA,oBAAU,EAAC,GAAG,EAAE,CAAC,wBAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC;;0CACvC;AAGpB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BAC9B,IAAI;2CAAC;AAGhB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BAC9B,IAAI;2CAAC;mBAtCL,QAAQ;IADpB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;GAClB,QAAQ,CAuCpB"}

View File

@@ -0,0 +1,12 @@
import { AttributeDefinition } from './attribute-definition.entity';
import { Product } from './product.entity';
export declare class ProductAttributeValue {
id: string;
product: Product;
attribute: AttributeDefinition;
valueText?: string | null;
valueNumber?: number | null;
valueBoolean?: boolean | null;
valueJson?: Record<string, unknown> | string[] | null;
overrideUnit?: string | null;
}

View File

@@ -0,0 +1,77 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProductAttributeValue = void 0;
const typeorm_1 = require("typeorm");
const attribute_definition_entity_1 = require("./attribute-definition.entity");
const product_entity_1 = require("./product.entity");
let ProductAttributeValue = class ProductAttributeValue {
id;
product;
attribute;
valueText;
valueNumber;
valueBoolean;
valueJson;
overrideUnit;
};
exports.ProductAttributeValue = ProductAttributeValue;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], ProductAttributeValue.prototype, "id", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => product_entity_1.Product, (product) => product.attributeValues, {
onDelete: 'CASCADE',
}),
__metadata("design:type", product_entity_1.Product)
], ProductAttributeValue.prototype, "product", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => attribute_definition_entity_1.AttributeDefinition, (attribute) => attribute.values, {
eager: true,
onDelete: 'CASCADE',
}),
__metadata("design:type", attribute_definition_entity_1.AttributeDefinition)
], ProductAttributeValue.prototype, "attribute", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'value_text', type: 'varchar', length: 255, nullable: true }),
__metadata("design:type", Object)
], ProductAttributeValue.prototype, "valueText", void 0);
__decorate([
(0, typeorm_1.Column)({
name: 'value_number',
type: 'numeric',
precision: 12,
scale: 3,
nullable: true,
transformer: {
to: (value) => value,
from: (value) => value === null || value === undefined ? null : Number(value),
},
}),
__metadata("design:type", Object)
], ProductAttributeValue.prototype, "valueNumber", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'value_boolean', type: 'boolean', nullable: true }),
__metadata("design:type", Object)
], ProductAttributeValue.prototype, "valueBoolean", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'value_json', type: 'jsonb', nullable: true }),
__metadata("design:type", Object)
], ProductAttributeValue.prototype, "valueJson", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'override_unit', type: 'varchar', length: 50, nullable: true }),
__metadata("design:type", Object)
], ProductAttributeValue.prototype, "overrideUnit", void 0);
exports.ProductAttributeValue = ProductAttributeValue = __decorate([
(0, typeorm_1.Entity)({ name: 'product_attribute_values' })
], ProductAttributeValue);
//# sourceMappingURL=product-attribute-value.entity.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"product-attribute-value.entity.js","sourceRoot":"","sources":["../../../../src/modules/catalog/entities/product-attribute-value.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAKiB;AACjB,+EAAoE;AACpE,qDAA2C;AAGpC,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAEhC,EAAE,CAAS;IAKX,OAAO,CAAU;IAMjB,SAAS,CAAsB;IAG/B,SAAS,CAAiB;IAc1B,WAAW,CAAiB;IAG5B,YAAY,CAAkB;IAG9B,SAAS,CAA6C;IAGtD,YAAY,CAAiB;CAC9B,CAAA;AAxCY,sDAAqB;AAEhC;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;iDACpB;AAKX;IAHC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,wBAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE;QAC9D,QAAQ,EAAE,SAAS;KACpB,CAAC;8BACO,wBAAO;sDAAC;AAMjB;IAJC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,iDAAmB,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE;QACrE,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,SAAS;KACpB,CAAC;8BACS,iDAAmB;wDAAC;AAG/B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wDACnD;AAc1B;IAZC,IAAA,gBAAM,EAAC;QACN,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,EAAE;QACb,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE;YACX,EAAE,EAAE,CAAC,KAAqB,EAAE,EAAE,CAAC,KAAK;YACpC,IAAI,EAAE,CAAC,KAAqB,EAAE,EAAE,CAC9B,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC/D;KACF,CAAC;;0DAC0B;AAG5B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2DACrC;AAG9B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wDACR;AAGtD;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2DAClD;gCAvClB,qBAAqB;IADjC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC;GAChC,qBAAqB,CAwCjC"}

View File

@@ -0,0 +1,12 @@
import { Product } from './product.entity';
export declare class ProductMeta {
id: string;
product: Product;
shortDescription?: string | null;
description?: string | null;
metaTitle?: string | null;
metaDescription?: string | null;
shareTitle?: string | null;
shareDescription?: string | null;
shareImageUrl?: string | null;
}

View File

@@ -0,0 +1,69 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProductMeta = void 0;
const typeorm_1 = require("typeorm");
const product_entity_1 = require("./product.entity");
let ProductMeta = class ProductMeta {
id;
product;
shortDescription;
description;
metaTitle;
metaDescription;
shareTitle;
shareDescription;
shareImageUrl;
};
exports.ProductMeta = ProductMeta;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], ProductMeta.prototype, "id", void 0);
__decorate([
(0, typeorm_1.OneToOne)(() => product_entity_1.Product, (product) => product.meta, {
onDelete: 'CASCADE',
}),
(0, typeorm_1.JoinColumn)({ name: 'product_id' }),
__metadata("design:type", product_entity_1.Product)
], ProductMeta.prototype, "product", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'short_description', type: 'varchar', length: 320, nullable: true }),
__metadata("design:type", Object)
], ProductMeta.prototype, "shortDescription", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", Object)
], ProductMeta.prototype, "description", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'meta_title', type: 'varchar', length: 160, nullable: true }),
__metadata("design:type", Object)
], ProductMeta.prototype, "metaTitle", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'meta_description', type: 'varchar', length: 320, nullable: true }),
__metadata("design:type", Object)
], ProductMeta.prototype, "metaDescription", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'share_title', type: 'varchar', length: 160, nullable: true }),
__metadata("design:type", Object)
], ProductMeta.prototype, "shareTitle", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'share_description', type: 'varchar', length: 320, nullable: true }),
__metadata("design:type", Object)
], ProductMeta.prototype, "shareDescription", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'share_image_url', type: 'varchar', length: 500, nullable: true }),
__metadata("design:type", Object)
], ProductMeta.prototype, "shareImageUrl", void 0);
exports.ProductMeta = ProductMeta = __decorate([
(0, typeorm_1.Entity)({ name: 'product_meta' })
], ProductMeta);
//# sourceMappingURL=product-meta.entity.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"product-meta.entity.js","sourceRoot":"","sources":["../../../../src/modules/catalog/entities/product-meta.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAMiB;AACjB,qDAA2C;AAGpC,IAAM,WAAW,GAAjB,MAAM,WAAW;IAEtB,EAAE,CAAS;IAMX,OAAO,CAAU;IAGjB,gBAAgB,CAAiB;IAGjC,WAAW,CAAiB;IAG5B,SAAS,CAAiB;IAG1B,eAAe,CAAiB;IAGhC,UAAU,CAAiB;IAG3B,gBAAgB,CAAiB;IAGjC,aAAa,CAAiB;CAC/B,CAAA;AA9BY,kCAAW;AAEtB;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;uCACpB;AAMX;IAJC,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,wBAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE;QAClD,QAAQ,EAAE,SAAS;KACpB,CAAC;IACD,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BAC1B,wBAAO;4CAAC;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACnD;AAGjC;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACb;AAG5B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACnD;AAG1B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACnD;AAGhC;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACnD;AAG3B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACnD;AAGjC;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACpD;sBA7BnB,WAAW;IADvB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;GACpB,WAAW,CA8BvB"}

View File

@@ -0,0 +1,14 @@
import { Product } from './product.entity';
export declare class ProductReview {
id: string;
product: Product;
name: string;
email?: string | null;
rating: number;
title?: string | null;
comment: string;
isApproved: boolean;
isPinned: boolean;
createdAt: Date;
updatedAt: Date;
}

View File

@@ -0,0 +1,79 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProductReview = void 0;
const typeorm_1 = require("typeorm");
const product_entity_1 = require("./product.entity");
let ProductReview = class ProductReview {
id;
product;
name;
email;
rating;
title;
comment;
isApproved;
isPinned;
createdAt;
updatedAt;
};
exports.ProductReview = ProductReview;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], ProductReview.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Index)(),
(0, typeorm_1.ManyToOne)(() => product_entity_1.Product, (product) => product.reviews, {
onDelete: 'CASCADE',
}),
__metadata("design:type", product_entity_1.Product)
], ProductReview.prototype, "product", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 120 }),
__metadata("design:type", String)
], ProductReview.prototype, "name", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 160, nullable: true }),
__metadata("design:type", Object)
], ProductReview.prototype, "email", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'int' }),
__metadata("design:type", Number)
], ProductReview.prototype, "rating", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 160, nullable: true }),
__metadata("design:type", Object)
], ProductReview.prototype, "title", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text' }),
__metadata("design:type", String)
], ProductReview.prototype, "comment", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'is_approved', type: 'boolean', default: false }),
__metadata("design:type", Boolean)
], ProductReview.prototype, "isApproved", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'is_pinned', type: 'boolean', default: false }),
__metadata("design:type", Boolean)
], ProductReview.prototype, "isPinned", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
__metadata("design:type", Date)
], ProductReview.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
__metadata("design:type", Date)
], ProductReview.prototype, "updatedAt", void 0);
exports.ProductReview = ProductReview = __decorate([
(0, typeorm_1.Entity)({ name: 'product_reviews' })
], ProductReview);
//# sourceMappingURL=product-review.entity.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"product-review.entity.js","sourceRoot":"","sources":["../../../../src/modules/catalog/entities/product-review.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAQiB;AACjB,qDAA2C;AAGpC,IAAM,aAAa,GAAnB,MAAM,aAAa;IAExB,EAAE,CAAS;IAMX,OAAO,CAAU;IAGjB,IAAI,CAAS;IAGb,KAAK,CAAiB;IAGtB,MAAM,CAAS;IAGf,KAAK,CAAiB;IAGtB,OAAO,CAAS;IAGhB,UAAU,CAAU;IAGpB,QAAQ,CAAU;IAGlB,SAAS,CAAO;IAGhB,SAAS,CAAO;CACjB,CAAA;AApCY,sCAAa;AAExB;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;yCACpB;AAMX;IAJC,IAAA,eAAK,GAAE;IACP,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,wBAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;QACtD,QAAQ,EAAE,SAAS;KACpB,CAAC;8BACO,wBAAO;8CAAC;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;2CAC5B;AAGb;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACnC;AAGtB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;6CACT;AAGf;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACnC;AAGtB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CACT;AAGhB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;iDAC7C;AAGpB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;+CAC7C;AAGlB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BAC9B,IAAI;gDAAC;AAGhB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BAC9B,IAAI;gDAAC;wBAnCL,aAAa;IADzB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;GACvB,aAAa,CAoCzB"}

View File

@@ -0,0 +1,35 @@
import { ProductStatus } from '../enums/product-status.enum';
import { ProductType } from '../enums/product-type.enum';
import { Brand } from './brand.entity';
import { Category } from './category.entity';
import { ProductAttributeValue } from './product-attribute-value.entity';
import { ProductMeta } from './product-meta.entity';
import { ProductReview } from './product-review.entity';
export declare class Product {
id: string;
sku: string;
title: string;
slug: string;
technicalCode: string;
brand: string;
brandEntity?: Brand | null;
basePriceUSD: number;
salePriceUSD?: number | null;
stock: number;
featured: boolean;
type: ProductType;
status: ProductStatus;
mainImageUrl?: string | null;
threeDModelUrl?: string | null;
imageGalleryUrls: string[];
tags: string[];
averageRating: number;
reviewsCount: number;
primaryCategory?: Category | null;
categories: Category[];
meta: ProductMeta;
attributeValues: ProductAttributeValue[];
reviews: ProductReview[];
createdAt: Date;
updatedAt: Date;
}

View File

@@ -0,0 +1,221 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Product = void 0;
const typeorm_1 = require("typeorm");
const product_status_enum_1 = require("../enums/product-status.enum");
const product_type_enum_1 = require("../enums/product-type.enum");
const brand_entity_1 = require("./brand.entity");
const category_entity_1 = require("./category.entity");
const product_attribute_value_entity_1 = require("./product-attribute-value.entity");
const product_meta_entity_1 = require("./product-meta.entity");
const product_review_entity_1 = require("./product-review.entity");
let Product = class Product {
id;
sku;
title;
slug;
technicalCode;
brand;
brandEntity;
basePriceUSD;
salePriceUSD;
stock;
featured;
type;
status;
mainImageUrl;
threeDModelUrl;
imageGalleryUrls;
tags;
averageRating;
reviewsCount;
primaryCategory;
categories;
meta;
attributeValues;
reviews;
createdAt;
updatedAt;
};
exports.Product = Product;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], Product.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ unique: true, length: 80 }),
__metadata("design:type", String)
], Product.prototype, "sku", void 0);
__decorate([
(0, typeorm_1.Index)(),
(0, typeorm_1.Column)({ length: 160 }),
__metadata("design:type", String)
], Product.prototype, "title", void 0);
__decorate([
(0, typeorm_1.Index)(),
(0, typeorm_1.Column)({ unique: true, length: 180 }),
__metadata("design:type", String)
], Product.prototype, "slug", void 0);
__decorate([
(0, typeorm_1.Index)(),
(0, typeorm_1.Column)({ name: 'technical_code', length: 120 }),
__metadata("design:type", String)
], Product.prototype, "technicalCode", void 0);
__decorate([
(0, typeorm_1.Column)({ length: 120 }),
__metadata("design:type", String)
], Product.prototype, "brand", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => brand_entity_1.Brand, (brand) => brand.products, {
nullable: true,
onDelete: 'SET NULL',
}),
__metadata("design:type", Object)
], Product.prototype, "brandEntity", void 0);
__decorate([
(0, typeorm_1.Column)({
name: 'base_price_usd',
type: 'numeric',
precision: 12,
scale: 2,
transformer: {
to: (value) => value,
from: (value) => Number(value),
},
}),
__metadata("design:type", Number)
], Product.prototype, "basePriceUSD", void 0);
__decorate([
(0, typeorm_1.Column)({
name: 'sale_price_usd',
type: 'numeric',
precision: 12,
scale: 2,
nullable: true,
transformer: {
to: (value) => value,
from: (value) => value === null || value === undefined ? null : Number(value),
},
}),
__metadata("design:type", Object)
], Product.prototype, "salePriceUSD", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'int', default: 0 }),
__metadata("design:type", Number)
], Product.prototype, "stock", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'boolean', default: false }),
__metadata("design:type", Boolean)
], Product.prototype, "featured", void 0);
__decorate([
(0, typeorm_1.Column)({
type: 'enum',
enum: product_type_enum_1.ProductType,
}),
__metadata("design:type", String)
], Product.prototype, "type", void 0);
__decorate([
(0, typeorm_1.Column)({
type: 'enum',
enum: product_status_enum_1.ProductStatus,
default: product_status_enum_1.ProductStatus.DRAFT,
}),
__metadata("design:type", String)
], Product.prototype, "status", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', name: 'main_image_url', nullable: true, length: 500 }),
__metadata("design:type", Object)
], Product.prototype, "mainImageUrl", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', name: '3d_model_url', nullable: true, length: 500 }),
__metadata("design:type", Object)
], Product.prototype, "threeDModelUrl", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'jsonb', name: 'image_gallery_urls', default: () => "'[]'" }),
__metadata("design:type", Array)
], Product.prototype, "imageGalleryUrls", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'jsonb', default: () => "'[]'" }),
__metadata("design:type", Array)
], Product.prototype, "tags", void 0);
__decorate([
(0, typeorm_1.Column)({
name: 'average_rating',
type: 'numeric',
precision: 3,
scale: 2,
default: 0,
transformer: {
to: (value) => value,
from: (value) => Number(value),
},
}),
__metadata("design:type", Number)
], Product.prototype, "averageRating", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'reviews_count', type: 'int', default: 0 }),
__metadata("design:type", Number)
], Product.prototype, "reviewsCount", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => category_entity_1.Category, (category) => category.primaryProducts, {
nullable: true,
onDelete: 'SET NULL',
}),
__metadata("design:type", Object)
], Product.prototype, "primaryCategory", void 0);
__decorate([
(0, typeorm_1.ManyToMany)(() => category_entity_1.Category, (category) => category.products, {
cascade: false,
}),
(0, typeorm_1.JoinTable)({
name: 'product_categories',
joinColumn: {
name: 'product_id',
referencedColumnName: 'id',
},
inverseJoinColumn: {
name: 'category_id',
referencedColumnName: 'id',
},
}),
__metadata("design:type", Array)
], Product.prototype, "categories", void 0);
__decorate([
(0, typeorm_1.OneToOne)(() => product_meta_entity_1.ProductMeta, (meta) => meta.product, {
cascade: true,
eager: true,
}),
__metadata("design:type", product_meta_entity_1.ProductMeta)
], Product.prototype, "meta", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => product_attribute_value_entity_1.ProductAttributeValue, (attributeValue) => attributeValue.product, {
cascade: true,
eager: true,
}),
__metadata("design:type", Array)
], Product.prototype, "attributeValues", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => product_review_entity_1.ProductReview, (review) => review.product),
__metadata("design:type", Array)
], Product.prototype, "reviews", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
__metadata("design:type", Date)
], Product.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
__metadata("design:type", Date)
], Product.prototype, "updatedAt", void 0);
exports.Product = Product = __decorate([
(0, typeorm_1.Entity)({ name: 'products' })
], Product);
//# sourceMappingURL=product.entity.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"product.entity.js","sourceRoot":"","sources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AAO;IADnB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;GAChB,OAAO,CA+InB"}

View File

@@ -0,0 +1,8 @@
export declare enum AttributeDataType {
TEXT = "text",
NUMBER = "number",
BOOLEAN = "boolean",
SELECT = "select",
MULTISELECT = "multiselect",
JSON = "json"
}

View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AttributeDataType = void 0;
var AttributeDataType;
(function (AttributeDataType) {
AttributeDataType["TEXT"] = "text";
AttributeDataType["NUMBER"] = "number";
AttributeDataType["BOOLEAN"] = "boolean";
AttributeDataType["SELECT"] = "select";
AttributeDataType["MULTISELECT"] = "multiselect";
AttributeDataType["JSON"] = "json";
})(AttributeDataType || (exports.AttributeDataType = AttributeDataType = {}));
//# sourceMappingURL=attribute-data-type.enum.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"attribute-data-type.enum.js","sourceRoot":"","sources":["../../../../src/modules/catalog/enums/attribute-data-type.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAC3B,kCAAa,CAAA;IACb,sCAAiB,CAAA;IACjB,wCAAmB,CAAA;IACnB,sCAAiB,CAAA;IACjB,gDAA2B,CAAA;IAC3B,kCAAa,CAAA;AACf,CAAC,EAPW,iBAAiB,iCAAjB,iBAAiB,QAO5B"}

View File

@@ -0,0 +1,5 @@
export declare enum ProductStatus {
DRAFT = "draft",
PUBLISHED = "published",
ARCHIVED = "archived"
}

View File

@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProductStatus = void 0;
var ProductStatus;
(function (ProductStatus) {
ProductStatus["DRAFT"] = "draft";
ProductStatus["PUBLISHED"] = "published";
ProductStatus["ARCHIVED"] = "archived";
})(ProductStatus || (exports.ProductStatus = ProductStatus = {}));
//# sourceMappingURL=product-status.enum.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"product-status.enum.js","sourceRoot":"","sources":["../../../../src/modules/catalog/enums/product-status.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,gCAAe,CAAA;IACf,wCAAuB,CAAA;IACvB,sCAAqB,CAAA;AACvB,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB"}

View File

@@ -0,0 +1,4 @@
export declare enum ProductType {
INDUSTRIAL = "Industrial",
AUTOMOTIVE = "Automotive"
}

View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProductType = void 0;
var ProductType;
(function (ProductType) {
ProductType["INDUSTRIAL"] = "Industrial";
ProductType["AUTOMOTIVE"] = "Automotive";
})(ProductType || (exports.ProductType = ProductType = {}));
//# sourceMappingURL=product-type.enum.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"product-type.enum.js","sourceRoot":"","sources":["../../../../src/modules/catalog/enums/product-type.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,wCAAyB,CAAA;IACzB,wCAAyB,CAAA;AAC3B,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB"}

View File

@@ -0,0 +1,243 @@
import { CreateProductReviewDto } from './dto/create-product-review.dto';
import { FilterProductsDto } from './dto/filter-products.dto';
import { ProductsService } from './products.service';
export declare class ProductsController {
private readonly productsService;
constructor(productsService: ProductsService);
findAll(filters: FilterProductsDto): Promise<{
items: {
attributes: {
id: string;
attributeId: string;
name: string;
slug: string;
dataType: import("./enums/attribute-data-type.enum").AttributeDataType;
unit: string | null;
options: string[];
isFilterable: boolean;
isVisible: boolean;
valueText: string | null;
valueNumber: number | null;
valueBoolean: boolean | null;
valueJson: string[] | Record<string, unknown> | null;
}[];
meta: import("./entities/product-meta.entity").ProductMeta | {
shortDescription: string | null;
description: string | null;
seo: {
title: string;
description: string | null;
} | undefined;
share: {
title: string;
description: string | null;
imageUrl: string | null | undefined;
};
};
brandInfo: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
primaryCategory: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
categories: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
}[];
id: string;
sku: string;
title: string;
slug: string;
technicalCode: string;
brand: string;
brandEntity?: import("./entities/brand.entity").Brand | null;
basePriceUSD: number;
salePriceUSD?: number | null;
stock: number;
featured: boolean;
type: import("./enums/product-type.enum").ProductType;
status: import("./enums/product-status.enum").ProductStatus;
mainImageUrl?: string | null;
threeDModelUrl?: string | null;
imageGalleryUrls: string[];
tags: string[];
averageRating: number;
reviewsCount: number;
attributeValues: import("./entities/product-attribute-value.entity").ProductAttributeValue[];
reviews: import("./entities/product-review.entity").ProductReview[];
createdAt: Date;
updatedAt: Date;
}[];
meta: {
total: number;
page: number;
limit: number;
};
}>;
findBySlug(slug: string): Promise<{
approvedReviews: import("./entities/product-review.entity").ProductReview[];
attributes: {
id: string;
attributeId: string;
name: string;
slug: string;
dataType: import("./enums/attribute-data-type.enum").AttributeDataType;
unit: string | null;
options: string[];
isFilterable: boolean;
isVisible: boolean;
valueText: string | null;
valueNumber: number | null;
valueBoolean: boolean | null;
valueJson: string[] | Record<string, unknown> | null;
}[];
meta: import("./entities/product-meta.entity").ProductMeta | {
shortDescription: string | null;
description: string | null;
seo: {
title: string;
description: string | null;
} | undefined;
share: {
title: string;
description: string | null;
imageUrl: string | null | undefined;
};
};
brandInfo: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
primaryCategory: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
categories: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
}[];
id: string;
sku: string;
title: string;
slug: string;
technicalCode: string;
brand: string;
brandEntity?: import("./entities/brand.entity").Brand | null;
basePriceUSD: number;
salePriceUSD?: number | null;
stock: number;
featured: boolean;
type: import("./enums/product-type.enum").ProductType;
status: import("./enums/product-status.enum").ProductStatus;
mainImageUrl?: string | null;
threeDModelUrl?: string | null;
imageGalleryUrls: string[];
tags: string[];
averageRating: number;
reviewsCount: number;
attributeValues: import("./entities/product-attribute-value.entity").ProductAttributeValue[];
reviews: import("./entities/product-review.entity").ProductReview[];
createdAt: Date;
updatedAt: Date;
}>;
findApprovedReviews(id: string): Promise<import("./entities/product-review.entity").ProductReview[]>;
createReview(id: string, dto: CreateProductReviewDto): Promise<{
message: string;
reviewId: string;
}>;
findOne(id: string): Promise<{
approvedReviews: import("./entities/product-review.entity").ProductReview[];
attributes: {
id: string;
attributeId: string;
name: string;
slug: string;
dataType: import("./enums/attribute-data-type.enum").AttributeDataType;
unit: string | null;
options: string[];
isFilterable: boolean;
isVisible: boolean;
valueText: string | null;
valueNumber: number | null;
valueBoolean: boolean | null;
valueJson: string[] | Record<string, unknown> | null;
}[];
meta: import("./entities/product-meta.entity").ProductMeta | {
shortDescription: string | null;
description: string | null;
seo: {
title: string;
description: string | null;
} | undefined;
share: {
title: string;
description: string | null;
imageUrl: string | null | undefined;
};
};
brandInfo: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
primaryCategory: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
categories: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
}[];
id: string;
sku: string;
title: string;
slug: string;
technicalCode: string;
brand: string;
brandEntity?: import("./entities/brand.entity").Brand | null;
basePriceUSD: number;
salePriceUSD?: number | null;
stock: number;
featured: boolean;
type: import("./enums/product-type.enum").ProductType;
status: import("./enums/product-status.enum").ProductStatus;
mainImageUrl?: string | null;
threeDModelUrl?: string | null;
imageGalleryUrls: string[];
tags: string[];
averageRating: number;
reviewsCount: number;
attributeValues: import("./entities/product-attribute-value.entity").ProductAttributeValue[];
reviews: import("./entities/product-review.entity").ProductReview[];
createdAt: Date;
updatedAt: Date;
}>;
}

View File

@@ -0,0 +1,90 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProductsController = void 0;
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const create_product_review_dto_1 = require("./dto/create-product-review.dto");
const filter_products_dto_1 = require("./dto/filter-products.dto");
const products_service_1 = require("./products.service");
let ProductsController = class ProductsController {
productsService;
constructor(productsService) {
this.productsService = productsService;
}
findAll(filters) {
return this.productsService.findPublic(filters);
}
findBySlug(slug) {
return this.productsService.findPublicOneBySlug(slug);
}
findApprovedReviews(id) {
return this.productsService.findApprovedReviews(id);
}
createReview(id, dto) {
return this.productsService.createReview(id, dto);
}
findOne(id) {
return this.productsService.findPublicOne(id);
}
};
exports.ProductsController = ProductsController;
__decorate([
(0, common_1.Get)(),
(0, swagger_1.ApiOperation)({ summary: 'List published products for storefront' }),
__param(0, (0, common_1.Query)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [filter_products_dto_1.FilterProductsDto]),
__metadata("design:returntype", void 0)
], ProductsController.prototype, "findAll", null);
__decorate([
(0, common_1.Get)('slug/:slug'),
(0, swagger_1.ApiOperation)({ summary: 'Get one published product by slug' }),
__param(0, (0, common_1.Param)('slug')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], ProductsController.prototype, "findBySlug", null);
__decorate([
(0, common_1.Get)(':id/reviews'),
(0, swagger_1.ApiOperation)({ summary: 'List approved reviews for a product' }),
__param(0, (0, common_1.Param)('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], ProductsController.prototype, "findApprovedReviews", null);
__decorate([
(0, common_1.Post)(':id/reviews'),
(0, swagger_1.ApiOperation)({ summary: 'Submit a new product review' }),
(0, swagger_1.ApiBody)({ type: create_product_review_dto_1.CreateProductReviewDto }),
__param(0, (0, common_1.Param)('id')),
__param(1, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, create_product_review_dto_1.CreateProductReviewDto]),
__metadata("design:returntype", void 0)
], ProductsController.prototype, "createReview", null);
__decorate([
(0, common_1.Get)(':id'),
(0, swagger_1.ApiOperation)({ summary: 'Get one published product with approved reviews summary' }),
__param(0, (0, common_1.Param)('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], ProductsController.prototype, "findOne", null);
exports.ProductsController = ProductsController = __decorate([
(0, swagger_1.ApiTags)('Products'),
(0, common_1.Controller)('products'),
__metadata("design:paramtypes", [products_service_1.ProductsService])
], ProductsController);
//# sourceMappingURL=products.controller.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"products.controller.js","sourceRoot":"","sources":["../../../src/modules/catalog/products.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA2E;AAC3E,6CAAiE;AACjE,+EAAyE;AACzE,mEAA8D;AAC9D,yDAAqD;AAI9C,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IACA;IAA7B,YAA6B,eAAgC;QAA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EAAE,IAAI,EAAE,kDAAsB,EAAE,CAAC;IAC5B,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;IAAc,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAM,kDAAsB;;sDAExE;AAID;IAFC,IAAA,YAAG,EAAC,KAAK,CAAC;IACV,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,yDAAyD,EAAE,CAAC;IAC5E,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;iDAEnB;6BAhCU,kBAAkB;IAF9B,IAAA,iBAAO,EAAC,UAAU,CAAC;IACnB,IAAA,mBAAU,EAAC,UAAU,CAAC;qCAEyB,kCAAe;GADlD,kBAAkB,CAiC9B"}

View File

@@ -0,0 +1,614 @@
import { Repository } from 'typeorm';
import { StorageService } from '../storage/storage.service';
import { CreateAttributeDefinitionDto } from './dto/create-attribute-definition.dto';
import { CreateProductDto } from './dto/create-product.dto';
import { CreateProductReviewDto } from './dto/create-product-review.dto';
import { FilterProductReviewsDto } from './dto/filter-product-reviews.dto';
import { FilterProductsDto } from './dto/filter-products.dto';
import { ModerateProductReviewDto } from './dto/moderate-product-review.dto';
import { UpdateAttributeDefinitionDto } from './dto/update-attribute-definition.dto';
import { UpdateProductDto } from './dto/update-product.dto';
import { AttributeDefinition } from './entities/attribute-definition.entity';
import { Brand } from './entities/brand.entity';
import { Category } from './entities/category.entity';
import { ProductAttributeValue } from './entities/product-attribute-value.entity';
import { ProductMeta } from './entities/product-meta.entity';
import { Product } from './entities/product.entity';
import { ProductReview } from './entities/product-review.entity';
import { AttributeDataType } from './enums/attribute-data-type.enum';
import { ProductStatus } from './enums/product-status.enum';
export declare class ProductsService {
private readonly productsRepository;
private readonly productMetaRepository;
private readonly productAttributeValuesRepository;
private readonly attributeDefinitionsRepository;
private readonly productReviewsRepository;
private readonly categoriesRepository;
private readonly brandsRepository;
private readonly storageService;
constructor(productsRepository: Repository<Product>, productMetaRepository: Repository<ProductMeta>, productAttributeValuesRepository: Repository<ProductAttributeValue>, attributeDefinitionsRepository: Repository<AttributeDefinition>, productReviewsRepository: Repository<ProductReview>, categoriesRepository: Repository<Category>, brandsRepository: Repository<Brand>, storageService: StorageService);
create(dto: CreateProductDto, files?: {
mainImage?: Express.Multer.File[];
images?: Express.Multer.File[];
model3d?: Express.Multer.File[];
}): Promise<{
attributes: {
id: string;
attributeId: string;
name: string;
slug: string;
dataType: AttributeDataType;
unit: string | null;
options: string[];
isFilterable: boolean;
isVisible: boolean;
valueText: string | null;
valueNumber: number | null;
valueBoolean: boolean | null;
valueJson: string[] | Record<string, unknown> | null;
}[];
meta: ProductMeta | {
shortDescription: string | null;
description: string | null;
seo: {
title: string;
description: string | null;
} | undefined;
share: {
title: string;
description: string | null;
imageUrl: string | null | undefined;
};
};
brandInfo: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
primaryCategory: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
categories: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
}[];
id: string;
sku: string;
title: string;
slug: string;
technicalCode: string;
brand: string;
brandEntity?: Brand | null;
basePriceUSD: number;
salePriceUSD?: number | null;
stock: number;
featured: boolean;
type: import("./enums/product-type.enum").ProductType;
status: ProductStatus;
mainImageUrl?: string | null;
threeDModelUrl?: string | null;
imageGalleryUrls: string[];
tags: string[];
averageRating: number;
reviewsCount: number;
attributeValues: ProductAttributeValue[];
reviews: ProductReview[];
createdAt: Date;
updatedAt: Date;
}>;
findPublic(filters: FilterProductsDto): Promise<{
items: {
attributes: {
id: string;
attributeId: string;
name: string;
slug: string;
dataType: AttributeDataType;
unit: string | null;
options: string[];
isFilterable: boolean;
isVisible: boolean;
valueText: string | null;
valueNumber: number | null;
valueBoolean: boolean | null;
valueJson: string[] | Record<string, unknown> | null;
}[];
meta: ProductMeta | {
shortDescription: string | null;
description: string | null;
seo: {
title: string;
description: string | null;
} | undefined;
share: {
title: string;
description: string | null;
imageUrl: string | null | undefined;
};
};
brandInfo: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
primaryCategory: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
categories: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
}[];
id: string;
sku: string;
title: string;
slug: string;
technicalCode: string;
brand: string;
brandEntity?: Brand | null;
basePriceUSD: number;
salePriceUSD?: number | null;
stock: number;
featured: boolean;
type: import("./enums/product-type.enum").ProductType;
status: ProductStatus;
mainImageUrl?: string | null;
threeDModelUrl?: string | null;
imageGalleryUrls: string[];
tags: string[];
averageRating: number;
reviewsCount: number;
attributeValues: ProductAttributeValue[];
reviews: ProductReview[];
createdAt: Date;
updatedAt: Date;
}[];
meta: {
total: number;
page: number;
limit: number;
};
}>;
findAdmin(filters: FilterProductsDto): Promise<{
items: {
attributes: {
id: string;
attributeId: string;
name: string;
slug: string;
dataType: AttributeDataType;
unit: string | null;
options: string[];
isFilterable: boolean;
isVisible: boolean;
valueText: string | null;
valueNumber: number | null;
valueBoolean: boolean | null;
valueJson: string[] | Record<string, unknown> | null;
}[];
meta: ProductMeta | {
shortDescription: string | null;
description: string | null;
seo: {
title: string;
description: string | null;
} | undefined;
share: {
title: string;
description: string | null;
imageUrl: string | null | undefined;
};
};
brandInfo: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
primaryCategory: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
categories: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
}[];
id: string;
sku: string;
title: string;
slug: string;
technicalCode: string;
brand: string;
brandEntity?: Brand | null;
basePriceUSD: number;
salePriceUSD?: number | null;
stock: number;
featured: boolean;
type: import("./enums/product-type.enum").ProductType;
status: ProductStatus;
mainImageUrl?: string | null;
threeDModelUrl?: string | null;
imageGalleryUrls: string[];
tags: string[];
averageRating: number;
reviewsCount: number;
attributeValues: ProductAttributeValue[];
reviews: ProductReview[];
createdAt: Date;
updatedAt: Date;
}[];
meta: {
total: number;
page: number;
limit: number;
};
}>;
checkSlugAvailability(slug: string, excludeId?: string): Promise<boolean>;
findPublicOne(id: string): Promise<{
approvedReviews: ProductReview[];
attributes: {
id: string;
attributeId: string;
name: string;
slug: string;
dataType: AttributeDataType;
unit: string | null;
options: string[];
isFilterable: boolean;
isVisible: boolean;
valueText: string | null;
valueNumber: number | null;
valueBoolean: boolean | null;
valueJson: string[] | Record<string, unknown> | null;
}[];
meta: ProductMeta | {
shortDescription: string | null;
description: string | null;
seo: {
title: string;
description: string | null;
} | undefined;
share: {
title: string;
description: string | null;
imageUrl: string | null | undefined;
};
};
brandInfo: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
primaryCategory: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
categories: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
}[];
id: string;
sku: string;
title: string;
slug: string;
technicalCode: string;
brand: string;
brandEntity?: Brand | null;
basePriceUSD: number;
salePriceUSD?: number | null;
stock: number;
featured: boolean;
type: import("./enums/product-type.enum").ProductType;
status: ProductStatus;
mainImageUrl?: string | null;
threeDModelUrl?: string | null;
imageGalleryUrls: string[];
tags: string[];
averageRating: number;
reviewsCount: number;
attributeValues: ProductAttributeValue[];
reviews: ProductReview[];
createdAt: Date;
updatedAt: Date;
}>;
findPublicOneBySlug(slug: string): Promise<{
approvedReviews: ProductReview[];
attributes: {
id: string;
attributeId: string;
name: string;
slug: string;
dataType: AttributeDataType;
unit: string | null;
options: string[];
isFilterable: boolean;
isVisible: boolean;
valueText: string | null;
valueNumber: number | null;
valueBoolean: boolean | null;
valueJson: string[] | Record<string, unknown> | null;
}[];
meta: ProductMeta | {
shortDescription: string | null;
description: string | null;
seo: {
title: string;
description: string | null;
} | undefined;
share: {
title: string;
description: string | null;
imageUrl: string | null | undefined;
};
};
brandInfo: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
primaryCategory: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
categories: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
}[];
id: string;
sku: string;
title: string;
slug: string;
technicalCode: string;
brand: string;
brandEntity?: Brand | null;
basePriceUSD: number;
salePriceUSD?: number | null;
stock: number;
featured: boolean;
type: import("./enums/product-type.enum").ProductType;
status: ProductStatus;
mainImageUrl?: string | null;
threeDModelUrl?: string | null;
imageGalleryUrls: string[];
tags: string[];
averageRating: number;
reviewsCount: number;
attributeValues: ProductAttributeValue[];
reviews: ProductReview[];
createdAt: Date;
updatedAt: Date;
}>;
findAdminOne(id: string): Promise<{
attributes: {
id: string;
attributeId: string;
name: string;
slug: string;
dataType: AttributeDataType;
unit: string | null;
options: string[];
isFilterable: boolean;
isVisible: boolean;
valueText: string | null;
valueNumber: number | null;
valueBoolean: boolean | null;
valueJson: string[] | Record<string, unknown> | null;
}[];
meta: ProductMeta | {
shortDescription: string | null;
description: string | null;
seo: {
title: string;
description: string | null;
} | undefined;
share: {
title: string;
description: string | null;
imageUrl: string | null | undefined;
};
};
brandInfo: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
primaryCategory: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
categories: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
}[];
id: string;
sku: string;
title: string;
slug: string;
technicalCode: string;
brand: string;
brandEntity?: Brand | null;
basePriceUSD: number;
salePriceUSD?: number | null;
stock: number;
featured: boolean;
type: import("./enums/product-type.enum").ProductType;
status: ProductStatus;
mainImageUrl?: string | null;
threeDModelUrl?: string | null;
imageGalleryUrls: string[];
tags: string[];
averageRating: number;
reviewsCount: number;
attributeValues: ProductAttributeValue[];
reviews: ProductReview[];
createdAt: Date;
updatedAt: Date;
}>;
createReview(productId: string, dto: CreateProductReviewDto): Promise<{
message: string;
reviewId: string;
}>;
findApprovedReviews(productId: string): Promise<ProductReview[]>;
findAdminReviews(filters: FilterProductReviewsDto): Promise<{
items: ProductReview[];
meta: {
total: number;
page: number;
limit: number;
};
}>;
updateReview(reviewId: string, dto: ModerateProductReviewDto): Promise<ProductReview>;
removeReview(reviewId: string): Promise<{
message: string;
}>;
update(id: string, dto: UpdateProductDto, files?: {
mainImage?: Express.Multer.File[];
images?: Express.Multer.File[];
model3d?: Express.Multer.File[];
}): Promise<{
attributes: {
id: string;
attributeId: string;
name: string;
slug: string;
dataType: AttributeDataType;
unit: string | null;
options: string[];
isFilterable: boolean;
isVisible: boolean;
valueText: string | null;
valueNumber: number | null;
valueBoolean: boolean | null;
valueJson: string[] | Record<string, unknown> | null;
}[];
meta: ProductMeta | {
shortDescription: string | null;
description: string | null;
seo: {
title: string;
description: string | null;
} | undefined;
share: {
title: string;
description: string | null;
imageUrl: string | null | undefined;
};
};
brandInfo: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
primaryCategory: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
} | null;
categories: {
id: string;
name: string;
slug: string;
imageUrl: string | null | undefined;
type: import("./enums/product-type.enum").ProductType;
}[];
id: string;
sku: string;
title: string;
slug: string;
technicalCode: string;
brand: string;
brandEntity?: Brand | null;
basePriceUSD: number;
salePriceUSD?: number | null;
stock: number;
featured: boolean;
type: import("./enums/product-type.enum").ProductType;
status: ProductStatus;
mainImageUrl?: string | null;
threeDModelUrl?: string | null;
imageGalleryUrls: string[];
tags: string[];
averageRating: number;
reviewsCount: number;
attributeValues: ProductAttributeValue[];
reviews: ProductReview[];
createdAt: Date;
updatedAt: Date;
}>;
remove(id: string): Promise<{
message: string;
}>;
listAttributeDefinitions(): Promise<AttributeDefinition[]>;
createAttributeDefinition(dto: CreateAttributeDefinitionDto): Promise<AttributeDefinition>;
updateAttributeDefinition(id: string, dto: UpdateAttributeDefinitionDto): Promise<AttributeDefinition>;
removeAttributeDefinition(id: string): Promise<{
message: string;
}>;
private findAll;
private applyAttributeFilters;
private findOneById;
private resolveCategories;
private resolveBrand;
private ensurePublishedProduct;
private findApprovedReviewsInternal;
private refreshReviewStats;
private saveMeta;
private syncAttributeValues;
private resolveAttributeDefinition;
private serializeProduct;
private deleteGallery;
private deleteModel;
private replaceFile;
}

Some files were not shown because too many files have changed in this diff Show More