diff --git a/src/app.module.ts b/src/app.module.ts index 70bb546..e9cecce 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -29,7 +29,7 @@ import { CarreraProgramaModule } from './carrera-programa/carrera-programa.modul import { Carrera } from './carrera/carrera.entity'; import { CarreraPrograma } from './carrera-programa/carrera-programa.entity'; -import { Carrito } from './carrito/carrito.entity'; +import { Carrito } from './carrito/entity/carrito.entity'; import { Dia } from './dia/dia.entity'; import { Equipo } from './equipo/equipo.entity'; import { EquipoTipoEntrada } from './equipo-tipo-entrada/equipo-tipo-entrada.entity'; diff --git a/src/carrito/carrito.controller.ts b/src/carrito/carrito.controller.ts index a702de4..17e3ae6 100644 --- a/src/carrito/carrito.controller.ts +++ b/src/carrito/carrito.controller.ts @@ -1,7 +1,22 @@ -import { Controller } from '@nestjs/common'; +import { Controller, Get, Post, Put } from '@nestjs/common'; import { CarritoService } from './carrito.service'; @Controller('carrito') export class CarritoController { constructor(private carritoService: CarritoService) {} + + @Post() + create() {} + + @Get() + get() {} + + @Get('carrito') + carrito() {} + + @Get('carritos') + carritos() {} + + @Put() + update() {} } diff --git a/src/carrito/carrito.module.ts b/src/carrito/carrito.module.ts index fbdc353..391f3a8 100644 --- a/src/carrito/carrito.module.ts +++ b/src/carrito/carrito.module.ts @@ -1,8 +1,8 @@ import { Module } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; import { CarritoController } from './carrito.controller'; -import { Carrito } from './carrito.entity'; import { CarritoService } from './carrito.service'; +import { Carrito } from './entity/carrito.entity'; @Module({ imports: [TypeOrmModule.forFeature([Carrito])], diff --git a/src/carrito/carrito.service.ts b/src/carrito/carrito.service.ts index 5086928..daa9133 100644 --- a/src/carrito/carrito.service.ts +++ b/src/carrito/carrito.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import { Repository } from 'typeorm'; import { InjectRepository } from '@nestjs/typeorm'; -import { Carrito } from './carrito.entity'; +import { Carrito } from './entity/carrito.entity'; @Injectable() export class CarritoService { diff --git a/src/carrito/carrito.entity.ts b/src/carrito/entity/carrito.entity.ts similarity index 65% rename from src/carrito/carrito.entity.ts rename to src/carrito/entity/carrito.entity.ts index d92c612..af258b9 100644 --- a/src/carrito/carrito.entity.ts +++ b/src/carrito/entity/carrito.entity.ts @@ -1,26 +1,26 @@ import { - Entity, Column, - PrimaryGeneratedColumn, - OneToMany, - ManyToOne, + Entity, JoinColumn, + ManyToOne, + OneToMany, + PrimaryGeneratedColumn, } from 'typeorm'; -import { Modulo } from '../modulo/entity/modulo.entity'; -import { Equipo } from '../equipo/equipo.entity'; -import { TipoCarrito } from '../tipo-carrito/tipo-carrito.entity'; +import { Equipo } from '../../equipo/equipo.entity'; +import { Modulo } from '../../modulo/entity/modulo.entity'; +import { TipoCarrito } from '../../tipo-carrito/tipo-carrito.entity'; @Entity() export class Carrito { @PrimaryGeneratedColumn() id_carrito: number; - @Column() - carrito: string; - - @Column() + @Column({ type: Boolean, nullable: false, default: false }) activo: boolean; + @Column({ type: String, nullable: false, length: 50 }) + carrito: string; + @ManyToOne(() => Modulo, (modulo) => modulo.carritos) @JoinColumn({ name: 'id_modulo' }) modulo: Modulo; diff --git a/src/equipo/equipo.entity.ts b/src/equipo/equipo.entity.ts index da61ff8..030e985 100644 --- a/src/equipo/equipo.entity.ts +++ b/src/equipo/equipo.entity.ts @@ -6,7 +6,7 @@ import { ManyToOne, JoinColumn, } from 'typeorm'; -import { Carrito } from '../carrito/carrito.entity'; +import { Carrito } from '../carrito/entity/carrito.entity'; import { Motivo } from '../motivo/motivo.entity'; import { Prestamo } from '../prestamo/prestamo.entity'; import { Programa } from '../programa/programa.entity'; diff --git a/src/institucion/entity/institucion.entity.ts b/src/institucion/entity/institucion.entity.ts index 4081fe1..2f2226d 100644 --- a/src/institucion/entity/institucion.entity.ts +++ b/src/institucion/entity/institucion.entity.ts @@ -11,19 +11,22 @@ export class Institucion { @PrimaryGeneratedColumn() id_institucion: number; - @Column() + @Column({ type: Number, nullable: false, default: 7 }) dias_multa_retraso: number; - @Column() + @Column({ type: String, nullable: false }) institucion: string; - @Column() + @Column({ type: String, nullable: false, length: 50 }) logo: string; - @Column() + @Column({ type: Number, nullable: false, default: 15 }) + tiempo_entrega: number; + + @Column({ type: Number, nullable: false, default: 120 }) tiempo_prestamo: number; - @Column() + @Column({ type: Number, nullable: false, default: 10 }) tiempo_recoger: number; @OneToMany(() => Carrera, (carrera) => carrera.institucion) diff --git a/src/modulo/entity/modulo.entity.ts b/src/modulo/entity/modulo.entity.ts index 5f8b142..2b3d2f3 100644 --- a/src/modulo/entity/modulo.entity.ts +++ b/src/modulo/entity/modulo.entity.ts @@ -6,7 +6,7 @@ import { OneToMany, PrimaryGeneratedColumn, } from 'typeorm'; -import { Carrito } from '../../carrito/carrito.entity'; +import { Carrito } from '../../carrito/entity/carrito.entity'; import { Institucion } from '../../institucion/entity/institucion.entity'; @Entity() diff --git a/src/tipo-carrito/tipo-carrito.entity.ts b/src/tipo-carrito/tipo-carrito.entity.ts index 309665a..ada405f 100644 --- a/src/tipo-carrito/tipo-carrito.entity.ts +++ b/src/tipo-carrito/tipo-carrito.entity.ts @@ -1,5 +1,5 @@ import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from 'typeorm'; -import { Carrito } from '../carrito/carrito.entity'; +import { Carrito } from '../carrito/entity/carrito.entity'; @Entity() export class TipoCarrito {