From 9d9df020db6acc0972bce9a85233ca0009393d4d Mon Sep 17 00:00:00 2001 From: Emilio Date: Thu, 6 Nov 2025 14:01:53 -0600 Subject: [PATCH] cambio en algunas tablas --- src/app.module.ts | 7 +- src/auth/auth.module.ts | 2 + src/carrera/entities/carrera.entity.ts | 18 +-- .../entities/caso-especial.entity.ts | 61 ++++----- .../entities/cuestionario-alumno.entity.ts | 113 ++++++++-------- .../entities/cuestionario-programa2.entity.ts | 121 +++++++++--------- 6 files changed, 171 insertions(+), 151 deletions(-) diff --git a/src/app.module.ts b/src/app.module.ts index c767243..256bd50 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -14,6 +14,7 @@ import { ServicioModule } from './servicio/servicio.module'; import { StatusModule } from './status/status.module'; import { TipoUsuarioModule } from './tipo-usuario/tipo-usuario.module'; import { UsuarioModule } from './usuario/usuario.module'; +import { AuthModule } from './auth/auth.module'; @Module({ imports: [ @@ -28,7 +29,9 @@ import { UsuarioModule } from './usuario/usuario.module'; port: Number(process.env.DB_PORT), synchronize: true, dropSchema: false, - autoLoadEntities: false, + autoLoadEntities: true, + logger: 'advanced-console', + logging: 'all', }), CarreraModule, @@ -49,6 +52,8 @@ import { UsuarioModule } from './usuario/usuario.module'; StatusModule, + AuthModule, + TipoUsuarioModule, UsuarioModule, diff --git a/src/auth/auth.module.ts b/src/auth/auth.module.ts index 53374ae..dfeb60d 100644 --- a/src/auth/auth.module.ts +++ b/src/auth/auth.module.ts @@ -3,6 +3,7 @@ import { Module } from '@nestjs/common'; import { AuthService } from './auth.service'; import { Usuario } from 'src/usuario/entities/usuario.entity'; import { TypeOrmModule } from '@nestjs/typeorm'; +import { AuthController } from './auth.controller'; @Module({ imports: [ @@ -12,6 +13,7 @@ import { TypeOrmModule } from '@nestjs/typeorm'; signOptions: { expiresIn: '1h' }, }), ], + controllers: [AuthController], providers: [AuthService], exports: [AuthService], }) diff --git a/src/carrera/entities/carrera.entity.ts b/src/carrera/entities/carrera.entity.ts index 2249f65..1389651 100644 --- a/src/carrera/entities/carrera.entity.ts +++ b/src/carrera/entities/carrera.entity.ts @@ -1,24 +1,18 @@ import { CasoEspecial } from 'src/caso-especial/entities/caso-especial.entity'; import { Servicio } from 'src/servicio/entities/servicio.entity'; -import { - Column, - Entity, - ManyToMany, - OneToMany, - PrimaryGeneratedColumn, -} from 'typeorm'; +import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm'; @Entity('carrera') export class Carrera { - @PrimaryGeneratedColumn() + @PrimaryGeneratedColumn({ name: 'idCarrera' }) idCarrera: number; @Column({ type: 'varchar', length: 50 }) carrera: string; - @OneToMany(() => Servicio, (servicio) => servicio.carrera) - servicio: Servicio[]; - @OneToMany(() => CasoEspecial, (casoEspecial) => casoEspecial.carrera) - casoEspecial: CasoEspecial[]; + casosEspeciales: CasoEspecial[]; + + @OneToMany(() => Servicio, (servicio) => servicio.carrera) + servicios: Servicio[]; } diff --git a/src/caso-especial/entities/caso-especial.entity.ts b/src/caso-especial/entities/caso-especial.entity.ts index e012c72..3995b5b 100644 --- a/src/caso-especial/entities/caso-especial.entity.ts +++ b/src/caso-especial/entities/caso-especial.entity.ts @@ -1,71 +1,74 @@ +import { + Entity, + PrimaryGeneratedColumn, + Column, + ManyToOne, + JoinColumn, + CreateDateColumn, + UpdateDateColumn, +} from 'typeorm'; + import { Carrera } from 'src/carrera/entities/carrera.entity'; import { Status } from 'src/status/entities/status.entity'; import { Usuario } from 'src/usuario/entities/usuario.entity'; -import { - Column, - Entity, - JoinColumn, - ManyToMany, - ManyToOne, - PrimaryGeneratedColumn, -} from 'typeorm'; @Entity('caso_especial') export class CasoEspecial { - @PrimaryGeneratedColumn({ name: 'idCasoEspecial', type: 'int' }) + @PrimaryGeneratedColumn({ name: 'idCasoEspecial' }) idCasoEspecial: number; - @Column({ name: 'creditos', type: 'varchar', length: 3 }) + @Column({ name: 'creditos', type: 'varchar', length: 3, nullable: false }) creditos: string; - @Column({ name: 'correo', type: 'varchar', length: 60 }) + @Column({ name: 'correo', type: 'varchar', length: 60, nullable: false }) correo: string; - @Column({ name: 'telefono', type: 'varchar', length: 15 }) + @Column({ name: 'telefono', type: 'varchar', length: 15, nullable: false }) telefono: string; - @Column({ name: 'institucion', type: 'varchar', length: 200 }) - institucion: string; + @Column({ name: 'institucion', type: 'varchar', length: 200, nullable: true }) + institucion?: string; - @Column({ name: 'dependencia', type: 'varchar', length: 200 }) - dependencia: string; + @Column({ name: 'dependencia', type: 'varchar', length: 200, nullable: true }) + dependencia?: string; - @Column({ name: 'motivo', type: 'varchar', length: 1 }) - motivo: string; + @Column({ name: 'motivo', type: 'varchar', length: 1, nullable: true }) + motivo?: string; - @Column({ name: 'direccion', type: 'varchar', length: 200 }) + @Column({ name: 'direccion', type: 'varchar', length: 200, nullable: false }) direccion: string; - @Column({ name: 'fechaInicio', type: 'datetime' }) + @Column({ name: 'fechaInicio', type: 'datetime', nullable: false }) fechaInicio: Date; - @Column({ name: 'fechaFin', type: 'datetime' }) + @Column({ name: 'fechaFin', type: 'datetime', nullable: false }) fechaFin: Date; - @Column({ name: 'fechaNacimiento', type: 'datetime' }) + @Column({ name: 'fechaNacimiento', type: 'datetime', nullable: false }) fechaNacimiento: Date; - @Column({ name: 'carpeta', type: 'varchar', length: 60 }) + @Column({ name: 'carpeta', type: 'varchar', length: 60, nullable: false }) carpeta: string; - @Column({ name: 'archivoZip', type: 'varchar', length: 60 }) + @Column({ name: 'archivoZip', type: 'varchar', length: 60, nullable: false }) archivoZip: string; - @Column({ name: 'createdAt', type: 'datetime' }) + @CreateDateColumn({ name: 'createdAt', type: 'datetime' }) createdAt: Date; - @Column({ name: 'updatedAt', type: 'datetime' }) + @UpdateDateColumn({ name: 'updatedAt', type: 'datetime' }) updatedAt: Date; - @ManyToOne(() => Usuario, (usuario) => usuario.casoEspecial) + // ===== Relaciones ===== + @ManyToOne(() => Usuario, (usuario) => usuario.casosEspeciales) @JoinColumn({ name: 'idUsuario' }) usuario: Usuario; - @ManyToOne(() => Carrera, (carrera) => carrera.casoEspecial) + @ManyToOne(() => Carrera, (carrera) => carrera.casosEspeciales) @JoinColumn({ name: 'idCarrera' }) carrera: Carrera; - @ManyToOne(() => Status, (status) => status.casoEspecial) + @ManyToOne(() => Status, (status) => status.casosEspeciales) @JoinColumn({ name: 'idStatus' }) status: Status; } diff --git a/src/cuestionario-alumno/entities/cuestionario-alumno.entity.ts b/src/cuestionario-alumno/entities/cuestionario-alumno.entity.ts index aeacaac..631c3ee 100644 --- a/src/cuestionario-alumno/entities/cuestionario-alumno.entity.ts +++ b/src/cuestionario-alumno/entities/cuestionario-alumno.entity.ts @@ -1,111 +1,122 @@ import { Servicio } from 'src/servicio/entities/servicio.entity'; -import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm'; +import { + Entity, + PrimaryGeneratedColumn, + Column, + CreateDateColumn, + OneToMany, +} from 'typeorm'; @Entity('cuestionario_alumno') export class CuestionarioAlumno { - @PrimaryGeneratedColumn({ name: 'idCuestionarioAlumno', type: 'int' }) + @PrimaryGeneratedColumn({ name: 'idCuestionarioAlumno' }) idCuestionarioAlumno: number; - @Column({ name: 'sexo', type: 'varchar', length: 1 }) + @Column({ name: 'sexo', type: 'varchar', length: 1, nullable: false }) sexo: string; - @Column({ name: 'edad', type: 'varchar', length: 2 }) + @Column({ name: 'edad', type: 'varchar', length: 2, nullable: false }) edad: string; - @Column({ name: 'servicioMedico', type: 'varchar', length: 100 }) + @Column({ + name: 'servicioMedico', + type: 'varchar', + length: 100, + nullable: false, + }) servicioMedico: string; - @Column({ name: 'p1', type: 'tinyint', width: 1 }) - p1: number; + @Column({ name: 'p1', type: 'tinyint', width: 1, nullable: false }) + p1: boolean; - @Column({ name: 'p2', type: 'tinyint', width: 1 }) - p2: number; + @Column({ name: 'p2', type: 'tinyint', width: 1, nullable: false }) + p2: boolean; - @Column({ name: 'p3', type: 'varchar', length: 150 }) + @Column({ name: 'p3', type: 'varchar', length: 150, nullable: false }) p3: string; - @Column({ name: 'p4', type: 'tinyint', width: 1 }) - p4: number; + @Column({ name: 'p4', type: 'tinyint', width: 1, nullable: false }) + p4: boolean; - @Column({ name: 'p5', type: 'varchar', length: 7 }) + @Column({ name: 'p5', type: 'varchar', length: 7, nullable: false }) p5: string; - @Column({ name: 'p6', type: 'tinyint', width: 1 }) - p6: number; + @Column({ name: 'p6', type: 'tinyint', width: 1, nullable: false }) + p6: boolean; - @Column({ name: 'p7', type: 'tinyint', width: 1 }) - p7: number; + @Column({ name: 'p7', type: 'tinyint', width: 1, nullable: false }) + p7: boolean; - @Column({ name: 'p8', type: 'varchar', length: 5 }) + @Column({ name: 'p8', type: 'varchar', length: 5, nullable: false }) p8: string; - @Column({ name: 'p9', type: 'tinyint', width: 1 }) - p9: number; + @Column({ name: 'p9', type: 'tinyint', width: 1, nullable: false }) + p9: boolean; - @Column({ name: 'p10', type: 'tinyint', width: 1 }) - p10: number; + @Column({ name: 'p10', type: 'tinyint', width: 1, nullable: false }) + p10: boolean; - @Column({ name: 'p11', type: 'tinyint', width: 1 }) - p11: number; + @Column({ name: 'p11', type: 'tinyint', width: 1, nullable: false }) + p11: boolean; - @Column({ name: 'p12', type: 'tinyint', width: 1 }) - p12: number; + @Column({ name: 'p12', type: 'tinyint', width: 1, nullable: false }) + p12: boolean; - @Column({ name: 'p13', type: 'tinyint', width: 1 }) - p13: number; + @Column({ name: 'p13', type: 'tinyint', width: 1, nullable: false }) + p13: boolean; - @Column({ name: 'p14', type: 'varchar', length: 7 }) + @Column({ name: 'p14', type: 'varchar', length: 7, nullable: false }) p14: string; - @Column({ name: 'p15', type: 'varchar', length: 7 }) + @Column({ name: 'p15', type: 'varchar', length: 7, nullable: false }) p15: string; - @Column({ name: 'p16', type: 'varchar', length: 2 }) + @Column({ name: 'p16', type: 'varchar', length: 2, nullable: false }) p16: string; - @Column({ name: 'p17', type: 'varchar', length: 5 }) + @Column({ name: 'p17', type: 'varchar', length: 5, nullable: false }) p17: string; - @Column({ name: 'p18', type: 'tinyint', width: 1 }) - p18: number; + @Column({ name: 'p18', type: 'tinyint', width: 1, nullable: false }) + p18: boolean; - @Column({ name: 'p19', type: 'tinyint', width: 1 }) - p19: number; + @Column({ name: 'p19', type: 'tinyint', width: 1, nullable: false }) + p19: boolean; - @Column({ name: 'p20', type: 'tinyint', width: 1 }) - p20: number; + @Column({ name: 'p20', type: 'tinyint', width: 1, nullable: false }) + p20: boolean; - @Column({ name: 'p21', type: 'varchar', length: 9 }) + @Column({ name: 'p21', type: 'varchar', length: 9, nullable: false }) p21: string; - @Column({ name: 'p22', type: 'varchar', length: 23 }) + @Column({ name: 'p22', type: 'varchar', length: 23, nullable: false }) p22: string; - @Column({ name: 'p23', type: 'varchar', length: 8 }) + @Column({ name: 'p23', type: 'varchar', length: 8, nullable: false }) p23: string; - @Column({ name: 'p24', type: 'varchar', length: 8 }) + @Column({ name: 'p24', type: 'varchar', length: 8, nullable: false }) p24: string; - @Column({ name: 'p25', type: 'tinyint', width: 1 }) - p25: number; + @Column({ name: 'p25', type: 'tinyint', width: 1, nullable: false }) + p25: boolean; - @Column({ name: 'p26', type: 'tinyint', width: 1 }) - p26: number; + @Column({ name: 'p26', type: 'tinyint', width: 1, nullable: false }) + p26: boolean; - @Column({ name: 'p27', type: 'varchar', length: 400 }) + @Column({ name: 'p27', type: 'varchar', length: 400, nullable: false }) p27: string; - @Column({ name: 'p28', type: 'varchar', length: 1 }) + @Column({ name: 'p28', type: 'varchar', length: 1, nullable: false }) p28: string; - @Column({ name: 'p29', type: 'varchar', length: 1 }) + @Column({ name: 'p29', type: 'varchar', length: 1, nullable: false }) p29: string; - @Column({ name: 'p30', type: 'varchar', length: 400 }) + @Column({ name: 'p30', type: 'varchar', length: 400, nullable: false }) p30: string; - @Column({ name: 'createdAt', type: 'datetime' }) + @CreateDateColumn({ name: 'createdAt', type: 'datetime' }) createdAt: Date; @OneToMany(() => Servicio, (servicio) => servicio.cuestionarioAlumno2) diff --git a/src/cuestionario-programa2/entities/cuestionario-programa2.entity.ts b/src/cuestionario-programa2/entities/cuestionario-programa2.entity.ts index 702a23e..2511de3 100644 --- a/src/cuestionario-programa2/entities/cuestionario-programa2.entity.ts +++ b/src/cuestionario-programa2/entities/cuestionario-programa2.entity.ts @@ -1,90 +1,95 @@ -import { Servicio } from "src/servicio/entities/servicio.entity"; -import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm"; +import { Servicio } from 'src/servicio/entities/servicio.entity'; +import { + Column, + CreateDateColumn, + Entity, + OneToMany, + PrimaryGeneratedColumn, +} from 'typeorm'; @Entity('cuestionario_programa_2') export class CuestionarioPrograma2 { - @PrimaryGeneratedColumn() + @PrimaryGeneratedColumn({ name: 'idCuestionarioPrograma2' }) idCuestionarioPrograma2: number; - // Sección p3_A_* - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_A_1: string; + @CreateDateColumn({ name: 'createdAt', type: 'datetime', nullable: true }) + createdAt?: Date; - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_A_2: string; + @Column({ name: 'p3_A_1', type: 'varchar', length: 50, nullable: true }) + p3_A_1?: string; - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_A_3: string; + @Column({ name: 'p3_A_2', type: 'varchar', length: 50, nullable: true }) + p3_A_2?: string; - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_A_4: string; + @Column({ name: 'p3_A_3', type: 'varchar', length: 50, nullable: true }) + p3_A_3?: string; - // Sección p3_B_* - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_B_1: string; + @Column({ name: 'p3_A_4', type: 'varchar', length: 50, nullable: true }) + p3_A_4?: string; - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_B_2: string; + @Column({ name: 'p3_B_1', type: 'varchar', length: 50, nullable: true }) + p3_B_1?: string; - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_B_3: string; + @Column({ name: 'p3_B_2', type: 'varchar', length: 50, nullable: true }) + p3_B_2?: string; - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_B_4: string; + @Column({ name: 'p3_B_3', type: 'varchar', length: 50, nullable: true }) + p3_B_3?: string; - // Sección p3_C_* - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_C_1: string; + @Column({ name: 'p3_B_4', type: 'varchar', length: 50, nullable: true }) + p3_B_4?: string; - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_C_2: string; + @Column({ name: 'p3_C_1', type: 'varchar', length: 50, nullable: true }) + p3_C_1?: string; - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_C_3: string; + @Column({ name: 'p3_C_2', type: 'varchar', length: 50, nullable: true }) + p3_C_2?: string; - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_C_4: string; + @Column({ name: 'p3_C_3', type: 'varchar', length: 50, nullable: true }) + p3_C_3?: string; - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_C_5: string; + @Column({ name: 'p3_C_4', type: 'varchar', length: 50, nullable: true }) + p3_C_4?: string; - // Sección p3_D_* - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_D_1: string; + @Column({ name: 'p3_C_5', type: 'varchar', length: 50, nullable: true }) + p3_C_5?: string; - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_D_2: string; + @Column({ name: 'p3_D_1', type: 'varchar', length: 50, nullable: true }) + p3_D_1?: string; - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_D_3: string; + @Column({ name: 'p3_D_2', type: 'varchar', length: 50, nullable: true }) + p3_D_2?: string; - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_D_4: string; + @Column({ name: 'p3_D_3', type: 'varchar', length: 50, nullable: true }) + p3_D_3?: string; - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_D_5: string; + @Column({ name: 'p3_D_4', type: 'varchar', length: 50, nullable: true }) + p3_D_4?: string; - // Sección p3_E_* - @Column({ type: 'varchar', length: 50, nullable: false }) - p3_E_1: string; + @Column({ name: 'p3_D_5', type: 'varchar', length: 50, nullable: true }) + p3_D_5?: string; - // p1, p2, p4, p5, p6 - @Column({ type: 'varchar', length: 100, nullable: false }) - p1: string; + @Column({ name: 'p3_E_1', type: 'varchar', length: 50, nullable: true }) + p3_E_1?: string; - @Column({ type: 'varchar', length: 50, nullable: false }) - p2: string; + @Column({ name: 'p1', type: 'varchar', length: 500, nullable: true }) + p1?: string; - @Column({ type: 'varchar', length: 100, nullable: false }) - p4: string; + @Column({ name: 'p2', type: 'varchar', length: 200, nullable: true }) + p2?: string; - @Column({ type: 'varchar', length: 5, nullable: false }) - p5: string; + @Column({ name: 'p4', type: 'varchar', length: 500, nullable: true }) + p4?: string; - @Column({ type: 'varchar', length: 100, nullable: true }) + @Column({ name: 'p5', type: 'varchar', length: 200, nullable: true }) + p5?: string; + + @Column({ name: 'p6', type: 'varchar', length: 500, nullable: true }) p6?: string; - @OneToMany(()=>Servicio,(servicio)=>servicio.cuestionarioAlumno2) - servicio:Servicio[]; + @Column({ name: 'p7', type: 'varchar', length: 200, nullable: true }) + p7?: string; + @OneToMany(() => Servicio, (servicio) => servicio.cuestionarioAlumno2) + servicio: Servicio[]; }