Entidades y Realciones(Falta enrutar bien)2
This commit is contained in:
@@ -5,6 +5,7 @@ import { Categoria } from './categoria.entity';
|
||||
import { DatosAcademicos } from './datos_academicos.entity';
|
||||
import { LineasInvestigacion } from './lineas_investigacion.entity';
|
||||
import { ProyectosAcademicos } from './proyectos_academicos.entity';
|
||||
import { AsignaturaCarreraProfesor } from './asignatura_carrera_profesor.entity';
|
||||
|
||||
@Entity()
|
||||
export class Profesor {
|
||||
@@ -88,4 +89,7 @@ export class Profesor {
|
||||
|
||||
@OneToMany(() => ProyectosAcademicos, proyectosAcademicos => ProyectosAcademicos.profesor)
|
||||
proyectosAcademicos: ProyectosAcademicos[];
|
||||
|
||||
@OneToMany(() => AsignaturaCarreraProfesor, acp => AsignaturaCarreraProfesor.profesor)
|
||||
asignaturaCarreraProfesores: AsignaturaCarreraProfesor[];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm';
|
||||
import { AsignaturaCarreraProfesor } from './asignatura_carrera_profesor.entity';
|
||||
|
||||
@Entity()
|
||||
export class Asignatura {
|
||||
|
||||
@PrimaryGeneratedColumn()
|
||||
id_asignatura: number;
|
||||
|
||||
@Column({ type: 'varchar', length: 50, nullable: false })
|
||||
materia: string;
|
||||
|
||||
@OneToMany(() => AsignaturaCarreraProfesor, acp => AsignaturaCarreraProfesor.asignatura)
|
||||
asignaturaCarreraProfesores: AsignaturaCarreraProfesor[];
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { Entity, PrimaryColumn, Column, ManyToOne, JoinColumn } from 'typeorm';
|
||||
import { Profesor } from './profesor.entity';
|
||||
import { Asignatura } from './asignatura.entity';
|
||||
import { Carrera } from './carrera.entity';
|
||||
|
||||
@Entity()
|
||||
export class AsignaturaCarreraProfesor {
|
||||
@PrimaryColumn({ type: 'int', length: 11, nullable: false })
|
||||
id_profesor: number;
|
||||
|
||||
@PrimaryColumn({ type: 'int', length: 11, nullable: false })
|
||||
id_carrera: number;
|
||||
|
||||
@PrimaryColumn({ type: 'int', length: 11, nullable: false })
|
||||
id_asignatura: number;
|
||||
|
||||
@Column({ type: 'varchar', length: 150, nullable: false })
|
||||
semestre: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 150, nullable: false })
|
||||
periodo: string;
|
||||
|
||||
@ManyToOne(() => Profesor, profesor => profesor.asignaturaCarreraProfesores)
|
||||
@JoinColumn({ name: 'id_profesor' })
|
||||
profesor: Profesor;
|
||||
|
||||
@ManyToOne(() => Carrera, carrera => carrera.asignaturaCarreraProfesores)
|
||||
@JoinColumn({ name: 'id_carrera' })
|
||||
carrera: Carrera;
|
||||
|
||||
@ManyToOne(() => Asignatura, asignatura => asignatura.asignaturaCarreraProfesores)
|
||||
@JoinColumn({ name: 'id_asignatura' })
|
||||
asignatura: Asignatura;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm';
|
||||
import { AsignaturaCarreraProfesor } from './asignatura_carrera_profesor.entity';
|
||||
|
||||
@Entity()
|
||||
export class Carrera {
|
||||
|
||||
@PrimaryGeneratedColumn()
|
||||
id_carrera: number;
|
||||
|
||||
@Column({ type: 'varchar', length: 150, nullable: false })
|
||||
nombre: string;
|
||||
|
||||
@OneToMany(() => AsignaturaCarreraProfesor, asi => AsignaturaCarreraProfesor.carrera)
|
||||
asignaturaCarreraProfesores: AsignaturaCarreraProfesor[];
|
||||
}
|
||||
Reference in New Issue
Block a user