nuevas tablas
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
import { Institucion } from '../../institucion/entity/institucion.entity';
|
||||
import { Programa } from '../../programa/entity/programa.entity';
|
||||
|
||||
@Entity()
|
||||
export class InstitucionPrograma {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_institucion_carrera: number;
|
||||
|
||||
@Column({ type: Boolean, nullable: false, default: false })
|
||||
mostrar: boolean;
|
||||
|
||||
@ManyToOne(() => Programa, (programa) => programa.instituciones)
|
||||
@JoinColumn({ name: 'id_programa' })
|
||||
programa: Programa;
|
||||
|
||||
@ManyToOne(() => Institucion, (institucion) => institucion.programas)
|
||||
@JoinColumn({ name: 'id_institucion' })
|
||||
institucion: Institucion;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { InstitucionProgramaController } from './institucion-programa.controller';
|
||||
|
||||
describe('InstitucionProgramaController', () => {
|
||||
let controller: InstitucionProgramaController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [InstitucionProgramaController],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<InstitucionProgramaController>(InstitucionProgramaController);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
import { Controller } from '@nestjs/common';
|
||||
|
||||
@Controller('institucion-programa')
|
||||
export class InstitucionProgramaController {}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { InstitucionProgramaController } from './institucion-programa.controller';
|
||||
import { InstitucionProgramaService } from './institucion-programa.service';
|
||||
import { InstitucionPrograma } from './entity/institucion-programa.entity';
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([InstitucionPrograma])],
|
||||
controllers: [InstitucionProgramaController],
|
||||
providers: [InstitucionProgramaService],
|
||||
})
|
||||
export class InstitucionProgramaModule {}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { InstitucionProgramaService } from './institucion-programa.service';
|
||||
|
||||
describe('InstitucionProgramaService', () => {
|
||||
let service: InstitucionProgramaService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [InstitucionProgramaService],
|
||||
}).compile();
|
||||
|
||||
service = module.get<InstitucionProgramaService>(InstitucionProgramaService);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
import { InstitucionPrograma } from './entity/institucion-programa.entity';
|
||||
|
||||
@Injectable()
|
||||
export class InstitucionProgramaService {
|
||||
constructor(
|
||||
@InjectRepository(InstitucionPrograma)
|
||||
private repository: Repository<InstitucionPrograma>,
|
||||
) {}
|
||||
}
|
||||
Reference in New Issue
Block a user