39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { PreguntaOpcion } from 'src/pregunta_opcion/entities/pregunta_opcion.entity';
|
|
import { SeccionPregunta } from 'src/seccion_pregunta/entities/seccion_pregunta.entity';
|
|
import { TipoPregunta } from 'src/tipo_pregunta/entities/tipo_pregunta.entity';
|
|
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, OneToMany, JoinColumn } from 'typeorm';
|
|
|
|
|
|
@Entity()
|
|
export class Pregunta {
|
|
@PrimaryGeneratedColumn()
|
|
id_pregunta: number;
|
|
|
|
@Column()
|
|
pregunta: string;
|
|
|
|
@Column({ default: 0 })
|
|
contador_opcion: number;
|
|
|
|
@Column({ default: false })
|
|
obligatoria: boolean;
|
|
|
|
@ManyToOne(() => TipoPregunta, tipo => tipo.preguntas)
|
|
@JoinColumn({ name: 'id_tipo_pregunta' })
|
|
tipoPregunta: TipoPregunta;
|
|
|
|
@Column()
|
|
id_tipo_pregunta: number;
|
|
|
|
@Column({ type: 'int', nullable: true })
|
|
id_opcion_dependiente?: number;
|
|
|
|
@Column({ nullable: true })
|
|
validacion?: string;
|
|
|
|
@OneToMany(() => SeccionPregunta, seccionPregunta => seccionPregunta.pregunta)
|
|
seccionPreguntas: SeccionPregunta[];
|
|
|
|
@OneToMany(() => PreguntaOpcion, preguntaOpcion => preguntaOpcion.pregunta)
|
|
opciones: PreguntaOpcion[];
|
|
} |