actualización tablas
This commit is contained in:
@@ -1 +1,32 @@
|
||||
export class CuestionarioRespondido {}
|
||||
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, OneToMany, JoinColumn } from 'typeorm';
|
||||
|
||||
import { Cuestionario } from 'src/cuestionario/entities/cuestionario.entity';
|
||||
import { RespuestaParticipanteCerrada } from 'src/respuesta_participante_cerrada/entities/respuesta_participante_cerrada.entity';
|
||||
import { RespuestaParticipanteAbierta } from 'src/respuesta_participante_abierta/entities/respuesta_participante_abierta.entity';
|
||||
|
||||
@Entity('cuestionario_respondido')
|
||||
export class CuestionarioRespondido {
|
||||
@PrimaryGeneratedColumn({ name: 'id_cuestionario_respondido' })
|
||||
idCuestionarioRespondido: number;
|
||||
|
||||
@Column({ name: 'fecha_respuesta', type: 'timestamp' })
|
||||
fechaRespuesta: Date;
|
||||
|
||||
// Relación con Participante
|
||||
@ManyToOne(() => Participante, participante => participante.cuestionariosRespondidos)
|
||||
@JoinColumn({ name: 'id_participante' })
|
||||
id_participante: Participante;
|
||||
|
||||
// Relación con Cuestionario
|
||||
@ManyToOne(() => Cuestionario, cuestionario => cuestionario.id_cuestionario)
|
||||
@JoinColumn({ name: 'id_cuestionario' })
|
||||
id_cuestionario: Cuestionario;
|
||||
|
||||
// Relación con RespuestasCerradas
|
||||
@OneToMany(() => RespuestaParticipanteCerrada, respuestaCerrada => respuestaCerrada.id_cuestionario_respondido)
|
||||
respuestasCerradas: RespuestaParticipanteCerrada[];
|
||||
|
||||
// Relación con RespuestasAbiertas
|
||||
@OneToMany(() => RespuestaParticipanteAbierta, respuestaAbierta => respuestaAbierta.id_cuestionario_respondido)
|
||||
respuestasAbiertas: RespuestaParticipanteAbierta[];
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import { PreguntaOpcion } from "src/pregunta_opcion/entities/pregunta_opcion.entity";
|
||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||
|
||||
@Entity()
|
||||
@@ -8,7 +9,7 @@ export class Opcion {
|
||||
@Column({ type: String, nullable: false, length: 200, default: '' })
|
||||
opcion: string;
|
||||
|
||||
@OneToMany(() => PreguntaOpcion, (preguntaOpcion) => preguntaOpcion.Opcion)
|
||||
@OneToMany(() => PreguntaOpcion, (preguntaOpcion) => preguntaOpcion.id_opcion)
|
||||
Preguntas: PreguntaOpcion[];
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
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' })
|
||||
id_tipo_pregunta: TipoPregunta;
|
||||
|
||||
@Column({ nullable: true })
|
||||
id_opcion_dependiente: number;
|
||||
|
||||
@OneToMany(() => SeccionPregunta, seccionPregunta => seccionPregunta.id_pregunta)
|
||||
seccionPreguntas: SeccionPregunta[];
|
||||
|
||||
@OneToMany(() => PreguntaOpcion, preguntaOpcion => preguntaOpcion.id_pregunta)
|
||||
opciones: PreguntaOpcion[];
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { Opcion } from 'src/opcion/entities/opcion.entity';
|
||||
import { Pregunta } from 'src/pregunta/entities/pregunta.entity';
|
||||
import { RespuestaParticipanteCerrada } from 'src/respuesta_participante_cerrada/entities/respuesta_participante_cerrada.entity';
|
||||
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, OneToMany } from 'typeorm';
|
||||
|
||||
|
||||
@Entity()
|
||||
export class PreguntaOpcion {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_pregunta_opcion: number;
|
||||
|
||||
@Column()
|
||||
posicion: number;
|
||||
|
||||
@ManyToOne(() => Pregunta, pregunta => pregunta.id_pregunta)
|
||||
@Column()
|
||||
id_pregunta: Pregunta;
|
||||
|
||||
@ManyToOne(() => Opcion, opcion => opcion.id_opcion)
|
||||
@Column()
|
||||
id_opcion: Opcion;
|
||||
|
||||
@OneToMany(()=> RespuestaParticipanteCerrada, respuestaParticipanteCerrada=>respuestaParticipanteCerrada.id_pregunta_opcion)
|
||||
respuestaParticipanteCerrada:RespuestaParticipanteCerrada[];
|
||||
}
|
||||
+20
-1
@@ -1 +1,20 @@
|
||||
export class RespuestaParticipanteCerrada {}
|
||||
import { CuestionarioRespondido } from 'src/cuestionario_respondido/entities/cuestionario_respondido.entity';
|
||||
import { PreguntaOpcion } from 'src/pregunta_opcion/entities/pregunta_opcion.entity';
|
||||
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn } from 'typeorm';
|
||||
|
||||
|
||||
@Entity('respuesta_participante_cerrada')
|
||||
export class RespuestaParticipanteCerrada {
|
||||
@PrimaryGeneratedColumn()
|
||||
idRespuestaParticipanteCerrada: number;
|
||||
|
||||
@ManyToOne(() => CuestionarioRespondido, cuestionarioRespondido => cuestionarioRespondido.respuestasCerradas)
|
||||
@JoinColumn({ name: 'id_cuestionario_respondido' })
|
||||
id_cuestionario_respondido: CuestionarioRespondido;
|
||||
|
||||
@ManyToOne(() => PreguntaOpcion, preguntaOpcion => preguntaOpcion.id_pregunta_opcion)
|
||||
@JoinColumn({ name: 'id_pregunta_opcion' })
|
||||
id_pregunta_opcion: PreguntaOpcion;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Pregunta } from 'src/pregunta/entities/pregunta.entity';
|
||||
import { Seccion } from 'src/seccion/entities/seccion.entity';
|
||||
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne } from 'typeorm';
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Pregunta } from 'src/pregunta/entities/pregunta.entity';
|
||||
import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class TipoPregunta {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_tipo: number;
|
||||
|
||||
@Column()
|
||||
tipo_pregunta: string;
|
||||
|
||||
@OneToMany(() => Pregunta, pregunta => pregunta.id_tipo_pregunta)
|
||||
preguntas: Pregunta[];
|
||||
}
|
||||
Reference in New Issue
Block a user