listo prestamo

This commit is contained in:
xXpuma99Xx
2022-04-17 22:51:49 -05:00
parent 30c32c93c0
commit cbd0c4fe3c
9 changed files with 77 additions and 38 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ import { Modulo } from './modulo/entity/modulo.entity';
import { Motivo } from './motivo/entity/motivo.entity';
import { Multa } from './multa/entity/multa.entity';
import { Operador } from './operador/entity/operador.entity';
import { Prestamo } from './prestamo/prestamo.entity';
import { Prestamo } from './prestamo/entity/prestamo.entity';
import { Programa } from './programa/programa.entity';
import { Status } from './status/status.entity';
import { TipoCarrito } from './tipo-carrito/tipo-carrito.entity';
+1 -1
View File
@@ -9,7 +9,7 @@ import {
import { Carrito } from '../../carrito/entity/carrito.entity';
import { EquipoTipoEntrada } from '../../equipo-tipo-entrada/entity/equipo-tipo-entrada.entity';
import { Motivo } from '../../motivo/entity/motivo.entity';
import { Prestamo } from '../../prestamo/prestamo.entity';
import { Prestamo } from '../../prestamo/entity/prestamo.entity';
import { Programa } from '../../programa/programa.entity';
import { Status } from '../../status/status.entity';
+1 -1
View File
@@ -7,7 +7,7 @@ import {
PrimaryGeneratedColumn,
} from 'typeorm';
import { InstitucionInfraccion } from '../../institucion-infraccion/entity/institucion-infraccion.entity';
import { Prestamo } from '../../prestamo/prestamo.entity';
import { Prestamo } from '../../prestamo/entity/prestamo.entity';
@Entity()
export class Multa {
+1 -1
View File
@@ -8,7 +8,7 @@ import {
} from 'typeorm';
import { Institucion } from '../../institucion/entity/institucion.entity';
import { Motivo } from '../../motivo/entity/motivo.entity';
import { Prestamo } from '../../prestamo/prestamo.entity';
import { Prestamo } from '../../prestamo/entity/prestamo.entity';
import { TipoUsuario } from '../../tipo-usuario/tipo-usuario.entity';
@Entity()
@@ -1,46 +1,42 @@
import {
Entity,
Column,
PrimaryGeneratedColumn,
ManyToOne,
Entity,
JoinColumn,
ManyToOne,
PrimaryGeneratedColumn,
} from 'typeorm';
import { Equipo } from '../equipo/entity/equipo.entity';
import { Operador } from '../operador/entity/operador.entity';
import { Usuario } from '../usuario/usuario.entity';
import { Equipo } from '../../equipo/entity/equipo.entity';
import { Operador } from '../../operador/entity/operador.entity';
import { Usuario } from '../../usuario/usuario.entity';
@Entity()
export class Prestamo {
@PrimaryGeneratedColumn()
id_prestamo: number;
@Column()
@Column({ type: Boolean, nullable: false, default: true })
activo: boolean;
@Column()
fecha_inicio: Date;
@Column()
hora_max_recoger: Date;
@Column()
hora_inicio: Date;
@Column()
hora_fin: Date;
@Column()
fecha_entrega: Date;
@Column()
cancelado_usuario: boolean;
@Column()
@Column({ type: Boolean, nullable: false, default: false })
cancelado_operador: boolean;
@ManyToOne(() => Usuario, (usuario) => usuario.prestamos)
@JoinColumn({ name: 'id_usuario' })
usuario: Usuario;
@Column({ type: Boolean, nullable: false, default: false })
cancelado_usuario: boolean;
@Column({ type: Date, nullable: false })
fecha_entrega: Date;
@Column({ type: Date, nullable: false })
fecha_inicio: Date;
@Column({ type: Date, nullable: false })
hora_fin: Date;
@Column({ type: Date, nullable: false })
hora_inicio: Date;
@Column({ type: Date, nullable: false })
hora_max_recoger: Date;
@ManyToOne(() => Equipo, (equipo) => equipo.prestamos)
@JoinColumn({ name: 'id_equipo' })
@@ -59,4 +55,8 @@ export class Prestamo {
)
@JoinColumn({ name: 'id_operador_regreso' })
operadorRegreso: Operador;
@ManyToOne(() => Usuario, (usuario) => usuario.prestamos)
@JoinColumn({ name: 'id_usuario' })
usuario: Usuario;
}
+40 -1
View File
@@ -1,7 +1,46 @@
import { Controller } from '@nestjs/common';
import { Controller, Get, Post, Put } from '@nestjs/common';
import { PrestamoService } from './prestamo.service';
@Controller('prestamo')
export class PrestamoController {
constructor(private prestamoService: PrestamoService) {}
@Get('activos')
activos() {}
@Put('cancelar_operador')
cancelarOperador() {}
@Put('cancelar_usuario')
cancelarUsuario() {}
@Put('entregar')
entregar() {}
@Get('historial')
historial() {}
@Get('historial_equipo')
historialEquipo() {}
@Get('historial_usuario')
historialUsuario() {}
@Post()
pedir() {}
@Get('prestamo_id_prestamo')
prestamoIdPrestamo() {}
@Get('prestamo_id_usuario')
prestamoIdUsuario() {}
@Get('prestamo_numero_inventario')
prestamoNumeroInventario() {}
@Put('regresar')
regresar() {}
@Get('reporte')
reporte() {}
}
+1 -1
View File
@@ -1,8 +1,8 @@
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { PrestamoController } from './prestamo.controller';
import { Prestamo } from './prestamo.entity';
import { PrestamoService } from './prestamo.service';
import { Prestamo } from './entity/prestamo.entity';
@Module({
imports: [TypeOrmModule.forFeature([Prestamo])],
+2 -2
View File
@@ -1,7 +1,7 @@
import { Injectable } from '@nestjs/common';
import { Repository } from 'typeorm';
import { InjectRepository } from '@nestjs/typeorm';
import { Prestamo } from './prestamo.entity';
import { Repository } from 'typeorm';
import { Prestamo } from './entity/prestamo.entity';
@Injectable()
export class PrestamoService {
+1 -1
View File
@@ -8,7 +8,7 @@ import {
} from 'typeorm';
import { Carrera } from '../carrera/entity/carrera.entity';
import { Institucion } from '../institucion/entity/institucion.entity';
import { Prestamo } from '../prestamo/prestamo.entity';
import { Prestamo } from '../prestamo/entity/prestamo.entity';
import { TipoUsuario } from '../tipo-usuario/tipo-usuario.entity';
@Entity()