muchos cambios :'v
This commit is contained in:
@@ -1,8 +1,28 @@
|
||||
import { IsEnum, IsOptional } from 'class-validator';
|
||||
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';
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
JoinColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
export enum TiposValidacion {
|
||||
CORREO = 'correo',
|
||||
CORREO_INSTITUCIONAL = 'correo_institucional',
|
||||
TELEFONO = 'telefono',
|
||||
NOMBRE = 'nombre',
|
||||
ENTERO = 'entero',
|
||||
DECIMAL = 'decimal',
|
||||
COMUNIDAD_ALUMNO = 'comunidad_alumno',
|
||||
CUENTA_ALUMNO = 'cuenta_alumno',
|
||||
COMUNIDAD_TRABAJADOR = 'comunidad_trabajador',
|
||||
CUENTA_TRABAJADOR = 'cuenta_trabajador',
|
||||
}
|
||||
|
||||
@Entity()
|
||||
export class Pregunta {
|
||||
@@ -18,22 +38,24 @@ export class Pregunta {
|
||||
@Column({ default: false })
|
||||
obligatoria: boolean;
|
||||
|
||||
@ManyToOne(() => TipoPregunta, tipo => tipo.preguntas)
|
||||
@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({ type: 'enum', enum: TiposValidacion, nullable: true })
|
||||
@IsOptional()
|
||||
@IsEnum(TiposValidacion, { message: 'Validación no permitida' })
|
||||
validacion?: TiposValidacion;
|
||||
|
||||
@Column({ nullable: true })
|
||||
validacion?: string;
|
||||
|
||||
@OneToMany(() => SeccionPregunta, seccionPregunta => seccionPregunta.pregunta)
|
||||
@OneToMany(
|
||||
() => SeccionPregunta,
|
||||
(seccionPregunta) => seccionPregunta.pregunta,
|
||||
)
|
||||
seccionPreguntas: SeccionPregunta[];
|
||||
|
||||
@OneToMany(() => PreguntaOpcion, preguntaOpcion => preguntaOpcion.pregunta)
|
||||
@OneToMany(() => PreguntaOpcion, (preguntaOpcion) => preguntaOpcion.pregunta)
|
||||
opciones: PreguntaOpcion[];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user