diff --git a/src/app.module.ts b/src/app.module.ts index 76f2858..403a540 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -10,6 +10,7 @@ import { HoraExcepcionModule } from './hora-excepcion/hora-excepcion.module'; import { InstitucionModule } from './institucion/institucion.module'; import { InstitucionDiaModule } from './institucion-dia/institucion-dia.module'; import { InstitucionInfraccionModule } from './institucion-infraccion/institucion-infraccion.module'; +import { InstitucionTipoCarritoModule } from './institucion-tipo-carrito/institucion-tipo-carrito.module'; import { ModuloModule } from './modulo/modulo.module'; import { MotivoModule } from './motivo/motivo.module'; import { MultaModule } from './multa/multa.module'; @@ -35,6 +36,7 @@ import { Infraccion } from './institucion-infraccion/entity/infraccion.entity'; import { Institucion } from './institucion/entity/institucion.entity'; import { InstitucionDia } from './institucion-dia/entity/institucion-dia.entity'; import { InstitucionInfraccion } from './institucion-infraccion/entity/institucion-infraccion.entity'; +import { InstitucionTipoCarrito } from './institucion-tipo-carrito/entity/institucion-tipo-carrito.entity'; import { Modulo } from './modulo/entity/modulo.entity'; import { Motivo } from './motivo/entity/motivo.entity'; import { Multa } from './multa/entity/multa.entity'; @@ -72,6 +74,7 @@ import { Usuario } from './usuario/entity/usuario.entity'; Institucion, InstitucionDia, InstitucionInfraccion, + InstitucionTipoCarrito, Modulo, Motivo, Multa, @@ -106,6 +109,7 @@ import { Usuario } from './usuario/entity/usuario.entity'; TipoEntradaModule, TipoUsuarioModule, UsuarioModule, + InstitucionTipoCarritoModule, ], controllers: [AppController], providers: [AppService], diff --git a/src/institucion-tipo-carrito/entity/institucion-tipo-carrito.entity.ts b/src/institucion-tipo-carrito/entity/institucion-tipo-carrito.entity.ts new file mode 100644 index 0000000..edbb387 --- /dev/null +++ b/src/institucion-tipo-carrito/entity/institucion-tipo-carrito.entity.ts @@ -0,0 +1,32 @@ +import { + Column, + Entity, + JoinColumn, + ManyToOne, + PrimaryGeneratedColumn, +} from 'typeorm'; +import { Institucion } from '../../institucion/entity/institucion.entity'; +import { TipoCarrito } from '../../tipo-carrito/entity/tipo-carrito.entity'; + +@Entity() +export class InstitucionTipoCarrito { + @PrimaryGeneratedColumn() + id_institucion_tipo_carrito: number; + + @Column({ type: Boolean, nullable: false, default: false }) + mostrar: boolean; + + @ManyToOne( + () => Institucion, + (institucion) => institucion.institucionTiposCarritos, + ) + @JoinColumn({ name: 'id_institucion' }) + institucion: Institucion; + + @ManyToOne( + () => TipoCarrito, + (tipoCarrito) => tipoCarrito.institucionesTipoCarrito, + ) + @JoinColumn({ name: 'id_tipo_carrito' }) + tipoCarrito: TipoCarrito; +} diff --git a/src/institucion-tipo-carrito/institucion-tipo-carrito.controller.spec.ts b/src/institucion-tipo-carrito/institucion-tipo-carrito.controller.spec.ts new file mode 100644 index 0000000..9706841 --- /dev/null +++ b/src/institucion-tipo-carrito/institucion-tipo-carrito.controller.spec.ts @@ -0,0 +1,18 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { InstitucionTipoCarritoController } from './institucion-tipo-carrito.controller'; + +describe('InstitucionTipoCarritoController', () => { + let controller: InstitucionTipoCarritoController; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + controllers: [InstitucionTipoCarritoController], + }).compile(); + + controller = module.get(InstitucionTipoCarritoController); + }); + + it('should be defined', () => { + expect(controller).toBeDefined(); + }); +}); diff --git a/src/institucion-tipo-carrito/institucion-tipo-carrito.controller.ts b/src/institucion-tipo-carrito/institucion-tipo-carrito.controller.ts new file mode 100644 index 0000000..bff098a --- /dev/null +++ b/src/institucion-tipo-carrito/institucion-tipo-carrito.controller.ts @@ -0,0 +1,15 @@ +import { Controller, Get, Put } from '@nestjs/common'; +import { InstitucionTipoCarritoService } from './institucion-tipo-carrito.service'; + +@Controller('institucion-tipo-carrito') +export class InstitucionTipoCarritoController { + constructor( + private institucionTipoCarritoService: InstitucionTipoCarritoService, + ) {} + + @Get() + get() {} + + @Put() + update() {} +} diff --git a/src/institucion-tipo-carrito/institucion-tipo-carrito.module.ts b/src/institucion-tipo-carrito/institucion-tipo-carrito.module.ts new file mode 100644 index 0000000..0ff3a59 --- /dev/null +++ b/src/institucion-tipo-carrito/institucion-tipo-carrito.module.ts @@ -0,0 +1,12 @@ +import { Module } from '@nestjs/common'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { InstitucionTipoCarritoController } from './institucion-tipo-carrito.controller'; +import { InstitucionTipoCarritoService } from './institucion-tipo-carrito.service'; +import { InstitucionTipoCarrito } from './entity/institucion-tipo-carrito.entity'; + +@Module({ + imports: [TypeOrmModule.forFeature([InstitucionTipoCarrito])], + controllers: [InstitucionTipoCarritoController], + providers: [InstitucionTipoCarritoService], +}) +export class InstitucionTipoCarritoModule {} diff --git a/src/institucion-tipo-carrito/institucion-tipo-carrito.service.spec.ts b/src/institucion-tipo-carrito/institucion-tipo-carrito.service.spec.ts new file mode 100644 index 0000000..483977d --- /dev/null +++ b/src/institucion-tipo-carrito/institucion-tipo-carrito.service.spec.ts @@ -0,0 +1,18 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { InstitucionTipoCarritoService } from './institucion-tipo-carrito.service'; + +describe('InstitucionTipoCarritoService', () => { + let service: InstitucionTipoCarritoService; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [InstitucionTipoCarritoService], + }).compile(); + + service = module.get(InstitucionTipoCarritoService); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/src/institucion-tipo-carrito/institucion-tipo-carrito.service.ts b/src/institucion-tipo-carrito/institucion-tipo-carrito.service.ts new file mode 100644 index 0000000..2da34e0 --- /dev/null +++ b/src/institucion-tipo-carrito/institucion-tipo-carrito.service.ts @@ -0,0 +1,4 @@ +import { Injectable } from '@nestjs/common'; + +@Injectable() +export class InstitucionTipoCarritoService {} diff --git a/src/institucion/entity/institucion.entity.ts b/src/institucion/entity/institucion.entity.ts index 1b72885..fff2336 100644 --- a/src/institucion/entity/institucion.entity.ts +++ b/src/institucion/entity/institucion.entity.ts @@ -2,6 +2,7 @@ import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm'; import { Carrera } from '../../carrera/entity/carrera.entity'; import { InstitucionDia } from '../../institucion-dia/entity/institucion-dia.entity'; import { InstitucionInfraccion } from '../../institucion-infraccion/entity/institucion-infraccion.entity'; +import { InstitucionTipoCarrito } from '../../institucion-tipo-carrito/entity/institucion-tipo-carrito.entity'; import { Modulo } from '../../modulo/entity/modulo.entity'; import { Operador } from '../../operador/entity/operador.entity'; import { Usuario } from '../../usuario/entity/usuario.entity'; @@ -44,6 +45,12 @@ export class Institucion { ) institucionInfracciones: InstitucionInfraccion[]; + @OneToMany( + () => InstitucionTipoCarrito, + (institucionTipoCarrito) => institucionTipoCarrito.institucion, + ) + institucionTiposCarritos: InstitucionTipoCarrito[]; + @OneToMany(() => Modulo, (modulo) => modulo.institucion) modulos: Modulo[]; diff --git a/src/tipo-carrito/entity/tipo-carrito.entity.ts b/src/tipo-carrito/entity/tipo-carrito.entity.ts index 7c80b74..f33a63a 100644 --- a/src/tipo-carrito/entity/tipo-carrito.entity.ts +++ b/src/tipo-carrito/entity/tipo-carrito.entity.ts @@ -1,5 +1,6 @@ import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm'; import { Carrito } from '../../carrito/entity/carrito.entity'; +import { InstitucionTipoCarrito } from '../../institucion-tipo-carrito/entity/institucion-tipo-carrito.entity'; @Entity() export class TipoCarrito { @@ -14,4 +15,7 @@ export class TipoCarrito { @OneToMany(() => Carrito, (carrito) => carrito.tipoCarrito) carritos: Carrito[]; + + @OneToMany(() => InstitucionTipoCarrito, (institucionTipoCarrito) => institucionTipoCarrito.tipoCarrito) + institucionesTipoCarrito: InstitucionTipoCarrito[]; }