nuevas tablas por nuevos requisitos
This commit is contained in:
parent
4eb8c1336e
commit
631bfa6c11
@ -16,14 +16,22 @@ import { MotivoModule } from './motivo/motivo.module';
|
||||
import { MultaModule } from './multa/multa.module';
|
||||
import { OperadorModule } from './operador/operador.module';
|
||||
import { PrestamoModule } from './prestamo/prestamo.module';
|
||||
import { ProgramaModule } from './programa/programa.module';
|
||||
import { StatusModule } from './status/status.module';
|
||||
import { TipoCarritoModule } from './tipo-carrito/tipo-carrito.module';
|
||||
import { TipoUsuarioModule } from './tipo-usuario/tipo-usuario.module';
|
||||
import { UsuarioModule } from './usuario/usuario.module';
|
||||
import { CarreraModule } from './carrera/carrera.module';
|
||||
import { TipoEntradaModule } from './tipo-entrada/tipo-entrada.module';
|
||||
import { EquipoTipoEntradaModule } from './equipo-tipo-entrada/equipo-tipo-entrada.module';
|
||||
import { CarreraProgramaModule } from './carrera-programa/carrera-programa.module';
|
||||
|
||||
import { Carrera } from './carrera/carrera.entity';
|
||||
import { CarreraPrograma } from './carrera-programa/carrera-programa.entity';
|
||||
import { Carrito } from './carrito/carrito.entity';
|
||||
import { Dia } from './dia/dia.entity';
|
||||
import { Equipo } from './equipo/equipo.entity';
|
||||
import { EquipoTipoEntrada } from './equipo-tipo-entrada/equipo-tipo-entrada.entity';
|
||||
import { HoraExcepcion } from './hora-excepcion/hora-excepcion.entity';
|
||||
import { Infraccion } from './infraccion/infraccion.entity';
|
||||
import { Institucion } from './institucion/institucion.entity';
|
||||
@ -34,8 +42,10 @@ import { Motivo } from './motivo/motivo.entity';
|
||||
import { Multa } from './multa/multa.entity';
|
||||
import { Operador } from './operador/operador.entity';
|
||||
import { Prestamo } from './prestamo/prestamo.entity';
|
||||
import { Programa } from './programa/programa.entity';
|
||||
import { Status } from './status/status.entity';
|
||||
import { TipoCarrito } from './tipo-carrito/tipo-carrito.entity';
|
||||
import { TipoEntrada } from './tipo-entrada/tipo-entrada.entity';
|
||||
import { TipoUsuario } from './tipo-usuario/tipo-usuario.entity';
|
||||
import { Usuario } from './usuario/usuario.entity';
|
||||
|
||||
@ -53,9 +63,12 @@ import { Usuario } from './usuario/usuario.entity';
|
||||
password: config.get<string>('PASSWORD_DB'),
|
||||
synchronize: true,
|
||||
entities: [
|
||||
Carrera,
|
||||
CarreraPrograma,
|
||||
Carrito,
|
||||
Dia,
|
||||
Equipo,
|
||||
EquipoTipoEntrada,
|
||||
HoraExcepcion,
|
||||
Infraccion,
|
||||
Institucion,
|
||||
@ -66,17 +79,22 @@ import { Usuario } from './usuario/usuario.entity';
|
||||
Multa,
|
||||
Operador,
|
||||
Prestamo,
|
||||
Programa,
|
||||
Status,
|
||||
TipoCarrito,
|
||||
TipoEntrada,
|
||||
TipoUsuario,
|
||||
Usuario,
|
||||
],
|
||||
};
|
||||
},
|
||||
}),
|
||||
CarreraModule,
|
||||
CarreraProgramaModule,
|
||||
CarritoModule,
|
||||
DiaModule,
|
||||
EquipoModule,
|
||||
EquipoTipoEntradaModule,
|
||||
HoraExcepcionModule,
|
||||
InfraccionModule,
|
||||
InstitucionModule,
|
||||
@ -87,8 +105,10 @@ import { Usuario } from './usuario/usuario.entity';
|
||||
MultaModule,
|
||||
OperadorModule,
|
||||
PrestamoModule,
|
||||
ProgramaModule,
|
||||
StatusModule,
|
||||
TipoCarritoModule,
|
||||
TipoEntradaModule,
|
||||
TipoUsuarioModule,
|
||||
UsuarioModule,
|
||||
],
|
||||
|
18
src/carrera-programa/carrera-programa.controller.spec.ts
Normal file
18
src/carrera-programa/carrera-programa.controller.spec.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { CarreraProgramaController } from './carrera-programa.controller';
|
||||
|
||||
describe('CarreraProgramaController', () => {
|
||||
let controller: CarreraProgramaController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [CarreraProgramaController],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<CarreraProgramaController>(CarreraProgramaController);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
4
src/carrera-programa/carrera-programa.controller.ts
Normal file
4
src/carrera-programa/carrera-programa.controller.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import { Controller } from '@nestjs/common';
|
||||
|
||||
@Controller('carrera-programa')
|
||||
export class CarreraProgramaController {}
|
23
src/carrera-programa/carrera-programa.entity.ts
Normal file
23
src/carrera-programa/carrera-programa.entity.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import {
|
||||
Entity,
|
||||
Column,
|
||||
PrimaryGeneratedColumn,
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
} from 'typeorm';
|
||||
import { Carrera } from '../carrera/carrera.entity';
|
||||
import { Programa } from '../programa/programa.entity';
|
||||
|
||||
@Entity()
|
||||
export class CarreraPrograma {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_carrera_programa: number;
|
||||
|
||||
@ManyToOne(() => Programa, (programa) => programa.carrerasPrograma)
|
||||
@JoinColumn({ name: 'id_programa' })
|
||||
programa: Programa;
|
||||
|
||||
@ManyToOne(() => Carrera, (carrera) => carrera.carreraProgramas)
|
||||
@JoinColumn({ name: 'id_carrera' })
|
||||
carrera: Carrera;
|
||||
}
|
10
src/carrera-programa/carrera-programa.module.ts
Normal file
10
src/carrera-programa/carrera-programa.module.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { CarreraProgramaController } from './carrera-programa.controller';
|
||||
import { CarreraPrograma } from './carrera-programa.entity';
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([CarreraPrograma])],
|
||||
controllers: [CarreraProgramaController],
|
||||
})
|
||||
export class CarreraProgramaModule {}
|
18
src/carrera/carrera.controller.spec.ts
Normal file
18
src/carrera/carrera.controller.spec.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { CarreraController } from './carrera.controller';
|
||||
|
||||
describe('CarreraController', () => {
|
||||
let controller: CarreraController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [CarreraController],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<CarreraController>(CarreraController);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
4
src/carrera/carrera.controller.ts
Normal file
4
src/carrera/carrera.controller.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import { Controller } from '@nestjs/common';
|
||||
|
||||
@Controller('carrera')
|
||||
export class CarreraController {}
|
33
src/carrera/carrera.entity.ts
Normal file
33
src/carrera/carrera.entity.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import {
|
||||
Entity,
|
||||
Column,
|
||||
PrimaryGeneratedColumn,
|
||||
OneToMany,
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
} from 'typeorm';
|
||||
import { Institucion } from '../institucion/institucion.entity';
|
||||
import { Usuario } from '../usuario/usuario.entity';
|
||||
import { CarreraPrograma } from '../carrera-programa/carrera-programa.entity';
|
||||
|
||||
@Entity()
|
||||
export class Carrera {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_carrera: number;
|
||||
|
||||
@Column()
|
||||
carrera: string;
|
||||
|
||||
@ManyToOne(() => Institucion, (institucion) => institucion.carreras)
|
||||
@JoinColumn({ name: 'id_institucion' })
|
||||
institucion: Institucion;
|
||||
|
||||
@OneToMany(() => Usuario, (usuario) => usuario.carrera)
|
||||
usuarios: Usuario[];
|
||||
|
||||
@OneToMany(
|
||||
() => CarreraPrograma,
|
||||
(carreraPrograma) => carreraPrograma.carrera,
|
||||
)
|
||||
carreraProgramas: CarreraPrograma[];
|
||||
}
|
10
src/carrera/carrera.module.ts
Normal file
10
src/carrera/carrera.module.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { CarreraController } from './carrera.controller';
|
||||
import { Carrera } from './carrera.entity';
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([Carrera])],
|
||||
controllers: [CarreraController],
|
||||
})
|
||||
export class CarreraModule {}
|
@ -0,0 +1,18 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { EquipoTipoEntradaController } from './equipo-tipo-entrada.controller';
|
||||
|
||||
describe('EquipoTipoEntradaController', () => {
|
||||
let controller: EquipoTipoEntradaController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [EquipoTipoEntradaController],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<EquipoTipoEntradaController>(EquipoTipoEntradaController);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
@ -0,0 +1,4 @@
|
||||
import { Controller } from '@nestjs/common';
|
||||
|
||||
@Controller('equipo-tipo-entrada')
|
||||
export class EquipoTipoEntradaController {}
|
23
src/equipo-tipo-entrada/equipo-tipo-entrada.entity.ts
Normal file
23
src/equipo-tipo-entrada/equipo-tipo-entrada.entity.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import {
|
||||
Entity,
|
||||
Column,
|
||||
PrimaryGeneratedColumn,
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
} from 'typeorm';
|
||||
import { Equipo } from '../equipo/equipo.entity';
|
||||
import { TipoEntrada } from '../tipo-entrada/tipo-entrada.entity';
|
||||
|
||||
@Entity()
|
||||
export class EquipoTipoEntrada {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_equipo_entrada: number;
|
||||
|
||||
@ManyToOne(() => Equipo, (equipo) => equipo.equipoTipoEntradas)
|
||||
@JoinColumn({ name: 'id_equipo' })
|
||||
equipo: Equipo;
|
||||
|
||||
@ManyToOne(() => TipoEntrada, (tipoEntrada) => tipoEntrada.equiposTipoEntrada)
|
||||
@JoinColumn({ name: 'id_tipo_entrada' })
|
||||
tipoEntrada: TipoEntrada;
|
||||
}
|
10
src/equipo-tipo-entrada/equipo-tipo-entrada.module.ts
Normal file
10
src/equipo-tipo-entrada/equipo-tipo-entrada.module.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { EquipoTipoEntradaController } from './equipo-tipo-entrada.controller';
|
||||
import { EquipoTipoEntrada } from './equipo-tipo-entrada.entity';
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([EquipoTipoEntrada])],
|
||||
controllers: [EquipoTipoEntradaController],
|
||||
})
|
||||
export class EquipoTipoEntradaModule {}
|
@ -7,9 +7,11 @@ import {
|
||||
JoinColumn,
|
||||
} from 'typeorm';
|
||||
import { Carrito } from '../carrito/carrito.entity';
|
||||
import { Prestamo } from '../prestamo/prestamo.entity';
|
||||
import { Motivo } from '../motivo/motivo.entity';
|
||||
import { Prestamo } from '../prestamo/prestamo.entity';
|
||||
import { Programa } from '../programa/programa.entity';
|
||||
import { Status } from '../status/status.entity';
|
||||
import { EquipoTipoEntrada } from '../equipo-tipo-entrada/equipo-tipo-entrada.entity';
|
||||
|
||||
@Entity()
|
||||
export class Equipo {
|
||||
@ -36,9 +38,19 @@ export class Equipo {
|
||||
@JoinColumn({ name: 'id_status' })
|
||||
status: Status;
|
||||
|
||||
@ManyToOne(() => Programa, (programa) => programa.equipos)
|
||||
@JoinColumn({ name: 'id_programa' })
|
||||
programa: Programa;
|
||||
|
||||
@OneToMany(() => Motivo, (motivo) => motivo.equipo)
|
||||
motivos: Motivo[];
|
||||
|
||||
@OneToMany(() => Prestamo, (prestamo) => prestamo.equipo)
|
||||
prestamos: Prestamo[];
|
||||
|
||||
@OneToMany(
|
||||
() => EquipoTipoEntrada,
|
||||
(equipoTipoEntrada) => equipoTipoEntrada.tipoEntrada,
|
||||
)
|
||||
equipoTipoEntradas: EquipoTipoEntrada[];
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from 'typeorm';
|
||||
import { InstitucionDia } from '../institucion-dia/institucion-dia.entity';
|
||||
import { InstitucionInfraccion } from '../institucion-infraccion/institucion-infraccion.entity';
|
||||
import { Carrera } from '../carrera/carrera.entity';
|
||||
import { Modulo } from '../modulo/modulo.entity';
|
||||
import { Operador } from '../operador/operador.entity';
|
||||
import { Usuario } from '../usuario/usuario.entity';
|
||||
@ -40,6 +41,9 @@ export class Institucion {
|
||||
@OneToMany(() => Modulo, (modulo) => modulo.institucion)
|
||||
modulos: Modulo[];
|
||||
|
||||
@OneToMany(() => Carrera, (carrera) => carrera.institucion)
|
||||
carreras: Carrera[];
|
||||
|
||||
@OneToMany(() => Operador, (operador) => operador.institucion)
|
||||
operadores: Operador[];
|
||||
|
||||
|
18
src/programa/programa.controller.spec.ts
Normal file
18
src/programa/programa.controller.spec.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { ProgramaController } from './programa.controller';
|
||||
|
||||
describe('ProgramaController', () => {
|
||||
let controller: ProgramaController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [ProgramaController],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<ProgramaController>(ProgramaController);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
4
src/programa/programa.controller.ts
Normal file
4
src/programa/programa.controller.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import { Controller } from '@nestjs/common';
|
||||
|
||||
@Controller('programa')
|
||||
export class ProgramaController {}
|
21
src/programa/programa.entity.ts
Normal file
21
src/programa/programa.entity.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from 'typeorm';
|
||||
import { Equipo } from '../equipo/equipo.entity';
|
||||
import { CarreraPrograma } from '../carrera-programa/carrera-programa.entity';
|
||||
|
||||
@Entity()
|
||||
export class Programa {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_programa: number;
|
||||
|
||||
@Column()
|
||||
programa: string;
|
||||
|
||||
@OneToMany(() => Equipo, (equipo) => equipo.programa)
|
||||
equipos: Equipo[];
|
||||
|
||||
@OneToMany(
|
||||
() => CarreraPrograma,
|
||||
(carreraPrograma) => carreraPrograma.programa,
|
||||
)
|
||||
carrerasPrograma: CarreraPrograma[];
|
||||
}
|
10
src/programa/programa.module.ts
Normal file
10
src/programa/programa.module.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { ProgramaController } from './programa.controller';
|
||||
import { Programa } from './programa.entity';
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([Programa])],
|
||||
controllers: [ProgramaController],
|
||||
})
|
||||
export class ProgramaModule {}
|
18
src/tipo-entrada/tipo-entrada.controller.spec.ts
Normal file
18
src/tipo-entrada/tipo-entrada.controller.spec.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { TipoEntradaController } from './tipo-entrada.controller';
|
||||
|
||||
describe('TipoEntradaController', () => {
|
||||
let controller: TipoEntradaController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [TipoEntradaController],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<TipoEntradaController>(TipoEntradaController);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
4
src/tipo-entrada/tipo-entrada.controller.ts
Normal file
4
src/tipo-entrada/tipo-entrada.controller.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import { Controller } from '@nestjs/common';
|
||||
|
||||
@Controller('tipo-entrada')
|
||||
export class TipoEntradaController {}
|
17
src/tipo-entrada/tipo-entrada.entity.ts
Normal file
17
src/tipo-entrada/tipo-entrada.entity.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from 'typeorm';
|
||||
import { EquipoTipoEntrada } from '../equipo-tipo-entrada/equipo-tipo-entrada.entity';
|
||||
|
||||
@Entity()
|
||||
export class TipoEntrada {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_tipo_entrada: number;
|
||||
|
||||
@Column()
|
||||
tipo_entrada: string;
|
||||
|
||||
@OneToMany(
|
||||
() => EquipoTipoEntrada,
|
||||
(equipoTipoEntrada) => equipoTipoEntrada.tipoEntrada,
|
||||
)
|
||||
equiposTipoEntrada: EquipoTipoEntrada[];
|
||||
}
|
10
src/tipo-entrada/tipo-entrada.module.ts
Normal file
10
src/tipo-entrada/tipo-entrada.module.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { TipoEntradaController } from './tipo-entrada.controller';
|
||||
import { TipoEntrada } from './tipo-entrada.entity';
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([TipoEntrada])],
|
||||
controllers: [TipoEntradaController],
|
||||
})
|
||||
export class TipoEntradaModule {}
|
@ -6,6 +6,7 @@ import {
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
} from 'typeorm';
|
||||
import { Carrera } from '../carrera/carrera.entity';
|
||||
import { Institucion } from '../institucion/institucion.entity';
|
||||
import { Prestamo } from '../prestamo/prestamo.entity';
|
||||
import { TipoUsuario } from '../tipo-usuario/tipo-usuario.entity';
|
||||
@ -31,6 +32,10 @@ export class Usuario {
|
||||
@JoinColumn({ name: 'id_institucion' })
|
||||
institucion: Institucion;
|
||||
|
||||
@ManyToOne(() => Carrera, (carrera) => carrera.usuarios)
|
||||
@JoinColumn({ name: 'id_carrera' })
|
||||
carrera: Carrera;
|
||||
|
||||
@ManyToOne(() => TipoUsuario, (tipoUsuario) => tipoUsuario.usuarios)
|
||||
@JoinColumn({ name: 'id_tipo_usuario' })
|
||||
tipoUsuario: TipoUsuario;
|
||||
|
Loading…
Reference in New Issue
Block a user