cargamasviva
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import { Entity, OneToMany } from 'typeorm'
|
||||
import { Catalogo } from './Catalogo'
|
||||
import { Reservacion } from './Reservacion'
|
||||
|
||||
@Entity()
|
||||
export class Actividad extends Catalogo {
|
||||
@OneToMany(
|
||||
(type) => Reservacion,
|
||||
(reservacion) => reservacion.actividad
|
||||
)
|
||||
reservaciones: Reservacion[]
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Entity, ManyToOne } from 'typeorm'
|
||||
import { Catalogo } from './Catalogo'
|
||||
import { Reservacion } from './Reservacion'
|
||||
|
||||
@Entity()
|
||||
export class Adscripcion extends Catalogo {
|
||||
@ManyToOne(
|
||||
(type) => Reservacion,
|
||||
(reservacion) => reservacion.adscripcion
|
||||
)
|
||||
reservaciones: Reservacion[];
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import {
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
Entity,
|
||||
OneToOne,
|
||||
JoinColumn
|
||||
} from 'typeorm'
|
||||
import { TipoProblema } from './TipoProblema'
|
||||
|
||||
export interface AyudaRequest {
|
||||
id: number
|
||||
nombre: string
|
||||
correo: string
|
||||
descripcion: string
|
||||
solucion: string
|
||||
tipoProblema: number
|
||||
}
|
||||
|
||||
@Entity()
|
||||
export class Ayuda {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number
|
||||
|
||||
@Column()
|
||||
nombre: string
|
||||
|
||||
@Column()
|
||||
correo: string
|
||||
|
||||
@Column()
|
||||
descripcion: string
|
||||
|
||||
@Column()
|
||||
solucion: string
|
||||
|
||||
@OneToOne((type) => TipoProblema)
|
||||
@JoinColumn()
|
||||
tipoProblema: TipoProblema
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn
|
||||
} from 'typeorm'
|
||||
import { Tipo } from './Tipo'
|
||||
import { Reservacion } from './Reservacion'
|
||||
import { Equipo } from './Equipo'
|
||||
|
||||
@Entity()
|
||||
export class Carrito {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number
|
||||
|
||||
@Column()
|
||||
sobrenombre: number
|
||||
|
||||
@Column()
|
||||
kiosko: number
|
||||
|
||||
@OneToMany(
|
||||
(type) => Reservacion,
|
||||
(reservacion) => reservacion.carrito
|
||||
)
|
||||
reservaciones: Reservacion[]
|
||||
|
||||
@OneToMany(
|
||||
(type) => Equipo,
|
||||
(equipo) => equipo.carrito
|
||||
)
|
||||
equipos: Equipo[]
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Tipo,
|
||||
(tipo) => tipo.carritos
|
||||
)
|
||||
tipo: Tipo
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
createdAt: Date
|
||||
|
||||
@Column()
|
||||
@UpdateDateColumn()
|
||||
updatedAt: Date
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { PrimaryGeneratedColumn, Column } from 'typeorm'
|
||||
|
||||
export abstract class Catalogo {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column()
|
||||
nombre: string;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn
|
||||
} from 'typeorm'
|
||||
import { Carrito } from './Carrito'
|
||||
import { Prestamo } from './Prestamo'
|
||||
import { Log } from './Log'
|
||||
import { IsString, IsBoolean, IsNumber } from 'class-validator'
|
||||
|
||||
@Entity()
|
||||
export class Equipo {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number
|
||||
|
||||
@Column()
|
||||
@IsString()
|
||||
noSerie: string
|
||||
|
||||
@Column()
|
||||
@IsString()
|
||||
noInventario: string
|
||||
|
||||
@Column()
|
||||
@IsNumber()
|
||||
alias: number
|
||||
|
||||
@Column({ type: 'boolean', default: false })
|
||||
@IsBoolean()
|
||||
activo: boolean
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
createdAt: Date
|
||||
|
||||
@Column()
|
||||
@UpdateDateColumn()
|
||||
updatedAt: Date
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Carrito,
|
||||
(carrito) => carrito.equipos
|
||||
)
|
||||
carrito: Carrito
|
||||
|
||||
@OneToMany(
|
||||
(type) => Prestamo,
|
||||
(prestamo) => prestamo.equipo
|
||||
)
|
||||
prestamos: Prestamo[]
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Log,
|
||||
(log) => log.equipo
|
||||
)
|
||||
logs: Log[]
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { Entity, PrimaryColumn, Column, ManyToOne } from 'typeorm'
|
||||
import { Usuario } from './Usuario'
|
||||
import { Operador } from './Operador'
|
||||
import { Equipo } from './Equipo'
|
||||
|
||||
@Entity()
|
||||
export class Log {
|
||||
@PrimaryColumn()
|
||||
id: number
|
||||
|
||||
@Column({ type: 'date' })
|
||||
fecha: string
|
||||
|
||||
@Column()
|
||||
accion: string
|
||||
|
||||
@Column()
|
||||
multa: string
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Usuario,
|
||||
(usuario) => usuario.logs
|
||||
)
|
||||
usuario: Usuario
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Operador,
|
||||
(operador) => operador.logs
|
||||
)
|
||||
operador: Operador
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Equipo,
|
||||
(equipo) => equipo.logs
|
||||
)
|
||||
equipo: Equipo
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Entity, OneToMany } from 'typeorm'
|
||||
import { Catalogo } from './Catalogo'
|
||||
import { Reservacion } from './Reservacion'
|
||||
|
||||
@Entity()
|
||||
export class Lugar extends Catalogo {
|
||||
@OneToMany(
|
||||
(type) => Reservacion,
|
||||
(reservacion) => reservacion.lugar
|
||||
)
|
||||
reservaciones: Reservacion[];
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Entity, OneToMany } from 'typeorm'
|
||||
import { Catalogo } from './Catalogo'
|
||||
import { Prestamo } from './Prestamo'
|
||||
|
||||
@Entity()
|
||||
export class Mesa extends Catalogo {
|
||||
@OneToMany(
|
||||
(type) => Prestamo,
|
||||
(prestamo) => prestamo.mesa
|
||||
)
|
||||
prestamos: Prestamo[]
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
OneToMany,
|
||||
Unique,
|
||||
UpdateDateColumn,
|
||||
CreateDateColumn
|
||||
} from 'typeorm'
|
||||
import * as bcrypt from 'bcrypt'
|
||||
import { Log } from './Log'
|
||||
import { IsString, IsBoolean } from 'class-validator'
|
||||
|
||||
@Entity()
|
||||
@Unique(['usuario'])
|
||||
export class Operador {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number
|
||||
|
||||
@Column()
|
||||
@IsString()
|
||||
usuario: string
|
||||
|
||||
@Column()
|
||||
@IsString()
|
||||
secreto: string
|
||||
|
||||
@Column()
|
||||
@IsBoolean()
|
||||
admin: boolean
|
||||
|
||||
@Column()
|
||||
@UpdateDateColumn()
|
||||
updatedAt: Date
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
createdAt: Date
|
||||
|
||||
@OneToMany(
|
||||
(type) => Log,
|
||||
(log) => log.operador
|
||||
)
|
||||
logs: Log[]
|
||||
|
||||
hashPassword () {
|
||||
this.secreto = bcrypt.hashSync(this.secreto, 10)
|
||||
}
|
||||
|
||||
checkIfUnencryptedPasswordIsValid (unencryptedPassword: string) {
|
||||
return bcrypt.compareSync(unencryptedPassword, this.secreto)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Entity, OneToMany } from 'typeorm'
|
||||
import { Catalogo } from './Catalogo'
|
||||
import { Reporte } from './Reporte'
|
||||
|
||||
@Entity()
|
||||
export class Parte extends Catalogo {
|
||||
@OneToMany(
|
||||
(type) => Reporte,
|
||||
(reporte) => reporte.parte
|
||||
)
|
||||
reportes: Reporte[]
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne } from 'typeorm'
|
||||
import { Usuario } from './Usuario'
|
||||
import { Reporte } from './Reporte'
|
||||
import { Equipo } from './Equipo'
|
||||
import { Mesa } from './Mesa'
|
||||
|
||||
@Entity()
|
||||
export class Prestamo {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number
|
||||
|
||||
@Column()
|
||||
activo: boolean
|
||||
|
||||
@Column({ type: 'date' })
|
||||
fechaInicio: string
|
||||
|
||||
@Column({ type: 'date' })
|
||||
fechaFin: string
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Usuario,
|
||||
(usuario) => usuario.prestamos
|
||||
)
|
||||
usuario: Usuario
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Mesa,
|
||||
(mesa) => mesa.prestamos
|
||||
)
|
||||
mesa: Mesa
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Reporte,
|
||||
(reporte) => reporte.prestamos
|
||||
)
|
||||
reporte: Reporte
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Equipo,
|
||||
(equipo) => equipo.prestamos
|
||||
)
|
||||
equipo: Equipo
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
ManyToOne,
|
||||
OneToMany
|
||||
} from 'typeorm'
|
||||
import { Parte } from './Parte'
|
||||
import { Reservacion } from './Reservacion'
|
||||
import { Prestamo } from './Prestamo'
|
||||
|
||||
@Entity()
|
||||
export class Reporte {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number
|
||||
|
||||
@Column()
|
||||
equipos: number
|
||||
|
||||
@Column()
|
||||
descripcion: string
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Parte,
|
||||
(parte) => parte.reportes
|
||||
)
|
||||
parte: Parte
|
||||
|
||||
@OneToMany(
|
||||
(type) => Reservacion,
|
||||
(reservacion) => reservacion.reporte
|
||||
)
|
||||
reservaciones: Reservacion[]
|
||||
|
||||
@OneToMany(
|
||||
(type) => Prestamo,
|
||||
(prestamo) => prestamo.reporte
|
||||
)
|
||||
prestamos: Prestamo[]
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne } from 'typeorm'
|
||||
import { Actividad } from './Actividad'
|
||||
import { Adscripcion } from './Adscripcion'
|
||||
import { Lugar } from './Lugar'
|
||||
import { Carrito } from './Carrito'
|
||||
import { Reporte } from './Reporte'
|
||||
import { Usuario } from './Usuario'
|
||||
|
||||
@Entity()
|
||||
export class Reservacion {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number
|
||||
|
||||
@Column({ type: 'date' })
|
||||
fechaInicio: string
|
||||
|
||||
@Column({ type: 'date' })
|
||||
fechaFin: string
|
||||
|
||||
@Column()
|
||||
descripcion: string
|
||||
|
||||
@Column({ type: 'boolean' })
|
||||
uso: boolean
|
||||
|
||||
@Column({ type: 'boolean' })
|
||||
cancelado: boolean
|
||||
|
||||
@Column({ type: 'boolean' })
|
||||
aceptado: boolean
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Actividad,
|
||||
(actividad) => actividad.reservaciones
|
||||
)
|
||||
actividad: Actividad
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Adscripcion,
|
||||
(adscripcion) => adscripcion.reservaciones
|
||||
)
|
||||
adscripcion: Adscripcion
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Lugar,
|
||||
(lugar) => lugar.reservaciones
|
||||
)
|
||||
lugar: Lugar
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Carrito,
|
||||
(carrito) => carrito.reservaciones
|
||||
)
|
||||
carrito: Carrito
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Reporte,
|
||||
(reporte) => reporte.reservaciones
|
||||
)
|
||||
reporte: Reporte
|
||||
|
||||
@ManyToOne(
|
||||
(type) => Usuario,
|
||||
(reporte) => reporte.reservaciones
|
||||
)
|
||||
usuario: Usuario
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Entity, OneToMany, PrimaryGeneratedColumn, Column } from 'typeorm'
|
||||
import { Catalogo } from './Catalogo'
|
||||
import { Carrito } from './Carrito'
|
||||
import { IsString } from 'class-validator'
|
||||
|
||||
@Entity()
|
||||
export class Tipo extends Catalogo {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number
|
||||
|
||||
@Column()
|
||||
@IsString()
|
||||
nombre: string
|
||||
|
||||
@OneToMany(
|
||||
(type) => Carrito,
|
||||
(carrito) => carrito.tipo
|
||||
)
|
||||
carritos: Carrito[]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { PrimaryGeneratedColumn, Column, Entity } from 'typeorm'
|
||||
|
||||
@Entity()
|
||||
export class TipoProblema {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column()
|
||||
nombre: string;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm'
|
||||
|
||||
@Entity()
|
||||
export class User {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number
|
||||
|
||||
@Column()
|
||||
firstName: string
|
||||
|
||||
@Column()
|
||||
lastName: string
|
||||
|
||||
@Column()
|
||||
age: number
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
OneToMany,
|
||||
Unique,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn
|
||||
} from 'typeorm'
|
||||
import {
|
||||
IsDate,
|
||||
IsEmail,
|
||||
Length,
|
||||
IsBoolean,
|
||||
IsString,
|
||||
IsOptional
|
||||
} from 'class-validator'
|
||||
import { Reservacion } from './Reservacion'
|
||||
import { Prestamo } from './Prestamo'
|
||||
import { Log } from './Log'
|
||||
|
||||
@Entity()
|
||||
@Unique(['id', 'correoAlternativo'])
|
||||
export class Usuario {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: string
|
||||
|
||||
@Column()
|
||||
@IsString()
|
||||
nombre: string
|
||||
|
||||
@Column()
|
||||
@IsString()
|
||||
apellidoPaterno: string
|
||||
|
||||
@Column()
|
||||
@IsString()
|
||||
apellidoMaterno: string
|
||||
|
||||
@Column()
|
||||
@IsEmail()
|
||||
correoAlternativo: string
|
||||
|
||||
@Column()
|
||||
@Length(10)
|
||||
numeroTelefonico: string
|
||||
|
||||
@Column()
|
||||
@IsString()
|
||||
identificacion: string
|
||||
|
||||
@Column()
|
||||
@IsString()
|
||||
institucion: string
|
||||
|
||||
@Column({ type: 'date', default: '1996-11-07' })
|
||||
@IsDate()
|
||||
@IsOptional()
|
||||
multa: string
|
||||
|
||||
@Column({ type: 'date', default: '1996-11-07' })
|
||||
@IsDate()
|
||||
@IsOptional()
|
||||
multaRed: string
|
||||
|
||||
@Column({ default: false })
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
baja: boolean
|
||||
|
||||
@Column()
|
||||
@CreateDateColumn()
|
||||
createdAt: Date
|
||||
|
||||
@Column()
|
||||
@UpdateDateColumn()
|
||||
updatedAt: Date
|
||||
|
||||
@OneToMany(
|
||||
(type) => Reservacion,
|
||||
(reservacion) => reservacion.usuario
|
||||
)
|
||||
reservaciones: Reservacion[]
|
||||
|
||||
@OneToMany(
|
||||
(type) => Prestamo,
|
||||
(prestamo) => prestamo.usuario
|
||||
)
|
||||
prestamos: Prestamo[]
|
||||
|
||||
@OneToMany(
|
||||
(type) => Log,
|
||||
(log) => log.usuario
|
||||
)
|
||||
logs: Log[]
|
||||
}
|
||||
Reference in New Issue
Block a user