update entity
This commit is contained in:
@@ -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',
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user