102 lines
4.4 KiB
JavaScript
102 lines
4.4 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.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
|