74 lines
1.5 KiB
TypeScript
74 lines
1.5 KiB
TypeScript
import { Field, ObjectType } from "@nestjs/graphql";
|
|
import { FieldType, MyField } from "src/dto/formular.dto";
|
|
import { Column, Entity, ForeignKey, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
|
|
import { FormularEntity } from "./formular.entity";
|
|
|
|
|
|
@ObjectType()
|
|
@Entity()
|
|
export class FieldEntity implements MyField {
|
|
@Field()
|
|
@PrimaryGeneratedColumn()
|
|
id: number;
|
|
|
|
@Field()
|
|
@Column()
|
|
formular: number;
|
|
|
|
@Field(()=>FormularEntity)
|
|
@ManyToOne(()=>FormularEntity,entity=>entity.id)
|
|
@JoinColumn({name:'formular'})
|
|
formularObject: FormularEntity;
|
|
|
|
@Field()
|
|
@Column()
|
|
name: string;
|
|
|
|
@Field({nullable:true})
|
|
@Column({nullable:true})
|
|
displayname: string;
|
|
|
|
@Field()
|
|
@Column()
|
|
value: string;
|
|
|
|
@Field({nullable:true})
|
|
@Column({nullable: true})
|
|
displayvalue: string;
|
|
|
|
@Field({nullable:true})
|
|
@Column({nullable: true})
|
|
placeholder: string;
|
|
|
|
@Field()
|
|
@Column("enum",{
|
|
enum: FieldType
|
|
})
|
|
type: FieldType;
|
|
|
|
@Field({nullable:true})
|
|
@Column({nullable: true})
|
|
title: string;
|
|
|
|
@Field()
|
|
@Column({default: false})
|
|
required: boolean;
|
|
|
|
@Field({nullable:true})
|
|
@Column({nullable: true})
|
|
maxlength: number;
|
|
|
|
@Field({nullable:true})
|
|
@Column({nullable: true})
|
|
min: number;
|
|
|
|
@Field({nullable:true})
|
|
@Column({nullable: true})
|
|
max: number;
|
|
|
|
@Field({nullable:true})
|
|
@Column({nullable: true})
|
|
checked?: boolean;
|
|
|
|
|
|
} |