Files
parsshop-back/dist/modules/catalog/dto/create-attribute-definition.dto.js
2026-03-26 12:25:46 +03:00

74 lines
3.6 KiB
JavaScript

"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