84 lines
2.4 KiB
TypeScript
84 lines
2.4 KiB
TypeScript
import {
|
|
Column,
|
|
Entity,
|
|
JoinColumn,
|
|
ManyToOne,
|
|
OneToMany,
|
|
PrimaryGeneratedColumn,
|
|
} from 'typeorm';
|
|
import { Carrito } from '../../carrito/entity/carrito.entity';
|
|
import { EquipoPrograma } from '../../equipo-programa/entity/equipo-programa.entity';
|
|
import { EquipoTipoEntrada } from '../../equipo-tipo-entrada/entity/equipo-tipo-entrada.entity';
|
|
import { Marca } from '../../marca/entity/marca.entity';
|
|
import { Modelo } from '../../modelo/entity/modelo.entity';
|
|
import { EquipoMotivo } from '../../equipo-motivo/entity/equipo-motivo.entity';
|
|
import { Prestamo } from '../../prestamo/entity/prestamo.entity';
|
|
import { Status } from '../../status/entity/status.entity';
|
|
|
|
@Entity()
|
|
export class Equipo {
|
|
@PrimaryGeneratedColumn()
|
|
id_equipo: number;
|
|
|
|
@Column({ type: String, nullable: false, length: 4 })
|
|
equipo: string;
|
|
|
|
@Column({ type: String, nullable: false, length: 30 })
|
|
numero_inventario: string;
|
|
|
|
@Column({ type: String, nullable: false, length: 30 })
|
|
numero_serie: string;
|
|
|
|
@Column({ type: Boolean, nullable: false, default: false })
|
|
prestado: boolean;
|
|
|
|
@Column({ type: Number, nullable: true, default: null })
|
|
u: number;
|
|
|
|
@Column({ type: Number, nullable: true })
|
|
id_carrito: number;
|
|
|
|
@Column({ type: Number, nullable: true })
|
|
id_marca: number;
|
|
|
|
@Column({ type: Number, nullable: true })
|
|
id_modelo: number;
|
|
|
|
@Column({ type: Number, nullable: true, default: 1 })
|
|
id_status: number;
|
|
|
|
@ManyToOne(() => Carrito, (carrito) => carrito.equipos, { eager: true })
|
|
@JoinColumn({ name: 'id_carrito' })
|
|
carrito: Carrito;
|
|
|
|
@ManyToOne(() => Marca, (marca) => marca.equipos, { eager: true })
|
|
@JoinColumn({ name: 'id_marca' })
|
|
marca: Marca;
|
|
|
|
@ManyToOne(() => Modelo, (modelo) => modelo.equipos, { eager: true })
|
|
@JoinColumn({ name: 'id_modelo' })
|
|
modelo: Modelo;
|
|
|
|
@ManyToOne(() => Status, (status) => status.equipos, { eager: true })
|
|
@JoinColumn({ name: 'id_status' })
|
|
status: Status;
|
|
|
|
@OneToMany(() => EquipoMotivo, (motivo) => motivo.equipo)
|
|
motivos: EquipoMotivo[];
|
|
|
|
@OneToMany(() => Prestamo, (prestamo) => prestamo.equipo)
|
|
prestamos: Prestamo[];
|
|
|
|
@OneToMany(() => EquipoPrograma, (equipoPrograma) => equipoPrograma.equipo, {
|
|
eager: true,
|
|
})
|
|
programas: EquipoPrograma[];
|
|
|
|
@OneToMany(
|
|
() => EquipoTipoEntrada,
|
|
(equipoTipoEntrada) => equipoTipoEntrada.equipo,
|
|
{ eager: true },
|
|
)
|
|
tiposEntradas: EquipoTipoEntrada[];
|
|
}
|