update entity

This commit is contained in:
2026-01-25 09:20:56 +03:30
parent fd96c0866e
commit dc281c4f9a
7 changed files with 35 additions and 33 deletions
@@ -1,7 +1,7 @@
import { IsString, IsOptional, IsBoolean, IsInt, Min, IsEnum, IsNotEmpty } from 'class-validator';
import { ApiPropertyOptional, ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { AttributeType } from '../interface/product.interface';
import { FieldType } from 'src/modules/print/interface/print';
export class CreateAttributeDto {
@IsString()
@@ -20,9 +20,9 @@ export class CreateAttributeDto {
isRequired: boolean;
@IsNotEmpty()
@IsEnum(AttributeType)
@ApiProperty({ enum: AttributeType, example: AttributeType.SELECT })
type: AttributeType;
@IsEnum(FieldType)
@ApiProperty({ enum: FieldType, example: FieldType.select })
type: FieldType;
@IsOptional()
@IsInt()
@@ -1,8 +1,8 @@
import { Collection, Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core';
import { BaseEntity } from '../../../common/entities/base.entity';
import { AttributeType } from '../interface/product.interface';
import { Product } from './product.entity';
import { Product } from './product.entity';
import { AttributeValue } from './attribute-value.entity';
import { FieldType } from 'src/modules/print/interface/print';
@Entity({ tableName: 'attributes' })
export class Attribute extends BaseEntity {
@@ -24,8 +24,8 @@ export class Attribute extends BaseEntity {
@Property()
name: string;
@Enum(() => AttributeType)
type: AttributeType;
@Enum(() => FieldType)
type: FieldType;
@Property({ type: 'boolean', default: false })
isRequired: boolean = false;
@@ -1,7 +1,7 @@
export enum AttributeType{
SELECT='select',
TEXT='text',
NUMBER='number',
CHECKBOX='checkbox',
BOOLEAN='boolean',
}
// export enum AttributeType{
// SELECT='select',
// TEXT='text',
// NUMBER='number',
// CHECKBOX='checkbox',
// BOOLEAN='boolean',
// }