Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 95044f6426 | |||
| dd0bc1550a | |||
| c34fb58b30 | |||
| ff23484331 | |||
| 0cb847d057 | |||
| 8834d654d3 | |||
| 90dad8f641 | |||
| 921d9a8970 | |||
| 5077af6727 | |||
| 62f3d17e83 | |||
| 199034754e | |||
| 889ebec02b |
Generated
+2766
-2144
File diff suppressed because it is too large
Load Diff
+24
-20
@@ -20,15 +20,15 @@
|
|||||||
"test:e2e": "jest --config ./test/jest-e2e.json"
|
"test:e2e": "jest --config ./test/jest-e2e.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nestjs/common": "^9.0.0",
|
"@nestjs/common": "^11.1.28",
|
||||||
"@nestjs/config": "^2.3.1",
|
"@nestjs/config": "^4.0.4",
|
||||||
"@nestjs/core": "^9.0.0",
|
"@nestjs/core": "^11.1.28",
|
||||||
"@nestjs/jwt": "^10.0.2",
|
"@nestjs/jwt": "^11.0.2",
|
||||||
"@nestjs/passport": "^9.0.3",
|
"@nestjs/passport": "^11.0.5",
|
||||||
"@nestjs/platform-express": "^9.0.0",
|
"@nestjs/platform-express": "^11.1.28",
|
||||||
"@nestjs/serve-static": "^3.0.1",
|
"@nestjs/serve-static": "^5.0.5",
|
||||||
"@nestjs/swagger": "^6.2.1",
|
"@nestjs/swagger": "^11.4.6",
|
||||||
"@nestjs/typeorm": "^9.0.1",
|
"@nestjs/typeorm": "^11.0.3",
|
||||||
"bcrypt": "^5.1.0",
|
"bcrypt": "^5.1.0",
|
||||||
"blob-stream": "^0.1.3",
|
"blob-stream": "^0.1.3",
|
||||||
"class-transformer": "^0.5.1",
|
"class-transformer": "^0.5.1",
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
"date-fns": "^2.30.0",
|
"date-fns": "^2.30.0",
|
||||||
"exceljs": "^4.4.0",
|
"exceljs": "^4.4.0",
|
||||||
"moment": "^2.30.1",
|
"moment": "^2.30.1",
|
||||||
"multer": "^1.4.5-lts.1",
|
"multer": "^2.2.0",
|
||||||
"mysql2": "^3.23.2",
|
"mysql2": "^3.23.2",
|
||||||
"nodemailer": "^6.9.1",
|
"nodemailer": "^6.9.1",
|
||||||
"passport": "^0.6.0",
|
"passport": "^0.6.0",
|
||||||
@@ -45,40 +45,39 @@
|
|||||||
"pdf-lib": "^1.17.1",
|
"pdf-lib": "^1.17.1",
|
||||||
"pdfkit": "^0.13.0",
|
"pdfkit": "^0.13.0",
|
||||||
"pg": "^8.22.0",
|
"pg": "^8.22.0",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.2.2",
|
||||||
"rxjs": "^7.8.2",
|
"rxjs": "^7.8.2",
|
||||||
"swagger-ui-express": "^4.6.1",
|
"swagger-ui-express": "^4.6.1",
|
||||||
"sybase": "^1.2.3",
|
"sybase": "^1.2.3",
|
||||||
"typeorm": "^0.3.12",
|
"typeorm": "^0.3.12",
|
||||||
"uuid": "^9.0.1",
|
"uuid": "^9.0.1"
|
||||||
"xlsx": "^0.18.5"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@jridgewell/sourcemap-codec": "^1.4.14",
|
"@jridgewell/sourcemap-codec": "^1.4.14",
|
||||||
"@nestjs/cli": "^9.0.0",
|
"@nestjs/cli": "^9.0.0",
|
||||||
"@nestjs/schematics": "^9.0.0",
|
"@nestjs/schematics": "^9.0.0",
|
||||||
"@nestjs/testing": "^9.0.0",
|
"@nestjs/testing": "^11.1.28",
|
||||||
"@types/express": "^5.0.6",
|
"@types/express": "^5.0.6",
|
||||||
"@types/jest": "29.2.4",
|
"@types/jest": "^29.5.14",
|
||||||
"@types/multer": "^2.2.0",
|
"@types/multer": "^2.2.0",
|
||||||
"@types/node": "18.11.18",
|
"@types/node": "18.11.18",
|
||||||
"@types/passport-local": "^1.0.38",
|
"@types/passport-local": "^1.0.38",
|
||||||
"@types/supertest": "^2.0.11",
|
"@types/supertest": "^7.2.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
||||||
"@typescript-eslint/parser": "^5.0.0",
|
"@typescript-eslint/parser": "^5.0.0",
|
||||||
"eslint": "^8.0.1",
|
"eslint": "^8.0.1",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.3.0",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.0.0",
|
||||||
"jest": "29.3.1",
|
"jest": "^29.7.0",
|
||||||
"pdfmake": "^0.2.7",
|
"pdfmake": "^0.2.7",
|
||||||
"prettier": "^2.3.2",
|
"prettier": "^2.3.2",
|
||||||
"source-map-support": "^0.5.20",
|
"source-map-support": "^0.5.20",
|
||||||
"supertest": "^6.1.3",
|
"supertest": "^7.2.2",
|
||||||
"ts-jest": "29.0.3",
|
"ts-jest": "^29.4.12",
|
||||||
"ts-loader": "^9.6.2",
|
"ts-loader": "^9.6.2",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"tsconfig-paths": "4.1.1",
|
"tsconfig-paths": "4.1.1",
|
||||||
"typescript": "^4.7.4"
|
"typescript": "~5.7.0"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"moduleFileExtensions": [
|
"moduleFileExtensions": [
|
||||||
@@ -96,5 +95,10 @@
|
|||||||
],
|
],
|
||||||
"coverageDirectory": "../coverage",
|
"coverageDirectory": "../coverage",
|
||||||
"testEnvironment": "node"
|
"testEnvironment": "node"
|
||||||
|
},
|
||||||
|
"allowScripts": {
|
||||||
|
"bcrypt@5.1.0": true,
|
||||||
|
"es5-ext@0.10.64": true,
|
||||||
|
"@nestjs/core@10.4.22": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ import { ActividadService } from './actividad.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [ActividadController],
|
controllers: [ActividadController],
|
||||||
providers: [ActividadService]
|
providers: [ActividadService],
|
||||||
})
|
})
|
||||||
export class ActividadModule {}
|
export class ActividadModule {}
|
||||||
|
|||||||
@@ -12,14 +12,16 @@ export class AlmacenamientoService {
|
|||||||
|
|
||||||
// Example method to create a new record
|
// Example method to create a new record
|
||||||
async create(correo: string): Promise<any> {
|
async create(correo: string): Promise<any> {
|
||||||
console.log(correo)
|
console.log(correo);
|
||||||
const existente = await this.almacenamientoRepository.findOne({ where:{correo} });
|
const existente = await this.almacenamientoRepository.findOne({
|
||||||
console.log(existente)
|
where: { correo },
|
||||||
|
});
|
||||||
|
console.log(existente);
|
||||||
if (!existente) {
|
if (!existente) {
|
||||||
// Maneja el error aquí mismo
|
// Maneja el error aquí mismo
|
||||||
throw new HttpException(
|
throw new HttpException(
|
||||||
{ error: 'Este usuario no tiene acceso' },
|
{ error: 'Este usuario no tiene acceso' },
|
||||||
HttpStatus.NOT_FOUND
|
HttpStatus.NOT_FOUND,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,5 +12,4 @@ export class Almacenamiento {
|
|||||||
name: 'fecha_ampliacion',
|
name: 'fecha_ampliacion',
|
||||||
})
|
})
|
||||||
fechaConsulta: Date;
|
fechaConsulta: Date;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-5
@@ -132,11 +132,7 @@ import { TylController } from './tyl/tyl.controller';
|
|||||||
ComentariosModule,
|
ComentariosModule,
|
||||||
AlmacenamientoModule,
|
AlmacenamientoModule,
|
||||||
],
|
],
|
||||||
controllers: [
|
controllers: [AppController, InscripcionStatusController, TylController],
|
||||||
AppController,
|
|
||||||
InscripcionStatusController,
|
|
||||||
TylController,
|
|
||||||
],
|
|
||||||
providers: [AppService, InscripcionStatusService],
|
providers: [AppService, InscripcionStatusService],
|
||||||
})
|
})
|
||||||
export class AppModule {
|
export class AppModule {
|
||||||
|
|||||||
@@ -27,6 +27,6 @@ export class AuthController {
|
|||||||
|
|
||||||
@Post('validate')
|
@Post('validate')
|
||||||
validar(@Param() token: any) {
|
validar(@Param() token: any) {
|
||||||
return this.authValidar.validate
|
return this.authValidar.validate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
import { applyDecorators } from '@nestjs/common';
|
import { applyDecorators } from '@nestjs/common';
|
||||||
import {
|
import { ApiOperation, ApiResponse, ApiTags, ApiBody } from '@nestjs/swagger';
|
||||||
ApiOperation,
|
|
||||||
ApiResponse,
|
|
||||||
ApiTags,
|
|
||||||
ApiBody,
|
|
||||||
} from '@nestjs/swagger';
|
|
||||||
import { RegistrarMiembroDto } from './dto/registrarMiembro.dto';
|
import { RegistrarMiembroDto } from './dto/registrarMiembro.dto';
|
||||||
|
|
||||||
export function ApiPostRegistro() {
|
export function ApiPostRegistro() {
|
||||||
@@ -20,7 +15,8 @@ export function ApiPostRegistro() {
|
|||||||
examples: {
|
examples: {
|
||||||
requeridos: {
|
requeridos: {
|
||||||
summary: 'Solo datos obligatorios',
|
summary: 'Solo datos obligatorios',
|
||||||
description: 'Ejemplo básico con los campos mínimos requeridos para registrar un usuario.',
|
description:
|
||||||
|
'Ejemplo básico con los campos mínimos requeridos para registrar un usuario.',
|
||||||
value: {
|
value: {
|
||||||
nombre: 'Luis',
|
nombre: 'Luis',
|
||||||
apellido_paterno: 'Martínez',
|
apellido_paterno: 'Martínez',
|
||||||
@@ -33,7 +29,8 @@ export function ApiPostRegistro() {
|
|||||||
},
|
},
|
||||||
completo: {
|
completo: {
|
||||||
summary: 'Todos los campos llenos',
|
summary: 'Todos los campos llenos',
|
||||||
description: 'Ejemplo de un usuario con carrera, semestre y descripción.',
|
description:
|
||||||
|
'Ejemplo de un usuario con carrera, semestre y descripción.',
|
||||||
value: {
|
value: {
|
||||||
nombre: 'Ana',
|
nombre: 'Ana',
|
||||||
apellido_paterno: 'Torres',
|
apellido_paterno: 'Torres',
|
||||||
@@ -49,7 +46,8 @@ export function ApiPostRegistro() {
|
|||||||
},
|
},
|
||||||
invalido: {
|
invalido: {
|
||||||
summary: 'Ejemplo con datos inválidos',
|
summary: 'Ejemplo con datos inválidos',
|
||||||
description: 'Muestra un correo mal formado y una contraseña demasiado corta.',
|
description:
|
||||||
|
'Muestra un correo mal formado y una contraseña demasiado corta.',
|
||||||
value: {
|
value: {
|
||||||
nombre: 'Mario',
|
nombre: 'Mario',
|
||||||
apellido_paterno: 'Gómez',
|
apellido_paterno: 'Gómez',
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import { AuthController } from './auth.controller';
|
|||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
import { JwtModule } from '@nestjs/jwt';
|
import { JwtModule } from '@nestjs/jwt';
|
||||||
import { jwtConstants } from './jwt.constants';
|
import { jwtConstants } from './jwt.constants';
|
||||||
import { MiembroModule } from 'src/miembro/miembro.module';
|
import { MiembroModule } from '../miembro/miembro.module';
|
||||||
import { MiembroService } from 'src/miembro/miembro.service';
|
import { MiembroService } from '../miembro/miembro.service';
|
||||||
import { Miembro } from 'src/miembro/entity/miembro.entity';
|
import { Miembro } from '../miembro/entity/miembro.entity';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { Repository } from 'typeorm';
|
|||||||
import { compare } from 'bcrypt';
|
import { compare } from 'bcrypt';
|
||||||
import { jwtConstants } from './jwt.constants';
|
import { jwtConstants } from './jwt.constants';
|
||||||
import { LoginMiembroDto } from './dto/loginMiembro.dto';
|
import { LoginMiembroDto } from './dto/loginMiembro.dto';
|
||||||
import { Miembro } from 'src/miembro/entity/miembro.entity';
|
import { Miembro } from '../miembro/entity/miembro.entity';
|
||||||
import { RegistrarMiembroDto } from './dto/registrarMiembro.dto';
|
import { RegistrarMiembroDto } from './dto/registrarMiembro.dto';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import { IsEmail, MaxLength, MinLength } from "class-validator"
|
import { IsEmail, MaxLength, MinLength } from 'class-validator';
|
||||||
|
|
||||||
|
|
||||||
export class LoginMiembroDto {
|
export class LoginMiembroDto {
|
||||||
@IsEmail()
|
@IsEmail()
|
||||||
email: string
|
email: string;
|
||||||
|
|
||||||
@MinLength(5)
|
@MinLength(5)
|
||||||
@MaxLength(15)
|
@MaxLength(15)
|
||||||
password: string
|
password: string;
|
||||||
}
|
}
|
||||||
@@ -19,14 +19,14 @@ export class RegistrarMiembroDto extends PartialType(LoginMiembroDto) {
|
|||||||
@MaxLength(15)
|
@MaxLength(15)
|
||||||
password: string;
|
password: string;
|
||||||
|
|
||||||
descripcion: string
|
descripcion: string;
|
||||||
|
|
||||||
id_carrera: number
|
id_carrera: number;
|
||||||
|
|
||||||
semestre: string
|
semestre: string;
|
||||||
|
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
cuenta: number
|
cuenta: number;
|
||||||
|
|
||||||
@IsEmail()
|
@IsEmail()
|
||||||
email: string;
|
email: string;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { AuthGuard } from '@nestjs/passport';
|
import { AuthGuard } from '@nestjs/passport';
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
export const jwtConstants = {
|
export const jwtConstants = {
|
||||||
secret: "SemillaSecreta"
|
secret: 'SemillaSecreta',
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Module } from '@nestjs/common';
|
|||||||
import { CarruselController } from './carrusel.controller';
|
import { CarruselController } from './carrusel.controller';
|
||||||
import { CarruselService } from './carrusel.service';
|
import { CarruselService } from './carrusel.service';
|
||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
import { Carrusel } from 'src/carrusel/entity/carrusel.entity';
|
import { Carrusel } from '../carrusel/entity/carrusel.entity';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [TypeOrmModule.forFeature([Carrusel])],
|
imports: [TypeOrmModule.forFeature([Carrusel])],
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
InternalServerErrorException,
|
InternalServerErrorException,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { InjectRepository } from '@nestjs/typeorm';
|
import { InjectRepository } from '@nestjs/typeorm';
|
||||||
import { Carrusel } from 'src/carrusel/entity/carrusel.entity';
|
import { Carrusel } from '../carrusel/entity/carrusel.entity';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
import { carruselDto } from './dto/carruselDto.dto';
|
import { carruselDto } from './dto/carruselDto.dto';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
@@ -45,7 +45,7 @@ export class CarruselService {
|
|||||||
order: {
|
order: {
|
||||||
orden: 'DESC',
|
orden: 'DESC',
|
||||||
},
|
},
|
||||||
take: 1
|
take: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
const ultimoOrden = ultimoCarrusel.length > 0 ? ultimoCarrusel[0].orden : 0;
|
const ultimoOrden = ultimoCarrusel.length > 0 ? ultimoCarrusel[0].orden : 0;
|
||||||
@@ -79,7 +79,6 @@ export class CarruselService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async updateImagenCarrusel(
|
async updateImagenCarrusel(
|
||||||
id: number,
|
id: number,
|
||||||
carruselDto: carruselDto,
|
carruselDto: carruselDto,
|
||||||
@@ -131,12 +130,12 @@ export class CarruselService {
|
|||||||
await this.carruselRepository.update(
|
await this.carruselRepository.update(
|
||||||
{ id_imagen_carrusel: banner.id },
|
{ id_imagen_carrusel: banner.id },
|
||||||
{ orden: banner.orden },
|
{ orden: banner.orden },
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
message: 'Orden actualizado correctamente',
|
message: 'Orden actualizado correctamente',
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteImagenByRuta(id: number) {
|
async deleteImagenByRuta(id: number) {
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { IsNotEmpty, IsOptional, IsNumber } from "class-validator";
|
import { IsNotEmpty, IsOptional, IsNumber } from 'class-validator';
|
||||||
|
|
||||||
export class carruselDto {
|
export class carruselDto {
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
ruta: string
|
ruta: string;
|
||||||
|
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
link: string
|
link: string;
|
||||||
|
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
orden?: number
|
orden?: number;
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
|
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class Carrusel {
|
export class Carrusel {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn()
|
||||||
id_imagen_carrusel: number
|
id_imagen_carrusel: number;
|
||||||
|
|
||||||
@Column({ length: 40 })
|
@Column({ length: 40 })
|
||||||
ruta: string
|
ruta: string;
|
||||||
/* "/public/carrusel/carrusel1.jpg" */
|
/* "/public/carrusel/carrusel1.jpg" */
|
||||||
|
|
||||||
@Column({ length: 150 })
|
@Column({ length: 150 })
|
||||||
link: string
|
link: string;
|
||||||
/* "https://www.acatlan.unam.mx/" */
|
/* "https://www.acatlan.unam.mx/" */
|
||||||
|
|
||||||
@Column({ type: 'int', unique: true })
|
@Column({ type: 'int', unique: true })
|
||||||
orden: number
|
orden: number;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
export let contador = 0
|
export let contador = 0;
|
||||||
|
|
||||||
export const actualizarContador = () => {
|
export const actualizarContador = () => {
|
||||||
contador++
|
contador++;
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -1,17 +1,20 @@
|
|||||||
import { InscripcionArea } from "src/inscripcion-area/entity/inscripcion_area.entity";
|
import { InscripcionArea } from '../inscripcion-area/entity/inscripcion_area.entity';
|
||||||
import { Column, Entity, OneToMany, PrimaryColumn, PrimaryGeneratedColumn } from "typeorm";
|
import {
|
||||||
|
Column,
|
||||||
|
Entity,
|
||||||
|
OneToMany,
|
||||||
|
PrimaryColumn,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class Area {
|
export class Area {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn()
|
||||||
id_area: number
|
id_area: number;
|
||||||
|
|
||||||
@Column({ length: 20, nullable: false })
|
@Column({ length: 20, nullable: false })
|
||||||
area: string
|
area: string;
|
||||||
|
|
||||||
@OneToMany(
|
|
||||||
() => InscripcionArea, (inscripcionArea) => inscripcionArea.area
|
|
||||||
)
|
|
||||||
inscripcionArea: InscripcionArea[]
|
|
||||||
|
|
||||||
|
@OneToMany(() => InscripcionArea, (inscripcionArea) => inscripcionArea.area)
|
||||||
|
inscripcionArea: InscripcionArea[];
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,14 @@
|
|||||||
import { Miembro } from "src/miembro/entity/miembro.entity";
|
import { Miembro } from '../miembro/entity/miembro.entity';
|
||||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class Carrera {
|
export class Carrera {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn()
|
||||||
id_carrera: number
|
id_carrera: number;
|
||||||
|
|
||||||
@Column({ length: 40, nullable: false })
|
@Column({ length: 40, nullable: false })
|
||||||
carrera: string
|
carrera: string;
|
||||||
|
|
||||||
@OneToMany(
|
@OneToMany(() => Miembro, (miembro) => miembro.carrera)
|
||||||
() => Miembro, (miembro) => miembro.carrera
|
miembro: Miembro;
|
||||||
)
|
|
||||||
miembro: Miembro
|
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,14 @@
|
|||||||
import { Miembro } from "src/miembro/entity/miembro.entity";
|
import { Miembro } from '../miembro/entity/miembro.entity';
|
||||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class TipoMiembro {
|
export class TipoMiembro {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn()
|
||||||
id_tipo_miembro: number
|
id_tipo_miembro: number;
|
||||||
|
|
||||||
@Column({ length: 15, nullable: false })
|
@Column({ length: 15, nullable: false })
|
||||||
tipo_miembro: string
|
tipo_miembro: string;
|
||||||
|
|
||||||
@OneToMany(
|
@OneToMany(() => Miembro, (miembro) => miembro.tipoMiembro)
|
||||||
() => Miembro, (miembro) => miembro.tipoMiembro
|
miembro: Miembro[];
|
||||||
)
|
|
||||||
miembro: Miembro[]
|
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,12 @@ import {
|
|||||||
@Query('from') from?: string,
|
@Query('from') from?: string,
|
||||||
@Query('to') to?: string,
|
@Query('to') to?: string,
|
||||||
) {
|
) {
|
||||||
return this.comentariosService.getComentariosByDate(before, after, from, to);
|
return this.comentariosService.getComentariosByDate(
|
||||||
|
before,
|
||||||
|
after,
|
||||||
|
from,
|
||||||
|
to,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
@@ -40,4 +45,3 @@ import {
|
|||||||
return this.comentariosService.deleteComentario(id);
|
return this.comentariosService.deleteComentario(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ export class ComentariosService {
|
|||||||
throw new BadRequestException('Mensaje no autorizado');
|
throw new BadRequestException('Mensaje no autorizado');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const nuevoComentario = this.comentariosRepository.create(comentario);
|
const nuevoComentario = this.comentariosRepository.create(comentario);
|
||||||
return this.comentariosRepository.save(nuevoComentario);
|
return this.comentariosRepository.save(nuevoComentario);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn } from 'typeorm';
|
import {
|
||||||
|
Entity,
|
||||||
|
Column,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
CreateDateColumn,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class Comentarios {
|
export class Comentarios {
|
||||||
|
|||||||
@@ -1,27 +1,33 @@
|
|||||||
import { MiembroContacto } from "src/miembro-contacto/entity/miembro_contacto.entity";
|
import { MiembroContacto } from '../../miembro-contacto/entity/miembro_contacto.entity';
|
||||||
import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
|
import {
|
||||||
|
Column,
|
||||||
|
Entity,
|
||||||
|
JoinColumn,
|
||||||
|
ManyToOne,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class Contacto {
|
export class Contacto {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn()
|
||||||
id_contacto: number
|
id_contacto: number;
|
||||||
|
|
||||||
@Column({ nullable: false })
|
@Column({ nullable: false })
|
||||||
email: string
|
email: string;
|
||||||
|
|
||||||
@Column({ length: 40 })
|
@Column({ length: 40 })
|
||||||
horario: string
|
horario: string;
|
||||||
|
|
||||||
@Column({ length: 75, nullable: true })
|
@Column({ length: 75, nullable: true })
|
||||||
facebook: string
|
facebook: string;
|
||||||
|
|
||||||
@Column({ length: 60, nullable: true })
|
@Column({ length: 60, nullable: true })
|
||||||
linkedin: string
|
linkedin: string;
|
||||||
|
|
||||||
@ManyToOne(
|
@ManyToOne(
|
||||||
() => MiembroContacto, (miembroContacto) => miembroContacto.contacto
|
() => MiembroContacto,
|
||||||
|
(miembroContacto) => miembroContacto.contacto,
|
||||||
)
|
)
|
||||||
@JoinColumn({name: "id_contacto"})
|
@JoinColumn({ name: 'id_contacto' })
|
||||||
miembroContacto: MiembroContacto
|
miembroContacto: MiembroContacto;
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
import { IsEmail } from "class-validator"
|
import { IsEmail } from 'class-validator';
|
||||||
|
|
||||||
export class EmailDto {
|
export class EmailDto {
|
||||||
|
subject: string;
|
||||||
|
|
||||||
subject:string
|
text: string;
|
||||||
|
|
||||||
text:string
|
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
interface Row {
|
interface Row {
|
||||||
Asistencia: number
|
Asistencia: number;
|
||||||
Nombre: string
|
Nombre: string;
|
||||||
'Apellido Paterno': string
|
'Apellido Paterno': string;
|
||||||
'Apellido Materno': string
|
'Apellido Materno': string;
|
||||||
Carrera: string
|
Carrera: string;
|
||||||
'Institución Procedencia': string
|
'Institución Procedencia': string;
|
||||||
Email: string
|
Email: string;
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,25 @@
|
|||||||
import { Test, TestingModule } from '@nestjs/testing';
|
import { Test, TestingModule } from '@nestjs/testing';
|
||||||
import { EmailController } from './email.controller';
|
import { EmailController } from './email.controller';
|
||||||
|
import { EmailService } from './email.service';
|
||||||
|
|
||||||
describe('EmailController', () => {
|
describe('EmailController', () => {
|
||||||
let controller: EmailController;
|
let controller: EmailController;
|
||||||
|
|
||||||
|
const mockEmailService = {
|
||||||
|
sendEmail: jest.fn(),
|
||||||
|
sendConstancias: jest.fn(),
|
||||||
|
getParticipantesExcel: jest.fn(),
|
||||||
|
};
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const module: TestingModule = await Test.createTestingModule({
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
controllers: [EmailController],
|
controllers: [EmailController],
|
||||||
|
providers: [
|
||||||
|
{
|
||||||
|
provide: EmailService,
|
||||||
|
useValue: mockEmailService,
|
||||||
|
},
|
||||||
|
],
|
||||||
}).compile();
|
}).compile();
|
||||||
|
|
||||||
controller = module.get<EmailController>(EmailController);
|
controller = module.get<EmailController>(EmailController);
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import { FileInterceptor } from '@nestjs/platform-express';
|
|||||||
import { EmailDto } from './dto/emailDto.dto';
|
import { EmailDto } from './dto/emailDto.dto';
|
||||||
import { EmailService } from './email.service';
|
import { EmailService } from './email.service';
|
||||||
import { Response } from 'express';
|
import { Response } from 'express';
|
||||||
import * as xlsx from 'xlsx';
|
|
||||||
import { AuthGuard } from '@nestjs/passport';
|
import { AuthGuard } from '@nestjs/passport';
|
||||||
|
|
||||||
@Controller('email')
|
@Controller('email')
|
||||||
@@ -52,14 +51,8 @@ export class EmailController {
|
|||||||
|
|
||||||
//@UseGuards(AuthGuard('jwt'))
|
//@UseGuards(AuthGuard('jwt'))
|
||||||
@Get(':id/participantes/xlsx')
|
@Get(':id/participantes/xlsx')
|
||||||
async descargarExcel(
|
async descargarExcel(@Param('id') idEvento: number, @Res() res: Response) {
|
||||||
@Param('id') idEvento: number,
|
console.log('entro en el controller');
|
||||||
@Res() res: Response,
|
|
||||||
) {
|
|
||||||
console.log('entro en el controller')
|
|
||||||
return this.emailService.getParticipantesExcel(idEvento, res);
|
return this.emailService.getParticipantesExcel(idEvento, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
import { EventosModule } from 'src/eventos/eventos.module';
|
import { EventosModule } from '../eventos/eventos.module';
|
||||||
import { Participante } from 'src/participante/participante.entity';
|
import { Participante } from '../participante/participante.entity';
|
||||||
import { EmailController } from './email.controller';
|
import { EmailController } from './email.controller';
|
||||||
import { EmailService } from './email.service';
|
import { EmailService } from './email.service';
|
||||||
import { EventosService } from 'src/eventos/eventos.service';
|
import { EventosService } from '../eventos/eventos.service';
|
||||||
import { EventoParticipante } from 'src/evento-participante/evento-participante/eventoParticipante.entity';
|
import { EventoParticipante } from '../evento-participante/evento-participante/eventoParticipante.entity';
|
||||||
import { Evento } from 'src/eventos/evento.entity';
|
import { Evento } from '../eventos/evento.entity';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports:[TypeOrmModule.forFeature([Participante, EventoParticipante, Evento])],
|
imports: [
|
||||||
|
TypeOrmModule.forFeature([Participante, EventoParticipante, Evento]),
|
||||||
|
],
|
||||||
controllers: [EmailController],
|
controllers: [EmailController],
|
||||||
providers:[EmailService, EventosService]
|
providers: [EmailService, EventosService],
|
||||||
})
|
})
|
||||||
export class EmailModule {}
|
export class EmailModule {}
|
||||||
|
|||||||
+29
-13
@@ -9,11 +9,10 @@ import {
|
|||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
import { InjectRepository } from '@nestjs/typeorm';
|
import { InjectRepository } from '@nestjs/typeorm';
|
||||||
import * as nodemailer from 'nodemailer';
|
import * as nodemailer from 'nodemailer';
|
||||||
import { EventosService } from 'src/eventos/eventos.service';
|
import { EventosService } from '../eventos/eventos.service';
|
||||||
import { Participante } from 'src/participante/participante.entity';
|
import { Participante } from '../participante/participante.entity';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
import { EmailDto } from './dto/emailDto.dto';
|
import { EmailDto } from './dto/emailDto.dto';
|
||||||
import * as xlsx from 'xlsx';
|
|
||||||
import * as pdfMake from 'pdfmake/build/pdfmake';
|
import * as pdfMake from 'pdfmake/build/pdfmake';
|
||||||
import * as pdfFonts from 'pdfmake/build/vfs_fonts';
|
import * as pdfFonts from 'pdfmake/build/vfs_fonts';
|
||||||
/* import * as PDFDocument from 'pdfkit'; */
|
/* import * as PDFDocument from 'pdfkit'; */
|
||||||
@@ -69,7 +68,7 @@ export class EmailService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getParticipantesExcel(idEvento: number, res: Response) {
|
async getParticipantesExcel(idEvento: number, res: Response) {
|
||||||
console.log('entro a la funcion')
|
console.log('entro a la funcion');
|
||||||
const participantes = await this.participanteRepository
|
const participantes = await this.participanteRepository
|
||||||
.createQueryBuilder('participante')
|
.createQueryBuilder('participante')
|
||||||
.innerJoin('participante.eventosParticipante', 'eventoParticipante')
|
.innerJoin('participante.eventosParticipante', 'eventoParticipante')
|
||||||
@@ -106,7 +105,6 @@ export class EmailService {
|
|||||||
institucion_procedencia: p.institucion_procedencia,
|
institucion_procedencia: p.institucion_procedencia,
|
||||||
correo: p.email,
|
correo: p.email,
|
||||||
telefono: p.telefono,
|
telefono: p.telefono,
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -120,28 +118,47 @@ export class EmailService {
|
|||||||
'attachment; filename=participantes.xlsx',
|
'attachment; filename=participantes.xlsx',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
await workbook.xlsx.write(res);
|
await workbook.xlsx.write(res);
|
||||||
res.end();
|
res.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async sendConstancias(file, id_evento, res: Response) {
|
async sendConstancias(file, id_evento, res: Response) {
|
||||||
//traemos la info del evento
|
//traemos la info del evento
|
||||||
const evento = await this.eventoService.getEventosPorId(id_evento);
|
const evento = await this.eventoService.getEventosPorId(id_evento);
|
||||||
|
|
||||||
const workbook = xlsx.read(file.buffer);
|
const workbook = new ExcelJS.Workbook();
|
||||||
const worksheet = workbook.Sheets[workbook.SheetNames[0]];
|
await workbook.xlsx.load(file.buffer);
|
||||||
const data = xlsx.utils.sheet_to_json(worksheet);
|
const worksheet = workbook.worksheets[0];
|
||||||
|
|
||||||
|
const data: any[] = [];
|
||||||
|
const headers: string[] = [];
|
||||||
|
worksheet.eachRow((row, rowNumber) => {
|
||||||
|
const rowData: any = {};
|
||||||
|
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
||||||
|
if (rowNumber === 1) {
|
||||||
|
headers[colNumber] = String(cell.value).trim();
|
||||||
|
} else {
|
||||||
|
rowData[headers[colNumber]] = cell.value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (rowNumber > 1) {
|
||||||
|
data.push(rowData);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Carga el PDF pre-diseñado
|
// Carga el PDF pre-diseñado
|
||||||
const existingPdfBytes = fs.readFileSync('src/email/DisenoConstancia.pdf');
|
const existingPdfBytes = fs.readFileSync('../email/DisenoConstancia.pdf');
|
||||||
|
|
||||||
for (let i = 0; i < data.length; i++) {
|
for (let i = 0; i < data.length; i++) {
|
||||||
const row = data[i] as Row;
|
const row = data[i] as Row;
|
||||||
|
|
||||||
if (row.Email == undefined) {
|
if (row.Email == undefined) {
|
||||||
return res.status(400).json({ message: `El correo del renglon ${ i + 2} puede estar vacio o ser undefined`, solucion: `Seleccione el renglon donde ocurre el problema y borre todo lo de este renglon, Aunque parezca que el renglon esta vacio puede que haya un espacio en algun campo y esto genera que el sistema haga la lectura de este renglon`});
|
return res.status(400).json({
|
||||||
|
message: `El correo del renglon ${
|
||||||
|
i + 2
|
||||||
|
} puede estar vacio o ser undefined`,
|
||||||
|
solucion: `Seleccione el renglon donde ocurre el problema y borre todo lo de este renglon, Aunque parezca que el renglon esta vacio puede que haya un espacio en algun campo y esto genera que el sistema haga la lectura de este renglon`,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Carga el PDF pre-diseñado en un documento PDF editable
|
// Carga el PDF pre-diseñado en un documento PDF editable
|
||||||
@@ -231,7 +248,6 @@ export class EmailService {
|
|||||||
return res.status(200).json({ message: 'Constancias enviadas con éxito' });
|
return res.status(200).json({ message: 'Constancias enviadas con éxito' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
formatoFecha(fecha: Date) {
|
formatoFecha(fecha: Date) {
|
||||||
const fechaLimpia = format(fecha, 'dd/MM/yyyy');
|
const fechaLimpia = format(fecha, 'dd/MM/yyyy');
|
||||||
return fechaLimpia;
|
return fechaLimpia;
|
||||||
|
|||||||
@@ -1,27 +1,30 @@
|
|||||||
import { Equipo } from "src/equipo/entity/equipo.entity";
|
import { Equipo } from '../../equipo/entity/equipo.entity';
|
||||||
import { Evento } from "src/eventos/evento.entity";
|
import { Evento } from '../../eventos/evento.entity';
|
||||||
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
import {
|
||||||
|
Column,
|
||||||
|
Entity,
|
||||||
|
JoinColumn,
|
||||||
|
ManyToOne,
|
||||||
|
OneToMany,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class EquipoEvento {
|
export class EquipoEvento {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn()
|
||||||
id_equipo_evento: number
|
id_equipo_evento: number;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
id_equipo: number
|
id_equipo: number;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
id_evento: number
|
id_evento: number;
|
||||||
|
|
||||||
@ManyToOne(
|
@ManyToOne(() => Equipo, (equipo) => equipo.equipoEvento)
|
||||||
() => Equipo, (equipo) => equipo.equipoEvento
|
@JoinColumn({ name: 'id_equipo' })
|
||||||
)
|
equipo: Equipo[];
|
||||||
@JoinColumn({name: "id_equipo"})
|
|
||||||
equipo: Equipo[]
|
|
||||||
|
|
||||||
@ManyToOne(
|
@ManyToOne(() => Evento, (evento) => evento.equipoEvento)
|
||||||
() => Evento, (evento) => evento.equipoEvento
|
@JoinColumn({ name: 'id_evento' })
|
||||||
)
|
evento: Evento;
|
||||||
@JoinColumn({name: "id_evento"})
|
|
||||||
evento: Evento
|
|
||||||
}
|
}
|
||||||
@@ -1,27 +1,30 @@
|
|||||||
import { Equipo } from "src/equipo/entity/equipo.entity";
|
import { Equipo } from '../../equipo/entity/equipo.entity';
|
||||||
import { Miembro } from "src/miembro/entity/miembro.entity";
|
import { Miembro } from '../../miembro/entity/miembro.entity';
|
||||||
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
import {
|
||||||
|
Column,
|
||||||
|
Entity,
|
||||||
|
JoinColumn,
|
||||||
|
ManyToOne,
|
||||||
|
OneToMany,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class EquipoMiembro {
|
export class EquipoMiembro {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn()
|
||||||
id_equipo_miembro:number
|
id_equipo_miembro: number;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
id_equipo:number
|
id_equipo: number;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
id_miembro:number
|
id_miembro: number;
|
||||||
|
|
||||||
@ManyToOne(
|
@ManyToOne(() => Miembro, (miembro) => miembro.equipoMiembro)
|
||||||
() => Miembro, (miembro) => miembro.equipoMiembro
|
@JoinColumn({ name: 'id_miembro' })
|
||||||
)
|
miembro: Miembro[];
|
||||||
@JoinColumn({name:"id_miembro"})
|
|
||||||
miembro: Miembro[]
|
|
||||||
|
|
||||||
@ManyToOne(
|
@ManyToOne(() => Equipo, (equipo) => equipo.equipoMiembro)
|
||||||
() => Equipo,(equipo) => equipo.equipoMiembro
|
@JoinColumn({ name: 'id_equipo' })
|
||||||
)
|
equipo: Equipo[];
|
||||||
@JoinColumn({name: "id_equipo"})
|
|
||||||
equipo: Equipo[]
|
|
||||||
}
|
}
|
||||||
@@ -1,25 +1,28 @@
|
|||||||
import { EquipoEvento } from "src/equipo-evento/entity/equipo_evento.entity";
|
import { EquipoEvento } from '../../equipo-evento/entity/equipo_evento.entity';
|
||||||
import { EquipoMiembro } from "src/equipo-miembro/entity/equipo_miembro.entity";
|
import { EquipoMiembro } from '../../equipo-miembro/entity/equipo_miembro.entity';
|
||||||
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
import {
|
||||||
|
Column,
|
||||||
|
Entity,
|
||||||
|
JoinColumn,
|
||||||
|
ManyToOne,
|
||||||
|
OneToMany,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class Equipo {
|
export class Equipo {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn()
|
||||||
id_equipo: number
|
id_equipo: number;
|
||||||
|
|
||||||
@Column({ length: 50, nullable: true })
|
@Column({ length: 50, nullable: true })
|
||||||
nombre: string
|
nombre: string;
|
||||||
|
|
||||||
@Column({ length: 100 })
|
@Column({ length: 100 })
|
||||||
descripcion:string
|
descripcion: string;
|
||||||
|
|
||||||
@OneToMany(
|
@OneToMany(() => EquipoMiembro, (equipoMiembro) => equipoMiembro.miembro)
|
||||||
() => EquipoMiembro, (equipoMiembro) => equipoMiembro.miembro
|
equipoMiembro: EquipoMiembro;
|
||||||
)
|
|
||||||
equipoMiembro: EquipoMiembro
|
|
||||||
|
|
||||||
@OneToMany(
|
@OneToMany(() => EquipoEvento, (equipoEvento) => equipoEvento.evento)
|
||||||
() => EquipoEvento, (equipoEvento) => equipoEvento.evento
|
equipoEvento: EquipoEvento;
|
||||||
)
|
|
||||||
equipoEvento: EquipoEvento
|
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
import { IsNotEmpty, IsNumber } from "class-validator"
|
import { IsNotEmpty, IsNumber } from 'class-validator';
|
||||||
|
|
||||||
export class registrarEnEvento {
|
export class registrarEnEvento {
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
id_eventoParticipante: number
|
id_eventoParticipante: number;
|
||||||
|
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
id_evento: number
|
id_evento: number;
|
||||||
|
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
id_participante: number
|
id_participante: number;
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,6 @@ export class RegistrarParticipanteDto {
|
|||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
institucion_procedencia: string;
|
institucion_procedencia: string;
|
||||||
|
|
||||||
|
|
||||||
@IsEmail()
|
@IsEmail()
|
||||||
email: string;
|
email: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,27 @@
|
|||||||
import { Body, Controller, Get, Param, ParseIntPipe, Post } from '@nestjs/common';
|
import {
|
||||||
|
Body,
|
||||||
|
Controller,
|
||||||
|
Get,
|
||||||
|
Param,
|
||||||
|
ParseIntPipe,
|
||||||
|
Post,
|
||||||
|
} from '@nestjs/common';
|
||||||
import { RegistrarParticipanteDto } from './dto/registrarParticipanteDto.dto';
|
import { RegistrarParticipanteDto } from './dto/registrarParticipanteDto.dto';
|
||||||
import { EventoParticipanteService } from './evento-participante.service';
|
import { EventoParticipanteService } from './evento-participante.service';
|
||||||
import { EventoParticipante } from './eventoParticipante.entity';
|
import { EventoParticipante } from './eventoParticipante.entity';
|
||||||
|
|
||||||
@Controller('evento-participante')
|
@Controller('evento-participante')
|
||||||
export class EventoParticipanteController {
|
export class EventoParticipanteController {
|
||||||
constructor(private readonly eventoParticipanteService: EventoParticipanteService){}
|
constructor(
|
||||||
|
private readonly eventoParticipanteService: EventoParticipanteService,
|
||||||
|
) {}
|
||||||
|
|
||||||
@Post(':id')
|
@Post(':id')
|
||||||
regitrarParticipante(@Param("id", ParseIntPipe)id: number, @Body() datos: RegistrarParticipanteDto){
|
regitrarParticipante(
|
||||||
return this.eventoParticipanteService.registrarParticipante(id, datos)
|
@Param('id', ParseIntPipe) id: number,
|
||||||
|
@Body() datos: RegistrarParticipanteDto,
|
||||||
|
) {
|
||||||
|
return this.eventoParticipanteService.registrarParticipante(id, datos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
import { Participante } from 'src/participante/participante.entity';
|
import { Participante } from '../../participante/participante.entity';
|
||||||
import { EventoParticipanteController } from './evento-participante.controller';
|
import { EventoParticipanteController } from './evento-participante.controller';
|
||||||
import { EventoParticipanteService } from './evento-participante.service';
|
import { EventoParticipanteService } from './evento-participante.service';
|
||||||
import { EventoParticipante } from './eventoParticipante.entity';
|
import { EventoParticipante } from './eventoParticipante.entity';
|
||||||
@@ -8,6 +8,6 @@ import { EventoParticipante } from './eventoParticipante.entity';
|
|||||||
@Module({
|
@Module({
|
||||||
imports: [TypeOrmModule.forFeature([EventoParticipante, Participante])],
|
imports: [TypeOrmModule.forFeature([EventoParticipante, Participante])],
|
||||||
controllers: [EventoParticipanteController],
|
controllers: [EventoParticipanteController],
|
||||||
providers: [EventoParticipanteService]
|
providers: [EventoParticipanteService],
|
||||||
})
|
})
|
||||||
export class EventoParticipanteModule {}
|
export class EventoParticipanteModule {}
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import { Repository } from 'typeorm';
|
|||||||
|
|
||||||
import { RegistrarParticipanteDto } from './dto/registrarParticipanteDto.dto';
|
import { RegistrarParticipanteDto } from './dto/registrarParticipanteDto.dto';
|
||||||
|
|
||||||
import { Evento } from 'src/eventos/evento.entity';
|
import { Evento } from '../../eventos/evento.entity';
|
||||||
import { EventoParticipante } from './eventoParticipante.entity';
|
import { EventoParticipante } from './eventoParticipante.entity';
|
||||||
import { Participante } from 'src/participante/participante.entity';
|
import { Participante } from '../../participante/participante.entity';
|
||||||
import { info } from 'console';
|
import { info } from 'console';
|
||||||
import { registrarEnEvento } from './dto/registrarEnEvento.dto';
|
import { registrarEnEvento } from './dto/registrarEnEvento.dto';
|
||||||
|
|
||||||
@@ -49,7 +49,6 @@ export class EventoParticipanteService {
|
|||||||
return this.participanteExiste(registrarParticipanteDto.email).then(
|
return this.participanteExiste(registrarParticipanteDto.email).then(
|
||||||
(res) => {
|
(res) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
|
|
||||||
res.nombre = registrarParticipanteDto.nombre;
|
res.nombre = registrarParticipanteDto.nombre;
|
||||||
res.apellido_paterno = registrarParticipanteDto.apellido_paterno;
|
res.apellido_paterno = registrarParticipanteDto.apellido_paterno;
|
||||||
res.apellido_materno = registrarParticipanteDto.apellido_materno;
|
res.apellido_materno = registrarParticipanteDto.apellido_materno;
|
||||||
@@ -77,6 +76,6 @@ export class EventoParticipanteService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getEventoParticipantes() {
|
getEventoParticipantes() {
|
||||||
return this.eventoParticipanteRepository.find()
|
return this.eventoParticipanteRepository.find();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,24 @@
|
|||||||
import { Evento } from 'src/eventos/evento.entity';
|
import { Evento } from '../../eventos/evento.entity';
|
||||||
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn, PrimaryGeneratedColumn } from 'typeorm';
|
import {
|
||||||
|
Column,
|
||||||
|
Entity,
|
||||||
|
JoinColumn,
|
||||||
|
ManyToOne,
|
||||||
|
PrimaryColumn,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
} from 'typeorm';
|
||||||
import { Participante } from '../../participante/participante.entity';
|
import { Participante } from '../../participante/participante.entity';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class EventoParticipante {
|
export class EventoParticipante {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn()
|
||||||
id_eventoParticipante: number
|
id_eventoParticipante: number;
|
||||||
|
|
||||||
@Column({ type: Number, nullable: false })
|
@Column({ type: Number, nullable: false })
|
||||||
id_evento: number
|
id_evento: number;
|
||||||
|
|
||||||
@Column({ type: Number, nullable: false })
|
@Column({ type: Number, nullable: false })
|
||||||
id_participante: number
|
id_participante: number;
|
||||||
|
|
||||||
@ManyToOne(() => Evento, (evento) => evento.eventoParticipantes)
|
@ManyToOne(() => Evento, (evento) => evento.eventoParticipantes)
|
||||||
@JoinColumn({ name: 'id_evento' })
|
@JoinColumn({ name: 'id_evento' })
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { EquipoEvento } from 'src/equipo-evento/entity/equipo_evento.entity';
|
import { EquipoEvento } from '../equipo-evento/entity/equipo_evento.entity';
|
||||||
import { EventoParticipante } from 'src/evento-participante/evento-participante/eventoParticipante.entity';
|
import { EventoParticipante } from '../evento-participante/evento-participante/eventoParticipante.entity';
|
||||||
import {
|
import {
|
||||||
Column,
|
Column,
|
||||||
Entity,
|
Entity,
|
||||||
|
|||||||
@@ -1,7 +1,18 @@
|
|||||||
import { Body, Controller, Delete, Get, Param, ParseIntPipe, Patch, Post, Res, UseGuards } from '@nestjs/common';
|
import {
|
||||||
|
Body,
|
||||||
|
Controller,
|
||||||
|
Delete,
|
||||||
|
Get,
|
||||||
|
Param,
|
||||||
|
ParseIntPipe,
|
||||||
|
Patch,
|
||||||
|
Post,
|
||||||
|
Res,
|
||||||
|
UseGuards,
|
||||||
|
} from '@nestjs/common';
|
||||||
import { Response } from 'express';
|
import { Response } from 'express';
|
||||||
import { InjectRepository } from '@nestjs/typeorm';
|
import { InjectRepository } from '@nestjs/typeorm';
|
||||||
import { EventoParticipante } from 'src/evento-participante/evento-participante/eventoParticipante.entity';
|
import { EventoParticipante } from '../evento-participante/evento-participante/eventoParticipante.entity';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
import { actualizarEventoDto } from './dto/actualizarEvento.dto';
|
import { actualizarEventoDto } from './dto/actualizarEvento.dto';
|
||||||
import { crearEventoDto } from './dto/crearEvento.dto';
|
import { crearEventoDto } from './dto/crearEvento.dto';
|
||||||
@@ -11,62 +22,66 @@ import { AuthGuard } from '@nestjs/passport';
|
|||||||
|
|
||||||
@Controller('eventos')
|
@Controller('eventos')
|
||||||
export class EventosController {
|
export class EventosController {
|
||||||
|
|
||||||
constructor(private readonly eventoService: EventosService) {}
|
constructor(private readonly eventoService: EventosService) {}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
getEventos(): Promise<Evento[]> {
|
getEventos(): Promise<Evento[]> {
|
||||||
return this.eventoService.getEventos()
|
return this.eventoService.getEventos();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('disponibles')
|
@Get('disponibles')
|
||||||
getEventosDisponibles() {
|
getEventosDisponibles() {
|
||||||
return this.eventoService.getEventosDisponibles()
|
return this.eventoService.getEventosDisponibles();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
getEventosPorId(@Param('id', ParseIntPipe) id: number): Promise<Evento> {
|
getEventosPorId(@Param('id', ParseIntPipe) id: number): Promise<Evento> {
|
||||||
return this.eventoService.getEventosPorId(id)
|
return this.eventoService.getEventosPorId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(AuthGuard('jwt'))
|
@UseGuards(AuthGuard('jwt'))
|
||||||
@Post()
|
@Post()
|
||||||
postEvento(@Body() nuevoEvento: crearEventoDto) {
|
postEvento(@Body() nuevoEvento: crearEventoDto) {
|
||||||
return this.eventoService.postEvento(nuevoEvento)
|
return this.eventoService.postEvento(nuevoEvento);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(AuthGuard('jwt'))
|
@UseGuards(AuthGuard('jwt'))
|
||||||
@Patch(':id')
|
@Patch(':id')
|
||||||
patchEvento(@Param('id', ParseIntPipe)id:number, @Body() actualizacion: actualizarEventoDto){
|
patchEvento(
|
||||||
return this.eventoService.updateEvento(id,actualizacion)
|
@Param('id', ParseIntPipe) id: number,
|
||||||
|
@Body() actualizacion: actualizarEventoDto,
|
||||||
|
) {
|
||||||
|
return this.eventoService.updateEvento(id, actualizacion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(AuthGuard('jwt'))
|
@UseGuards(AuthGuard('jwt'))
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
deleteEvento(@Param('id', ParseIntPipe) id: number) {
|
deleteEvento(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.eventoService.deleteEventoParticipante(id)
|
return this.eventoService.deleteEventoParticipante(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id/cupos')
|
@Get(':id/cupos')
|
||||||
async getCupos(@Param('id', ParseIntPipe) id: number) {
|
async getCupos(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.eventoService.getCupos(id)
|
return this.eventoService.getCupos(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(AuthGuard('jwt'))
|
@UseGuards(AuthGuard('jwt'))
|
||||||
@Get(':id/participante')
|
@Get(':id/participante')
|
||||||
async getParticipnates(@Param('id', ParseIntPipe) id: number) {
|
async getParticipnates(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.eventoService.getParticipantes(id)
|
return this.eventoService.getParticipantes(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(AuthGuard('jwt'))
|
@UseGuards(AuthGuard('jwt'))
|
||||||
@Get(':id/exportExcel')
|
@Get(':id/exportExcel')
|
||||||
async exportarExcel (@Param('id', ParseIntPipe)id:number ,@Res() res: Response){
|
async exportarExcel(
|
||||||
this.eventoService.exportarParticipantes(id, res)
|
@Param('id', ParseIntPipe) id: number,
|
||||||
|
@Res() res: Response,
|
||||||
|
) {
|
||||||
|
this.eventoService.exportarParticipantes(id, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post('disponibles/pendientesDconstancia')
|
@Post('disponibles/pendientesDconstancia')
|
||||||
getEventosDisponiblesPendientes() {
|
getEventosDisponiblesPendientes() {
|
||||||
return this.eventoService.geteventosDisponiblesMasDosDias()
|
return this.eventoService.geteventosDisponiblesMasDosDias();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ import { EventosController } from './eventos.controller';
|
|||||||
import { EventosService } from './eventos.service';
|
import { EventosService } from './eventos.service';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports:[TypeOrmModule.forFeature([Evento, EventoParticipante, Participante])],
|
imports: [
|
||||||
|
TypeOrmModule.forFeature([Evento, EventoParticipante, Participante]),
|
||||||
|
],
|
||||||
controllers: [EventosController],
|
controllers: [EventosController],
|
||||||
providers:[EventosService]
|
providers: [EventosService],
|
||||||
})
|
})
|
||||||
export class EventosModule {}
|
export class EventosModule {}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { InjectRepository } from '@nestjs/typeorm';
|
import { InjectRepository } from '@nestjs/typeorm';
|
||||||
import { EventoParticipante } from 'src/evento-participante/evento-participante/eventoParticipante.entity';
|
import { EventoParticipante } from '../evento-participante/evento-participante/eventoParticipante.entity';
|
||||||
import { Participante } from 'src/participante/participante.entity';
|
import { Participante } from '../participante/participante.entity';
|
||||||
import { Between, MoreThanOrEqual, Repository } from 'typeorm';
|
import { Between, MoreThanOrEqual, Repository } from 'typeorm';
|
||||||
import { actualizarEventoDto } from './dto/actualizarEvento.dto';
|
import { actualizarEventoDto } from './dto/actualizarEvento.dto';
|
||||||
import { crearEventoDto } from './dto/crearEvento.dto';
|
import { crearEventoDto } from './dto/crearEvento.dto';
|
||||||
@@ -193,7 +193,8 @@ export class EventosService {
|
|||||||
|
|
||||||
geteventosDisponiblesMasDosDias() {
|
geteventosDisponiblesMasDosDias() {
|
||||||
const hoy = new Date();
|
const hoy = new Date();
|
||||||
return this.eventoRepository.createQueryBuilder("evento")
|
return this.eventoRepository
|
||||||
|
.createQueryBuilder('evento')
|
||||||
.where(`DATE_ADD(evento.fecha_fin, INTERVAL 3 DAY) >= :hoy`, { hoy })
|
.where(`DATE_ADD(evento.fecha_fin, INTERVAL 3 DAY) >= :hoy`, { hoy })
|
||||||
.andWhere('fecha_fin <= :hoy', { hoy })
|
.andWhere('fecha_fin <= :hoy', { hoy })
|
||||||
.getMany();
|
.getMany();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Area } from 'src/catalogos/area.entity';
|
import { Area } from '../../catalogos/area.entity';
|
||||||
import { InscripcionDSC } from 'src/inscripcion-dsc/entity/inscripcion_dsc.entity';
|
import { InscripcionDSC } from '../../inscripcion-dsc/entity/inscripcion_dsc.entity';
|
||||||
import {
|
import {
|
||||||
Column,
|
Column,
|
||||||
Entity,
|
Entity,
|
||||||
@@ -24,8 +24,9 @@ export class InscripcionArea {
|
|||||||
area: Area;
|
area: Area;
|
||||||
|
|
||||||
@ManyToOne(
|
@ManyToOne(
|
||||||
() => InscripcionDSC, (inscripcionDsc) => inscripcionDsc.inscripcionArea
|
() => InscripcionDSC,
|
||||||
|
(inscripcionDsc) => inscripcionDsc.inscripcionArea,
|
||||||
)
|
)
|
||||||
@JoinColumn({name:"id_inscripcion"})
|
@JoinColumn({ name: 'id_inscripcion' })
|
||||||
inscripcionDsc: InscripcionDSC
|
inscripcionDsc: InscripcionDSC;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ import { InscripcionAreaService } from './inscripcion-area.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [InscripcionAreaController],
|
controllers: [InscripcionAreaController],
|
||||||
providers: [InscripcionAreaService]
|
providers: [InscripcionAreaService],
|
||||||
})
|
})
|
||||||
export class InscripcionAreaModule {}
|
export class InscripcionAreaModule {}
|
||||||
|
|||||||
@@ -1,8 +1,15 @@
|
|||||||
import { InscripcionArea } from 'src/inscripcion-area/entity/inscripcion_area.entity';
|
import { InscripcionArea } from '../../inscripcion-area/entity/inscripcion_area.entity';
|
||||||
import { InscripcionStatus } from 'src/inscripcion-status/entity/inscripcion_status.entity';
|
import { InscripcionStatus } from '../../inscripcion-status/entity/inscripcion_status.entity';
|
||||||
import { InscripcionUsuario } from 'src/inscripcion-usuario/entity/inscripcion_usuario.entity';
|
import { InscripcionUsuario } from '../../inscripcion-usuario/entity/inscripcion_usuario.entity';
|
||||||
import { Periodo } from 'src/periodo/entity/periodo.entity';
|
import { Periodo } from '../../periodo/entity/periodo.entity';
|
||||||
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
import {
|
||||||
|
Column,
|
||||||
|
Entity,
|
||||||
|
JoinColumn,
|
||||||
|
ManyToOne,
|
||||||
|
OneToMany,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class InscripcionDSC {
|
export class InscripcionDSC {
|
||||||
@@ -49,20 +56,19 @@ export class InscripcionDSC {
|
|||||||
inscripcionArea: InscripcionArea[];
|
inscripcionArea: InscripcionArea[];
|
||||||
|
|
||||||
@ManyToOne(
|
@ManyToOne(
|
||||||
() => InscripcionStatus, (inscripcionStatus) => inscripcionStatus.inscripcionDsc
|
() => InscripcionStatus,
|
||||||
|
(inscripcionStatus) => inscripcionStatus.inscripcionDsc,
|
||||||
)
|
)
|
||||||
@JoinColumn({name: "id_status"})
|
@JoinColumn({ name: 'id_status' })
|
||||||
inscripcionStatus: InscripcionStatus
|
inscripcionStatus: InscripcionStatus;
|
||||||
|
|
||||||
@ManyToOne(
|
@ManyToOne(() => Periodo, (periodo) => periodo.inscripcionDsc)
|
||||||
() => Periodo, (periodo) => periodo.inscripcionDsc
|
@JoinColumn({ name: 'id_periodo' })
|
||||||
)
|
periodo: Periodo;
|
||||||
@JoinColumn({name: "id_periodo"})
|
|
||||||
periodo: Periodo
|
|
||||||
|
|
||||||
@OneToMany(
|
@OneToMany(
|
||||||
() => InscripcionUsuario, (inscripcionUsuario) => inscripcionUsuario.inscripcionDsc
|
() => InscripcionUsuario,
|
||||||
|
(inscripcionUsuario) => inscripcionUsuario.inscripcionDsc,
|
||||||
)
|
)
|
||||||
inscripcionUsuario: InscripcionUsuario[]
|
inscripcionUsuario: InscripcionUsuario[];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
import {
|
import { Body, Controller, NotFoundException, Post } from '@nestjs/common';
|
||||||
Body,
|
|
||||||
Controller,
|
|
||||||
NotFoundException,
|
|
||||||
Post,
|
|
||||||
} from '@nestjs/common';
|
|
||||||
import { InscripcionDscService } from './inscripcion-dsc.service';
|
import { InscripcionDscService } from './inscripcion-dsc.service';
|
||||||
import { And } from 'typeorm';
|
import { And } from 'typeorm';
|
||||||
|
|
||||||
@@ -14,9 +9,11 @@ export class InscripcionDscController {
|
|||||||
@Post('confirmacion')
|
@Post('confirmacion')
|
||||||
async confirmacionDsc(@Body() body: any) {
|
async confirmacionDsc(@Body() body: any) {
|
||||||
const { accountNumber } = body;
|
const { accountNumber } = body;
|
||||||
console.log('Entro a la confirmacion')
|
console.log('Entro a la confirmacion');
|
||||||
|
|
||||||
const userVerification = await this.inscripcionService.userVerification(accountNumber);
|
const userVerification = await this.inscripcionService.userVerification(
|
||||||
|
accountNumber,
|
||||||
|
);
|
||||||
/* console.log(userVerification) */
|
/* console.log(userVerification) */
|
||||||
console.log('Usuario verificacion', userVerification);
|
console.log('Usuario verificacion', userVerification);
|
||||||
if (!userVerification) {
|
if (!userVerification) {
|
||||||
@@ -32,10 +29,12 @@ console.log('Usuario verificacion', userVerification);
|
|||||||
const userInformation = userVerification;
|
const userInformation = userVerification;
|
||||||
/* console.log(userInformation[0].confirmacion) */
|
/* console.log(userInformation[0].confirmacion) */
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
/* console.log("verificando confirmacion:", userInformation);
|
/* console.log("verificando confirmacion:", userInformation);
|
||||||
*/ if (userInformation[0].confirmacion && userInformation[1].confirmacion) {
|
*/ if (
|
||||||
|
userInformation[0].confirmacion &&
|
||||||
|
userInformation[1].confirmacion
|
||||||
|
) {
|
||||||
return {
|
return {
|
||||||
error: true,
|
error: true,
|
||||||
msj: 'El usuario ya hizo la confirmación anteriormente',
|
msj: 'El usuario ya hizo la confirmación anteriormente',
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ import { InscripcionDscService } from './inscripcion-dsc.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [InscripcionDscController],
|
controllers: [InscripcionDscController],
|
||||||
providers: [InscripcionDscService]
|
providers: [InscripcionDscService],
|
||||||
})
|
})
|
||||||
export class InscripcionDscModule {}
|
export class InscripcionDscModule {}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export class InscripcionDscService {
|
|||||||
JOIN periodo P ON (P.id_periodo = AI.id_periodo)
|
JOIN periodo P ON (P.id_periodo = AI.id_periodo)
|
||||||
WHERE A.id_cuenta = "${accountNumber}" and P.activo=true`;
|
WHERE A.id_cuenta = "${accountNumber}" and P.activo=true`;
|
||||||
|
|
||||||
console.log('despues de el select', userInformationQuery)
|
console.log('despues de el select', userInformationQuery);
|
||||||
|
|
||||||
const qryEjemplo = `SELECT * FROM alumno WHERE id_cuenta="${accountNumber}";`;
|
const qryEjemplo = `SELECT * FROM alumno WHERE id_cuenta="${accountNumber}";`;
|
||||||
|
|
||||||
@@ -32,10 +32,10 @@ export class InscripcionDscService {
|
|||||||
/* console.log('The solution is: ', resultsArray); */
|
/* console.log('The solution is: ', resultsArray); */
|
||||||
console.log('The solution is: ', resultsArray);
|
console.log('The solution is: ', resultsArray);
|
||||||
|
|
||||||
console.log('Resultados', results)
|
console.log('Resultados', results);
|
||||||
return results;
|
return results;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('Entro al error', error)
|
console.log('Entro al error', error);
|
||||||
throw error;
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
if (connection) {
|
if (connection) {
|
||||||
@@ -44,7 +44,6 @@ export class InscripcionDscService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async userConfirmation(accountNumber: string): Promise<any> {
|
async userConfirmation(accountNumber: string): Promise<any> {
|
||||||
try {
|
try {
|
||||||
const connection = await createConnection({
|
const connection = await createConnection({
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { InscripcionDSC } from 'src/inscripcion-dsc/entity/inscripcion_dsc.entity';
|
import { InscripcionDSC } from '../../inscripcion-dsc/entity/inscripcion_dsc.entity';
|
||||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
@@ -12,6 +12,9 @@ export class InscripcionStatus {
|
|||||||
@Column({ nullable: false })
|
@Column({ nullable: false })
|
||||||
status: number;
|
status: number;
|
||||||
|
|
||||||
@OneToMany(() => InscripcionDSC, (inscripcionDsc) => inscripcionDsc.inscripcionStatus)
|
@OneToMany(
|
||||||
|
() => InscripcionDSC,
|
||||||
|
(inscripcionDsc) => inscripcionDsc.inscripcionStatus,
|
||||||
|
)
|
||||||
inscripcionDsc: InscripcionDSC[];
|
inscripcionDsc: InscripcionDSC[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +1,32 @@
|
|||||||
import { InscripcionDSC } from "src/inscripcion-dsc/entity/inscripcion_dsc.entity";
|
import { InscripcionDSC } from '../../inscripcion-dsc/entity/inscripcion_dsc.entity';
|
||||||
import { Miembro } from "src/miembro/entity/miembro.entity";
|
import { Miembro } from '../../miembro/entity/miembro.entity';
|
||||||
import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
|
import {
|
||||||
|
Column,
|
||||||
|
Entity,
|
||||||
|
JoinColumn,
|
||||||
|
ManyToOne,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class InscripcionUsuario {
|
export class InscripcionUsuario {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn()
|
||||||
id_inscripcion_usuario: number
|
id_inscripcion_usuario: number;
|
||||||
|
|
||||||
@Column({ nullable: false })
|
@Column({ nullable: false })
|
||||||
id_miembro: number
|
id_miembro: number;
|
||||||
|
|
||||||
@Column({ nullable: false })
|
@Column({ nullable: false })
|
||||||
id_inscripcion: number
|
id_inscripcion: number;
|
||||||
|
|
||||||
@ManyToOne(
|
@ManyToOne(
|
||||||
() => InscripcionDSC, (inscripcionDsc) => inscripcionDsc.inscripcionUsuario
|
() => InscripcionDSC,
|
||||||
|
(inscripcionDsc) => inscripcionDsc.inscripcionUsuario,
|
||||||
)
|
)
|
||||||
@JoinColumn({name: "id_inscripcion"})
|
@JoinColumn({ name: 'id_inscripcion' })
|
||||||
inscripcionDsc: InscripcionDSC
|
inscripcionDsc: InscripcionDSC;
|
||||||
|
|
||||||
@ManyToOne(
|
|
||||||
() => Miembro, (miebro) => miebro.inscripcionUsuario
|
|
||||||
)
|
|
||||||
@JoinColumn({name: "id_miembro"})
|
|
||||||
miembro: Miembro[]
|
|
||||||
|
|
||||||
|
@ManyToOne(() => Miembro, (miebro) => miebro.inscripcionUsuario)
|
||||||
|
@JoinColumn({ name: 'id_miembro' })
|
||||||
|
miembro: Miembro[];
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,6 @@ import { InscripcionUsuarioService } from './inscripcion-usuario.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [InscripcionUsuarioController],
|
controllers: [InscripcionUsuarioController],
|
||||||
providers: [InscripcionUsuarioService]
|
providers: [InscripcionUsuarioService],
|
||||||
})
|
})
|
||||||
export class InscripcionUsuarioModule {}
|
export class InscripcionUsuarioModule {}
|
||||||
|
|||||||
@@ -1,26 +1,30 @@
|
|||||||
import { Contacto } from "src/contacto/entity/contacto.entity";
|
import { Contacto } from '../../contacto/entity/contacto.entity';
|
||||||
import { Miembro } from "src/miembro/entity/miembro.entity";
|
import { Miembro } from '../../miembro/entity/miembro.entity';
|
||||||
import { Column, Entity, JoinColumn, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
import {
|
||||||
|
Column,
|
||||||
|
Entity,
|
||||||
|
JoinColumn,
|
||||||
|
OneToMany,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class MiembroContacto {
|
export class MiembroContacto {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn()
|
||||||
id_miembro_contacto: number
|
id_miembro_contacto: number;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
id_miembro: number
|
id_miembro: number;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
id_contacto: number
|
id_contacto: number;
|
||||||
|
|
||||||
/* @OneToMany(
|
/* @OneToMany(
|
||||||
() => Miembro, (miembro) => miembro.miembroContacto
|
() => Miembro, (miembro) => miembro.miembroContacto
|
||||||
)
|
)
|
||||||
miembro: Miembro[] */
|
miembro: Miembro[] */
|
||||||
|
|
||||||
@OneToMany(
|
@OneToMany(() => Contacto, (contacto) => contacto.miembroContacto)
|
||||||
() => Contacto, (contacto) => contacto.miembroContacto
|
@JoinColumn({ name: 'id_contacto' })
|
||||||
)
|
contacto: Contacto;
|
||||||
@JoinColumn({name: "id_contacto"})
|
|
||||||
contacto: Contacto
|
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,9 @@ describe('MiembroContactoController', () => {
|
|||||||
controllers: [MiembroContactoController],
|
controllers: [MiembroContactoController],
|
||||||
}).compile();
|
}).compile();
|
||||||
|
|
||||||
controller = module.get<MiembroContactoController>(MiembroContactoController);
|
controller = module.get<MiembroContactoController>(
|
||||||
|
MiembroContactoController,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be defined', () => {
|
it('should be defined', () => {
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ import { MiembroContactoService } from './miembro-contacto.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [MiembroContactoController],
|
controllers: [MiembroContactoController],
|
||||||
providers: [MiembroContactoService]
|
providers: [MiembroContactoService],
|
||||||
})
|
})
|
||||||
export class MiembroContactoModule {}
|
export class MiembroContactoModule {}
|
||||||
|
|||||||
@@ -1,26 +1,29 @@
|
|||||||
import { Miembro } from "src/miembro/entity/miembro.entity";
|
import { Miembro } from '../../miembro/entity/miembro.entity';
|
||||||
import { Proyecto } from "src/proyecto/entity/proyecto.entity";
|
import { Proyecto } from '../../proyecto/entity/proyecto.entity';
|
||||||
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
import {
|
||||||
|
Column,
|
||||||
|
Entity,
|
||||||
|
JoinColumn,
|
||||||
|
ManyToOne,
|
||||||
|
OneToMany,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class MiembroProyecto {
|
export class MiembroProyecto {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn()
|
||||||
id_miembro_proyecto: number
|
id_miembro_proyecto: number;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
id_proyecto: number
|
id_proyecto: number;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
id_miembro: number
|
id_miembro: number;
|
||||||
|
|
||||||
@ManyToOne(
|
@ManyToOne(() => Miembro, (miembro) => miembro.miembroProyecto)
|
||||||
() => Miembro, (miembro) => miembro.miembroProyecto
|
@JoinColumn({ name: 'id_miembro' })
|
||||||
)
|
miembro: Miembro[];
|
||||||
@JoinColumn({name: "id_miembro"})
|
|
||||||
miembro: Miembro[]
|
|
||||||
|
|
||||||
@OneToMany(
|
@OneToMany(() => Proyecto, (proyecto) => proyecto.miembroProyecto)
|
||||||
() => Proyecto, (proyecto) => proyecto.miembroProyecto
|
proyecto: Proyecto[];
|
||||||
)
|
|
||||||
proyecto: Proyecto[]
|
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,9 @@ describe('MiembroProyectoController', () => {
|
|||||||
controllers: [MiembroProyectoController],
|
controllers: [MiembroProyectoController],
|
||||||
}).compile();
|
}).compile();
|
||||||
|
|
||||||
controller = module.get<MiembroProyectoController>(MiembroProyectoController);
|
controller = module.get<MiembroProyectoController>(
|
||||||
|
MiembroProyectoController,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be defined', () => {
|
it('should be defined', () => {
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ import { MiembroProyectoService } from './miembro-proyecto.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [MiembroProyectoController],
|
controllers: [MiembroProyectoController],
|
||||||
providers: [MiembroProyectoService]
|
providers: [MiembroProyectoService],
|
||||||
})
|
})
|
||||||
export class MiembroProyectoModule {}
|
export class MiembroProyectoModule {}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { IsEmail } from 'class-validator';
|
import { IsEmail } from 'class-validator';
|
||||||
import { Carrera } from 'src/catalogos/carrera.entity';
|
import { Carrera } from '../../catalogos/carrera.entity';
|
||||||
import { TipoMiembro } from 'src/catalogos/tipo-miembro.entity';
|
import { TipoMiembro } from '../../catalogos/tipo-miembro.entity';
|
||||||
import { EquipoMiembro } from 'src/equipo-miembro/entity/equipo_miembro.entity';
|
import { EquipoMiembro } from '../../equipo-miembro/entity/equipo_miembro.entity';
|
||||||
import { InscripcionUsuario } from 'src/inscripcion-usuario/entity/inscripcion_usuario.entity';
|
import { InscripcionUsuario } from '../../inscripcion-usuario/entity/inscripcion_usuario.entity';
|
||||||
import { MiembroContacto } from 'src/miembro-contacto/entity/miembro_contacto.entity';
|
import { MiembroContacto } from '../../miembro-contacto/entity/miembro_contacto.entity';
|
||||||
import { MiembroProyecto } from 'src/miembro-proyecto/entity/miembro_proyecto.entity';
|
import { MiembroProyecto } from '../../miembro-proyecto/entity/miembro_proyecto.entity';
|
||||||
import {
|
import {
|
||||||
Column,
|
Column,
|
||||||
Entity,
|
Entity,
|
||||||
@@ -71,12 +71,11 @@ export class Miembro {
|
|||||||
miembroContacto: MiembroContacto */
|
miembroContacto: MiembroContacto */
|
||||||
|
|
||||||
@OneToMany(
|
@OneToMany(
|
||||||
() => MiembroProyecto, (miembroProyecto) => miembroProyecto.miembro
|
() => MiembroProyecto,
|
||||||
|
(miembroProyecto) => miembroProyecto.miembro,
|
||||||
)
|
)
|
||||||
miembroProyecto: MiembroProyecto
|
miembroProyecto: MiembroProyecto;
|
||||||
|
|
||||||
@OneToMany(
|
@OneToMany(() => EquipoMiembro, (equipoMiembro) => equipoMiembro.miembro)
|
||||||
() => EquipoMiembro, (equipoMiembro) => equipoMiembro.miembro
|
equipoMiembro: EquipoMiembro;
|
||||||
)
|
|
||||||
equipoMiembro: EquipoMiembro
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,31 @@
|
|||||||
import { Controller, Delete, Get, Param, ParseIntPipe, UseGuards } from '@nestjs/common';
|
import {
|
||||||
|
Controller,
|
||||||
|
Delete,
|
||||||
|
Get,
|
||||||
|
Param,
|
||||||
|
ParseIntPipe,
|
||||||
|
UseGuards,
|
||||||
|
} from '@nestjs/common';
|
||||||
import { JwtAuthGuard } from 'src/auth/jwt-auth.guard';
|
import { JwtAuthGuard } from 'src/auth/jwt-auth.guard';
|
||||||
import { Miembro } from './entity/miembro.entity';
|
import { Miembro } from './entity/miembro.entity';
|
||||||
import { MiembroService } from './miembro.service';
|
import { MiembroService } from './miembro.service';
|
||||||
|
|
||||||
@Controller('miembro')
|
@Controller('miembro')
|
||||||
export class MiembroController {
|
export class MiembroController {
|
||||||
|
|
||||||
constructor(private readonly miembroService: MiembroService) {}
|
constructor(private readonly miembroService: MiembroService) {}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
getUsuarios(): Promise<Miembro[]> {
|
getUsuarios(): Promise<Miembro[]> {
|
||||||
return this.miembroService.getUsuarios()
|
return this.miembroService.getUsuarios();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':tipo')
|
@Get(':tipo')
|
||||||
getMiembros(@Param('tipo', ParseIntPipe) tipo: number): Promise<Miembro[]> {
|
getMiembros(@Param('tipo', ParseIntPipe) tipo: number): Promise<Miembro[]> {
|
||||||
return this.miembroService.getMiembros(tipo)
|
return this.miembroService.getMiembros(tipo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
deleteMiembro(@Param('id', ParseIntPipe) id: number) {
|
deleteMiembro(@Param('id', ParseIntPipe) id: number) {
|
||||||
return this.miembroService.deleteMiembro(id)
|
return this.miembroService.deleteMiembro(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ import { MiembroService } from './miembro.service';
|
|||||||
@Module({
|
@Module({
|
||||||
imports: [TypeOrmModule.forFeature([Miembro])],
|
imports: [TypeOrmModule.forFeature([Miembro])],
|
||||||
controllers: [MiembroController],
|
controllers: [MiembroController],
|
||||||
providers: [MiembroService]
|
providers: [MiembroService],
|
||||||
})
|
})
|
||||||
export class MiembroModule {}
|
export class MiembroModule {}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export class MiembroService {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
getUsuarios() {
|
getUsuarios() {
|
||||||
return this.miembroRepository.find()
|
return this.miembroRepository.find();
|
||||||
}
|
}
|
||||||
|
|
||||||
getUsuario(email: string) {
|
getUsuario(email: string) {
|
||||||
@@ -24,12 +24,12 @@ export class MiembroService {
|
|||||||
getMiembros(tipo: number) {
|
getMiembros(tipo: number) {
|
||||||
return this.miembroRepository.find({
|
return this.miembroRepository.find({
|
||||||
where: {
|
where: {
|
||||||
id_tipo_miembro: tipo
|
id_tipo_miembro: tipo,
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteMiembro(id: number) {
|
deleteMiembro(id: number) {
|
||||||
return this.miembroRepository.delete({id_miembro: id})
|
return this.miembroRepository.delete({ id_miembro: id });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||||
import { EventoParticipante } from 'src/evento-participante/evento-participante/eventoParticipante.entity';
|
import { EventoParticipante } from '../evento-participante/evento-participante/eventoParticipante.entity';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class Participante {
|
export class Participante {
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ import { ParticipanteService } from './participante.service';
|
|||||||
@Module({
|
@Module({
|
||||||
imports: [TypeOrmModule.forFeature([Participante])],
|
imports: [TypeOrmModule.forFeature([Participante])],
|
||||||
controllers: [ParticipanteController],
|
controllers: [ParticipanteController],
|
||||||
providers: [ParticipanteService]
|
providers: [ParticipanteService],
|
||||||
})
|
})
|
||||||
export class ParticipanteModule {}
|
export class ParticipanteModule {}
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ export class ParticipanteService {
|
|||||||
return this.participanteRepository.findOne({ where: { email } });
|
return this.participanteRepository.findOne({ where: { email } });
|
||||||
}
|
}
|
||||||
|
|
||||||
async registrarParticipante(registrarParticipanteDto: RegistrarParticipanteDto) {
|
async registrarParticipante(
|
||||||
|
registrarParticipanteDto: RegistrarParticipanteDto,
|
||||||
|
) {
|
||||||
return this.participanteExiste(registrarParticipanteDto.email).then(
|
return this.participanteExiste(registrarParticipanteDto.email).then(
|
||||||
(participante) => {
|
(participante) => {
|
||||||
if (participante) {
|
if (participante) {
|
||||||
|
|||||||
@@ -1,17 +1,14 @@
|
|||||||
import { InscripcionDSC } from "src/inscripcion-dsc/entity/inscripcion_dsc.entity";
|
import { InscripcionDSC } from '../../inscripcion-dsc/entity/inscripcion_dsc.entity';
|
||||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||||
|
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class Periodo {
|
export class Periodo {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn()
|
||||||
id_periodo: number
|
id_periodo: number;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
activo: number
|
activo: number;
|
||||||
|
|
||||||
@OneToMany(
|
@OneToMany(() => InscripcionDSC, (inscripcionDsc) => inscripcionDsc.periodo)
|
||||||
() => InscripcionDSC, (inscripcionDsc) => inscripcionDsc.periodo
|
inscripcionDsc: InscripcionDSC[];
|
||||||
)
|
|
||||||
inscripcionDsc: InscripcionDSC[]
|
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,6 @@ import { PeriodoService } from './periodo.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [PeriodoController],
|
controllers: [PeriodoController],
|
||||||
providers: [PeriodoService]
|
providers: [PeriodoService],
|
||||||
})
|
})
|
||||||
export class PeriodoModule {}
|
export class PeriodoModule {}
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ describe('ProyectoActividadController', () => {
|
|||||||
controllers: [ProyectoActividadController],
|
controllers: [ProyectoActividadController],
|
||||||
}).compile();
|
}).compile();
|
||||||
|
|
||||||
controller = module.get<ProyectoActividadController>(ProyectoActividadController);
|
controller = module.get<ProyectoActividadController>(
|
||||||
|
ProyectoActividadController,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be defined', () => {
|
it('should be defined', () => {
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ import { ProyectoActividadService } from './proyecto-actividad.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [ProyectoActividadController],
|
controllers: [ProyectoActividadController],
|
||||||
providers: [ProyectoActividadService]
|
providers: [ProyectoActividadService],
|
||||||
})
|
})
|
||||||
export class ProyectoActividadModule {}
|
export class ProyectoActividadModule {}
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
import { MiembroProyecto } from 'src/miembro-proyecto/entity/miembro_proyecto.entity';
|
import { MiembroProyecto } from '../../miembro-proyecto/entity/miembro_proyecto.entity';
|
||||||
import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
import {
|
||||||
|
Column,
|
||||||
|
Entity,
|
||||||
|
JoinColumn,
|
||||||
|
ManyToOne,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
} from 'typeorm';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class Proyecto {
|
export class Proyecto {
|
||||||
@@ -22,8 +28,9 @@ export class Proyecto {
|
|||||||
descripcion: string;
|
descripcion: string;
|
||||||
|
|
||||||
@ManyToOne(
|
@ManyToOne(
|
||||||
() => MiembroProyecto, (miembroProyecto) => miembroProyecto.proyecto
|
() => MiembroProyecto,
|
||||||
|
(miembroProyecto) => miembroProyecto.proyecto,
|
||||||
)
|
)
|
||||||
@JoinColumn({name: "id_proyecto"})
|
@JoinColumn({ name: 'id_proyecto' })
|
||||||
miembroProyecto: MiembroProyecto
|
miembroProyecto: MiembroProyecto;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ import { ProyectoService } from './proyecto.service';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [ProyectoController],
|
controllers: [ProyectoController],
|
||||||
providers: [ProyectoService]
|
providers: [ProyectoService],
|
||||||
})
|
})
|
||||||
export class ProyectoModule {}
|
export class ProyectoModule {}
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { Body, Controller, InternalServerErrorException, Post } from '@nestjs/common';
|
import {
|
||||||
|
Body,
|
||||||
|
Controller,
|
||||||
|
InternalServerErrorException,
|
||||||
|
Post,
|
||||||
|
} from '@nestjs/common';
|
||||||
|
|
||||||
@Controller('tyl')
|
@Controller('tyl')
|
||||||
export class TylController {
|
export class TylController {
|
||||||
@Post('')
|
@Post('')
|
||||||
async enviarTyl(@Body() body: { email: string }) {
|
async enviarTyl(@Body() body: { email: string }) {
|
||||||
try {
|
try {
|
||||||
const user = 'acatlan'
|
const user = 'acatlan';
|
||||||
const api = 'LW2rtatYP8o2PhCkIqeJV94d6a60cSvTmJXPbRpP';
|
const api = 'LW2rtatYP8o2PhCkIqeJV94d6a60cSvTmJXPbRpP';
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
params.append('user_name', user!);
|
params.append('user_name', user!);
|
||||||
@@ -21,20 +26,20 @@ export class TylController {
|
|||||||
// },
|
// },
|
||||||
body: params,
|
body: params,
|
||||||
redirect: 'manual',
|
redirect: 'manual',
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log('respuesta', response);
|
console.log('respuesta', response);
|
||||||
|
|
||||||
const redirectUrl = response.headers.get('location');
|
const redirectUrl = response.headers.get('location');
|
||||||
|
|
||||||
console.log('redirect', redirectUrl)
|
console.log('redirect', redirectUrl);
|
||||||
|
|
||||||
return { redirectUrl };
|
return { redirectUrl };
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new InternalServerErrorException('Error al conectar con API externa');
|
throw new InternalServerErrorException(
|
||||||
|
'Error al conectar con API externa',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user