prestamo y dvolcuion normal
This commit is contained in:
+16
-6
@@ -1,22 +1,32 @@
|
||||
import { Entity, PrimaryColumn, Column, ManyToOne } from 'typeorm'
|
||||
import {
|
||||
Entity,
|
||||
Column,
|
||||
ManyToOne,
|
||||
UpdateDateColumn,
|
||||
CreateDateColumn,
|
||||
PrimaryGeneratedColumn
|
||||
} from 'typeorm'
|
||||
import { Usuario } from './Usuario'
|
||||
import { Operador } from './Operador'
|
||||
import { Equipo } from './Equipo'
|
||||
|
||||
@Entity()
|
||||
export class Log {
|
||||
@PrimaryColumn()
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number
|
||||
|
||||
@Column({ type: 'date' })
|
||||
fecha: string
|
||||
|
||||
@Column()
|
||||
accion: string
|
||||
|
||||
@Column()
|
||||
@Column({ default: false })
|
||||
multa: string
|
||||
|
||||
@UpdateDateColumn()
|
||||
updateAt: Date
|
||||
|
||||
@CreateDateColumn()
|
||||
createAt: Date
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Usuario,
|
||||
(usuario) => usuario.logs
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
import * as bcrypt from 'bcrypt'
|
||||
import { Log } from './Log'
|
||||
import { IsString, IsBoolean } from 'class-validator'
|
||||
import { Prestamo } from './Prestamo'
|
||||
|
||||
@Entity()
|
||||
@Unique(['usuario'])
|
||||
@@ -43,6 +44,18 @@ export class Operador {
|
||||
)
|
||||
logs: Log[]
|
||||
|
||||
@OneToMany(
|
||||
(type) => Prestamo,
|
||||
(prestamo) => prestamo.operadorEntrega
|
||||
)
|
||||
entregas: Prestamo[]
|
||||
|
||||
@OneToMany(
|
||||
(type) => Prestamo,
|
||||
(prestamo) => prestamo.operadorRegreso
|
||||
)
|
||||
regresos: Prestamo[]
|
||||
|
||||
hashPassword () {
|
||||
this.secreto = bcrypt.hashSync(this.secreto, 10)
|
||||
}
|
||||
|
||||
+28
-6
@@ -1,22 +1,32 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne } from 'typeorm'
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
ManyToOne,
|
||||
UpdateDateColumn,
|
||||
CreateDateColumn
|
||||
} from 'typeorm'
|
||||
import { Usuario } from './Usuario'
|
||||
import { Reporte } from './Reporte'
|
||||
import { Equipo } from './Equipo'
|
||||
import { Mesa } from './Mesa'
|
||||
import { Operador } from './Operador'
|
||||
|
||||
@Entity()
|
||||
export class Prestamo {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number
|
||||
|
||||
@Column()
|
||||
@Column({ default: true })
|
||||
activo: boolean
|
||||
|
||||
@Column({ type: 'date' })
|
||||
fechaInicio: string
|
||||
@UpdateDateColumn()
|
||||
updatedAt: Date
|
||||
|
||||
@Column({ type: 'date' })
|
||||
fechaFin: string
|
||||
@CreateDateColumn()
|
||||
createdAt: Date
|
||||
|
||||
horaMaxEntrega: string
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Usuario,
|
||||
@@ -41,4 +51,16 @@ export class Prestamo {
|
||||
(equipo) => equipo.prestamos
|
||||
)
|
||||
equipo: Equipo
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Operador,
|
||||
(operador) => operador.entregas
|
||||
)
|
||||
operadorEntrega: Operador
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Operador,
|
||||
(operador) => operador.regresos
|
||||
)
|
||||
operadorRegreso: Operador
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user