Actualizando NestJS a la versión 11 #18
Generated
+2767
-2005
File diff suppressed because it is too large
Load Diff
+23
-18
@@ -20,15 +20,15 @@
|
||||
"test:e2e": "jest --config ./test/jest-e2e.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "^9.0.0",
|
||||
"@nestjs/config": "^2.3.1",
|
||||
"@nestjs/core": "^9.0.0",
|
||||
"@nestjs/jwt": "^10.0.2",
|
||||
"@nestjs/passport": "^9.0.3",
|
||||
"@nestjs/platform-express": "^9.0.0",
|
||||
"@nestjs/serve-static": "^3.0.1",
|
||||
"@nestjs/swagger": "^6.2.1",
|
||||
"@nestjs/typeorm": "^9.0.1",
|
||||
"@nestjs/common": "^11.1.28",
|
||||
"@nestjs/config": "^4.0.4",
|
||||
"@nestjs/core": "^11.1.28",
|
||||
"@nestjs/jwt": "^11.0.2",
|
||||
"@nestjs/passport": "^11.0.5",
|
||||
"@nestjs/platform-express": "^11.1.28",
|
||||
"@nestjs/serve-static": "^5.0.5",
|
||||
"@nestjs/swagger": "^11.4.6",
|
||||
"@nestjs/typeorm": "^11.0.3",
|
||||
"bcrypt": "^5.1.0",
|
||||
"blob-stream": "^0.1.3",
|
||||
"class-transformer": "^0.5.1",
|
||||
@@ -36,7 +36,7 @@
|
||||
"date-fns": "^2.30.0",
|
||||
"exceljs": "^4.4.0",
|
||||
"moment": "^2.30.1",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"multer": "^2.2.0",
|
||||
"mysql2": "^3.23.2",
|
||||
"nodemailer": "^6.9.1",
|
||||
"passport": "^0.6.0",
|
||||
@@ -45,7 +45,7 @@
|
||||
"pdf-lib": "^1.17.1",
|
||||
"pdfkit": "^0.13.0",
|
||||
"pg": "^8.22.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"reflect-metadata": "^0.2.2",
|
||||
"rxjs": "^7.8.2",
|
||||
"swagger-ui-express": "^4.6.1",
|
||||
"sybase": "^1.2.3",
|
||||
@@ -57,28 +57,28 @@
|
||||
"@jridgewell/sourcemap-codec": "^1.4.14",
|
||||
"@nestjs/cli": "^9.0.0",
|
||||
"@nestjs/schematics": "^9.0.0",
|
||||
"@nestjs/testing": "^9.0.0",
|
||||
"@nestjs/testing": "^11.1.28",
|
||||
"@types/express": "^5.0.6",
|
||||
"@types/jest": "29.2.4",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/multer": "^2.2.0",
|
||||
"@types/node": "18.11.18",
|
||||
"@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/parser": "^5.0.0",
|
||||
"eslint": "^8.0.1",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"jest": "29.3.1",
|
||||
"jest": "^29.7.0",
|
||||
"pdfmake": "^0.2.7",
|
||||
"prettier": "^2.3.2",
|
||||
"source-map-support": "^0.5.20",
|
||||
"supertest": "^6.1.3",
|
||||
"ts-jest": "29.0.3",
|
||||
"supertest": "^7.2.2",
|
||||
"ts-jest": "^29.4.12",
|
||||
"ts-loader": "^9.6.2",
|
||||
"ts-node": "^10.9.2",
|
||||
"tsconfig-paths": "4.1.1",
|
||||
"typescript": "^4.7.4"
|
||||
"typescript": "~5.7.0"
|
||||
},
|
||||
"jest": {
|
||||
"moduleFileExtensions": [
|
||||
@@ -96,5 +96,10 @@
|
||||
],
|
||||
"coverageDirectory": "../coverage",
|
||||
"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({
|
||||
controllers: [ActividadController],
|
||||
providers: [ActividadService]
|
||||
providers: [ActividadService],
|
||||
})
|
||||
export class ActividadModule {}
|
||||
|
||||
@@ -12,14 +12,16 @@ export class AlmacenamientoService {
|
||||
|
||||
// Example method to create a new record
|
||||
async create(correo: string): Promise<any> {
|
||||
console.log(correo)
|
||||
const existente = await this.almacenamientoRepository.findOne({ where:{correo} });
|
||||
console.log(existente)
|
||||
console.log(correo);
|
||||
const existente = await this.almacenamientoRepository.findOne({
|
||||
where: { correo },
|
||||
});
|
||||
console.log(existente);
|
||||
if (!existente) {
|
||||
// Maneja el error aquí mismo
|
||||
throw new HttpException(
|
||||
{ error: 'Este usuario no tiene acceso' },
|
||||
HttpStatus.NOT_FOUND
|
||||
HttpStatus.NOT_FOUND,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,8 @@ export class Almacenamiento {
|
||||
@Column('varchar', { name: 'correo', length: 100 })
|
||||
correo: string;
|
||||
|
||||
@Column('timestamp', {
|
||||
@Column('timestamp', {
|
||||
name: 'fecha_ampliacion',
|
||||
})
|
||||
fechaConsulta: Date;
|
||||
|
||||
}
|
||||
|
||||
+1
-5
@@ -132,11 +132,7 @@ import { TylController } from './tyl/tyl.controller';
|
||||
ComentariosModule,
|
||||
AlmacenamientoModule,
|
||||
],
|
||||
controllers: [
|
||||
AppController,
|
||||
InscripcionStatusController,
|
||||
TylController,
|
||||
],
|
||||
controllers: [AppController, InscripcionStatusController, TylController],
|
||||
providers: [AppService, InscripcionStatusService],
|
||||
})
|
||||
export class AppModule {
|
||||
|
||||
@@ -27,6 +27,6 @@ export class AuthController {
|
||||
|
||||
@Post('validate')
|
||||
validar(@Param() token: any) {
|
||||
return this.authValidar.validate
|
||||
return this.authValidar.validate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
import { applyDecorators } from '@nestjs/common';
|
||||
import {
|
||||
ApiOperation,
|
||||
ApiResponse,
|
||||
ApiTags,
|
||||
ApiBody,
|
||||
} from '@nestjs/swagger';
|
||||
import { ApiOperation, ApiResponse, ApiTags, ApiBody } from '@nestjs/swagger';
|
||||
import { RegistrarMiembroDto } from './dto/registrarMiembro.dto';
|
||||
|
||||
export function ApiPostRegistro() {
|
||||
@@ -20,7 +15,8 @@ export function ApiPostRegistro() {
|
||||
examples: {
|
||||
requeridos: {
|
||||
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: {
|
||||
nombre: 'Luis',
|
||||
apellido_paterno: 'Martínez',
|
||||
@@ -33,7 +29,8 @@ export function ApiPostRegistro() {
|
||||
},
|
||||
completo: {
|
||||
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: {
|
||||
nombre: 'Ana',
|
||||
apellido_paterno: 'Torres',
|
||||
@@ -49,7 +46,8 @@ export function ApiPostRegistro() {
|
||||
},
|
||||
invalido: {
|
||||
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: {
|
||||
nombre: 'Mario',
|
||||
apellido_paterno: 'Gómez',
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { IsEmail, MaxLength, MinLength } from "class-validator"
|
||||
|
||||
import { IsEmail, MaxLength, MinLength } from 'class-validator';
|
||||
|
||||
export class LoginMiembroDto {
|
||||
@IsEmail()
|
||||
email: string
|
||||
@IsEmail()
|
||||
email: string;
|
||||
|
||||
@MinLength(5)
|
||||
@MaxLength(15)
|
||||
password: string
|
||||
}
|
||||
@MinLength(5)
|
||||
@MaxLength(15)
|
||||
password: string;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ export class RegistrarMiembroDto extends PartialType(LoginMiembroDto) {
|
||||
|
||||
@IsNotEmpty()
|
||||
apellido_paterno: string;
|
||||
|
||||
|
||||
@IsNotEmpty()
|
||||
apellido_materno: string;
|
||||
|
||||
@@ -18,15 +18,15 @@ export class RegistrarMiembroDto extends PartialType(LoginMiembroDto) {
|
||||
@MinLength(10)
|
||||
@MaxLength(15)
|
||||
password: string;
|
||||
|
||||
descripcion: string
|
||||
|
||||
id_carrera: number
|
||||
descripcion: string;
|
||||
|
||||
semestre: string
|
||||
id_carrera: number;
|
||||
|
||||
semestre: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
cuenta: number
|
||||
cuenta: number;
|
||||
|
||||
@IsEmail()
|
||||
email: string;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export const jwtConstants = {
|
||||
secret: "SemillaSecreta"
|
||||
}
|
||||
secret: 'SemillaSecreta',
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ import { jwtConstants } from './jwt.constants';
|
||||
@Injectable()
|
||||
export class jwtStrategy extends PassportStrategy(Strategy) {
|
||||
constructor() {
|
||||
super({
|
||||
super({
|
||||
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
||||
ignoreExpiration: false,
|
||||
secretOrKey: jwtConstants.secret,
|
||||
@@ -14,6 +14,6 @@ export class jwtStrategy extends PassportStrategy(Strategy) {
|
||||
}
|
||||
|
||||
async validate(payload: any) {
|
||||
return { userId: payload.sub , username: payload.username };
|
||||
return { userId: payload.sub, username: payload.username };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ export class CarruselController {
|
||||
}
|
||||
|
||||
@Put('updateOrden')
|
||||
async updateOrden(@Body() banners: { id: number; orden: number}[]) {
|
||||
async updateOrden(@Body() banners: { id: number; orden: number }[]) {
|
||||
return this.carruselService.updateOrden(banners);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ export class CarruselService {
|
||||
order: {
|
||||
orden: 'DESC',
|
||||
},
|
||||
take: 1
|
||||
take: 1,
|
||||
});
|
||||
|
||||
const ultimoOrden = ultimoCarrusel.length > 0 ? ultimoCarrusel[0].orden : 0;
|
||||
@@ -79,7 +79,6 @@ export class CarruselService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async updateImagenCarrusel(
|
||||
id: number,
|
||||
carruselDto: carruselDto,
|
||||
@@ -117,9 +116,9 @@ export class CarruselService {
|
||||
}
|
||||
|
||||
// Actualizar todas las imagenes por orden
|
||||
async updateOrden(banners: { id: number; orden: number}[]) {
|
||||
async updateOrden(banners: { id: number; orden: number }[]) {
|
||||
// Paso 1.- Mandar los banner a un orden extremo para que no causen conflicto al actualizar
|
||||
for( const banner of banners ) {
|
||||
for (const banner of banners) {
|
||||
await this.carruselRepository.update(
|
||||
{ id_imagen_carrusel: banner.id },
|
||||
{ orden: banner.orden + 1000 },
|
||||
@@ -127,16 +126,16 @@ export class CarruselService {
|
||||
}
|
||||
|
||||
// Paso 2.- Actualizamos al nuevo orden
|
||||
for (const banner of banners ) {
|
||||
for (const banner of banners) {
|
||||
await this.carruselRepository.update(
|
||||
{ id_imagen_carrusel: banner.id },
|
||||
{ orden: banner.orden },
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
message: 'Orden actualizado correctamente',
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
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 {
|
||||
@IsNotEmpty()
|
||||
ruta: string
|
||||
@IsNotEmpty()
|
||||
ruta: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
link: string
|
||||
@IsNotEmpty()
|
||||
link: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
orden?: number
|
||||
}
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
orden?: number;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class Carrusel {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_imagen_carrusel: number
|
||||
@PrimaryGeneratedColumn()
|
||||
id_imagen_carrusel: number;
|
||||
|
||||
@Column({length: 40})
|
||||
ruta: string
|
||||
/* "/public/carrusel/carrusel1.jpg" */
|
||||
@Column({ length: 40 })
|
||||
ruta: string;
|
||||
/* "/public/carrusel/carrusel1.jpg" */
|
||||
|
||||
@Column({length: 150})
|
||||
link: string
|
||||
/* "https://www.acatlan.unam.mx/" */
|
||||
@Column({ length: 150 })
|
||||
link: string;
|
||||
/* "https://www.acatlan.unam.mx/" */
|
||||
|
||||
@Column({ type: 'int', unique: true })
|
||||
orden: number
|
||||
}
|
||||
@Column({ type: 'int', unique: true })
|
||||
orden: number;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export let contador = 0
|
||||
export let contador = 0;
|
||||
|
||||
export const actualizarContador = () => {
|
||||
contador++
|
||||
}
|
||||
contador++;
|
||||
};
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
import { InscripcionArea } from "src/inscripcion-area/entity/inscripcion_area.entity";
|
||||
import { Column, Entity, OneToMany, PrimaryColumn, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { InscripcionArea } from 'src/inscripcion-area/entity/inscripcion_area.entity';
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
OneToMany,
|
||||
PrimaryColumn,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class Area {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_area: number
|
||||
@PrimaryGeneratedColumn()
|
||||
id_area: number;
|
||||
|
||||
@Column({length:20, nullable:false})
|
||||
area: string
|
||||
@Column({ length: 20, nullable: false })
|
||||
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 { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { Miembro } from 'src/miembro/entity/miembro.entity';
|
||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class Carrera {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_carrera: number
|
||||
@PrimaryGeneratedColumn()
|
||||
id_carrera: number;
|
||||
|
||||
@Column({ length:40, nullable: false})
|
||||
carrera: string
|
||||
@Column({ length: 40, nullable: false })
|
||||
carrera: string;
|
||||
|
||||
@OneToMany(
|
||||
() => Miembro, (miembro) => miembro.carrera
|
||||
)
|
||||
miembro: Miembro
|
||||
}
|
||||
@OneToMany(() => Miembro, (miembro) => miembro.carrera)
|
||||
miembro: Miembro;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
import { Miembro } from "src/miembro/entity/miembro.entity";
|
||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { Miembro } from 'src/miembro/entity/miembro.entity';
|
||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class TipoMiembro {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_tipo_miembro: number
|
||||
@PrimaryGeneratedColumn()
|
||||
id_tipo_miembro: number;
|
||||
|
||||
@Column({length:15, nullable:false})
|
||||
tipo_miembro: string
|
||||
@Column({ length: 15, nullable: false })
|
||||
tipo_miembro: string;
|
||||
|
||||
@OneToMany(
|
||||
() => Miembro, (miembro) => miembro.tipoMiembro
|
||||
)
|
||||
miembro: Miembro[]
|
||||
}
|
||||
@OneToMany(() => Miembro, (miembro) => miembro.tipoMiembro)
|
||||
miembro: Miembro[];
|
||||
}
|
||||
|
||||
@@ -1,43 +1,47 @@
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
Param,
|
||||
ParseIntPipe,
|
||||
Post,
|
||||
Query,
|
||||
} from '@nestjs/common';
|
||||
import { ComentariosService } from './comentarios.service';
|
||||
import { ComentarioDto } from './comentario.dto';
|
||||
|
||||
@Controller('comentarios')
|
||||
export class ComentariosController {
|
||||
constructor(private comentariosService: ComentariosService) {}
|
||||
|
||||
@Post()
|
||||
postComentario(@Body() comentario: ComentarioDto) {
|
||||
return this.comentariosService.postComentario(comentario);
|
||||
}
|
||||
|
||||
@Get()
|
||||
getComentarios() {
|
||||
return this.comentariosService.getComentarios();
|
||||
}
|
||||
|
||||
@Get('by-date')
|
||||
getComentariosByDate(
|
||||
@Query('before') before?: string,
|
||||
@Query('after') after?: string,
|
||||
@Query('from') from?: string,
|
||||
@Query('to') to?: string,
|
||||
) {
|
||||
return this.comentariosService.getComentariosByDate(before, after, from, to);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
deleteComentario(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.comentariosService.deleteComentario(id);
|
||||
}
|
||||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
Param,
|
||||
ParseIntPipe,
|
||||
Post,
|
||||
Query,
|
||||
} from '@nestjs/common';
|
||||
import { ComentariosService } from './comentarios.service';
|
||||
import { ComentarioDto } from './comentario.dto';
|
||||
|
||||
@Controller('comentarios')
|
||||
export class ComentariosController {
|
||||
constructor(private comentariosService: ComentariosService) {}
|
||||
|
||||
@Post()
|
||||
postComentario(@Body() comentario: ComentarioDto) {
|
||||
return this.comentariosService.postComentario(comentario);
|
||||
}
|
||||
|
||||
|
||||
@Get()
|
||||
getComentarios() {
|
||||
return this.comentariosService.getComentarios();
|
||||
}
|
||||
|
||||
@Get('by-date')
|
||||
getComentariosByDate(
|
||||
@Query('before') before?: string,
|
||||
@Query('after') after?: string,
|
||||
@Query('from') from?: string,
|
||||
@Query('to') to?: string,
|
||||
) {
|
||||
return this.comentariosService.getComentariosByDate(
|
||||
before,
|
||||
after,
|
||||
from,
|
||||
to,
|
||||
);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
deleteComentario(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.comentariosService.deleteComentario(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ export class ComentariosService {
|
||||
throw new BadRequestException('Mensaje no autorizado');
|
||||
}
|
||||
|
||||
|
||||
const nuevoComentario = this.comentariosRepository.create(comentario);
|
||||
return this.comentariosRepository.save(nuevoComentario);
|
||||
}
|
||||
@@ -54,7 +53,7 @@ export class ComentariosService {
|
||||
if (to) {
|
||||
query.andWhere('comentarios.fecha_registro <= :to', { to: new Date(to) });
|
||||
}
|
||||
|
||||
|
||||
query.orderBy('comentarios.fecha_registro', 'DESC');
|
||||
|
||||
return await query.getMany();
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn } from 'typeorm';
|
||||
import {
|
||||
Entity,
|
||||
Column,
|
||||
PrimaryGeneratedColumn,
|
||||
CreateDateColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class Comentarios {
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
import { MiembroContacto } from "src/miembro-contacto/entity/miembro_contacto.entity";
|
||||
import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
|
||||
|
||||
import { MiembroContacto } from 'src/miembro-contacto/entity/miembro_contacto.entity';
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class Contacto {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_contacto: number
|
||||
@PrimaryGeneratedColumn()
|
||||
id_contacto: number;
|
||||
|
||||
@Column({nullable:false})
|
||||
email: string
|
||||
@Column({ nullable: false })
|
||||
email: string;
|
||||
|
||||
@Column({length: 40})
|
||||
horario: string
|
||||
@Column({ length: 40 })
|
||||
horario: string;
|
||||
|
||||
@Column({length: 75, nullable:true})
|
||||
facebook: string
|
||||
@Column({ length: 75, nullable: true })
|
||||
facebook: string;
|
||||
|
||||
@Column({length: 60, nullable: true})
|
||||
linkedin: string
|
||||
@Column({ length: 60, nullable: true })
|
||||
linkedin: string;
|
||||
|
||||
@ManyToOne(
|
||||
() => MiembroContacto, (miembroContacto) => miembroContacto.contacto
|
||||
)
|
||||
@JoinColumn({name: "id_contacto"})
|
||||
miembroContacto: MiembroContacto
|
||||
}
|
||||
@ManyToOne(
|
||||
() => MiembroContacto,
|
||||
(miembroContacto) => miembroContacto.contacto,
|
||||
)
|
||||
@JoinColumn({ name: 'id_contacto' })
|
||||
miembroContacto: MiembroContacto;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { IsEmail } from "class-validator"
|
||||
import { IsEmail } from 'class-validator';
|
||||
|
||||
export class EmailDto {
|
||||
subject: string;
|
||||
|
||||
subject:string
|
||||
|
||||
text:string
|
||||
}
|
||||
text: string;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
interface Row {
|
||||
Asistencia: number
|
||||
Nombre: string
|
||||
'Apellido Paterno': string
|
||||
'Apellido Materno': string
|
||||
Carrera: string
|
||||
'Institución Procedencia': string
|
||||
Email: string
|
||||
}
|
||||
Asistencia: number;
|
||||
Nombre: string;
|
||||
'Apellido Paterno': string;
|
||||
'Apellido Materno': string;
|
||||
Carrera: string;
|
||||
'Institución Procedencia': string;
|
||||
Email: string;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import { AuthGuard } from '@nestjs/passport';
|
||||
|
||||
@Controller('email')
|
||||
export class EmailController {
|
||||
constructor(private readonly emailService: EmailService) { }
|
||||
constructor(private readonly emailService: EmailService) {}
|
||||
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@Post('/evento/:id')
|
||||
@@ -52,14 +52,8 @@ export class EmailController {
|
||||
|
||||
//@UseGuards(AuthGuard('jwt'))
|
||||
@Get(':id/participantes/xlsx')
|
||||
async descargarExcel(
|
||||
@Param('id') idEvento: number,
|
||||
@Res() res: Response,
|
||||
) {
|
||||
console.log('entro en el controller')
|
||||
async descargarExcel(@Param('id') idEvento: number, @Res() res: Response) {
|
||||
console.log('entro en el controller');
|
||||
return this.emailService.getParticipantesExcel(idEvento, res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -9,8 +9,10 @@ import { EventoParticipante } from 'src/evento-participante/evento-participante/
|
||||
import { Evento } from 'src/eventos/evento.entity';
|
||||
|
||||
@Module({
|
||||
imports:[TypeOrmModule.forFeature([Participante, EventoParticipante, Evento])],
|
||||
controllers:[EmailController],
|
||||
providers:[EmailService, EventosService]
|
||||
imports: [
|
||||
TypeOrmModule.forFeature([Participante, EventoParticipante, Evento]),
|
||||
],
|
||||
controllers: [EmailController],
|
||||
providers: [EmailService, EventosService],
|
||||
})
|
||||
export class EmailModule {}
|
||||
|
||||
@@ -69,7 +69,7 @@ export class EmailService {
|
||||
}
|
||||
|
||||
async getParticipantesExcel(idEvento: number, res: Response) {
|
||||
console.log('entro a la funcion')
|
||||
console.log('entro a la funcion');
|
||||
const participantes = await this.participanteRepository
|
||||
.createQueryBuilder('participante')
|
||||
.innerJoin('participante.eventosParticipante', 'eventoParticipante')
|
||||
@@ -106,7 +106,6 @@ export class EmailService {
|
||||
institucion_procedencia: p.institucion_procedencia,
|
||||
correo: p.email,
|
||||
telefono: p.telefono,
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -120,12 +119,10 @@ export class EmailService {
|
||||
'attachment; filename=participantes.xlsx',
|
||||
);
|
||||
|
||||
|
||||
await workbook.xlsx.write(res);
|
||||
res.end();
|
||||
}
|
||||
|
||||
|
||||
async sendConstancias(file, id_evento, res: Response) {
|
||||
//traemos la info del evento
|
||||
const evento = await this.eventoService.getEventosPorId(id_evento);
|
||||
@@ -140,8 +137,13 @@ export class EmailService {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const row = data[i] as Row;
|
||||
|
||||
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`});
|
||||
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`,
|
||||
});
|
||||
}
|
||||
|
||||
// Carga el PDF pre-diseñado en un documento PDF editable
|
||||
@@ -231,7 +233,6 @@ export class EmailService {
|
||||
return res.status(200).json({ message: 'Constancias enviadas con éxito' });
|
||||
}
|
||||
|
||||
|
||||
formatoFecha(fecha: Date) {
|
||||
const fechaLimpia = format(fecha, 'dd/MM/yyyy');
|
||||
return fechaLimpia;
|
||||
|
||||
@@ -1,27 +1,30 @@
|
||||
import { Equipo } from "src/equipo/entity/equipo.entity";
|
||||
import { Evento } from "src/eventos/evento.entity";
|
||||
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { Equipo } from 'src/equipo/entity/equipo.entity';
|
||||
import { Evento } from 'src/eventos/evento.entity';
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class EquipoEvento {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_equipo_evento: number
|
||||
@PrimaryGeneratedColumn()
|
||||
id_equipo_evento: number;
|
||||
|
||||
@Column()
|
||||
id_equipo: number
|
||||
@Column()
|
||||
id_equipo: number;
|
||||
|
||||
@Column()
|
||||
id_evento: number
|
||||
@Column()
|
||||
id_evento: number;
|
||||
|
||||
@ManyToOne(
|
||||
() => Equipo, (equipo) => equipo.equipoEvento
|
||||
)
|
||||
@JoinColumn({name: "id_equipo"})
|
||||
equipo: Equipo[]
|
||||
@ManyToOne(() => Equipo, (equipo) => equipo.equipoEvento)
|
||||
@JoinColumn({ name: 'id_equipo' })
|
||||
equipo: Equipo[];
|
||||
|
||||
@ManyToOne(
|
||||
() => Evento, (evento) => evento.equipoEvento
|
||||
)
|
||||
@JoinColumn({name: "id_evento"})
|
||||
evento: Evento
|
||||
}
|
||||
@ManyToOne(() => Evento, (evento) => evento.equipoEvento)
|
||||
@JoinColumn({ name: 'id_evento' })
|
||||
evento: Evento;
|
||||
}
|
||||
|
||||
@@ -1,27 +1,30 @@
|
||||
import { Equipo } from "src/equipo/entity/equipo.entity";
|
||||
import { Miembro } from "src/miembro/entity/miembro.entity";
|
||||
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { Equipo } from 'src/equipo/entity/equipo.entity';
|
||||
import { Miembro } from 'src/miembro/entity/miembro.entity';
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class EquipoMiembro {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_equipo_miembro:number
|
||||
@PrimaryGeneratedColumn()
|
||||
id_equipo_miembro: number;
|
||||
|
||||
@Column()
|
||||
id_equipo:number
|
||||
@Column()
|
||||
id_equipo: number;
|
||||
|
||||
@Column()
|
||||
id_miembro:number
|
||||
@Column()
|
||||
id_miembro: number;
|
||||
|
||||
@ManyToOne(
|
||||
() => Miembro, (miembro) => miembro.equipoMiembro
|
||||
)
|
||||
@JoinColumn({name:"id_miembro"})
|
||||
miembro: Miembro[]
|
||||
@ManyToOne(() => Miembro, (miembro) => miembro.equipoMiembro)
|
||||
@JoinColumn({ name: 'id_miembro' })
|
||||
miembro: Miembro[];
|
||||
|
||||
@ManyToOne(
|
||||
() => Equipo,(equipo) => equipo.equipoMiembro
|
||||
)
|
||||
@JoinColumn({name: "id_equipo"})
|
||||
equipo: Equipo[]
|
||||
}
|
||||
@ManyToOne(() => Equipo, (equipo) => equipo.equipoMiembro)
|
||||
@JoinColumn({ name: 'id_equipo' })
|
||||
equipo: Equipo[];
|
||||
}
|
||||
|
||||
@@ -1,25 +1,28 @@
|
||||
import { EquipoEvento } from "src/equipo-evento/entity/equipo_evento.entity";
|
||||
import { EquipoMiembro } from "src/equipo-miembro/entity/equipo_miembro.entity";
|
||||
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { EquipoEvento } from 'src/equipo-evento/entity/equipo_evento.entity';
|
||||
import { EquipoMiembro } from 'src/equipo-miembro/entity/equipo_miembro.entity';
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class Equipo{
|
||||
@PrimaryGeneratedColumn()
|
||||
id_equipo: number
|
||||
|
||||
@Column({length:50, nullable:true})
|
||||
nombre: string
|
||||
export class Equipo {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_equipo: number;
|
||||
|
||||
@Column({length:100})
|
||||
descripcion:string
|
||||
@Column({ length: 50, nullable: true })
|
||||
nombre: string;
|
||||
|
||||
@OneToMany(
|
||||
() => EquipoMiembro, (equipoMiembro) => equipoMiembro.miembro
|
||||
)
|
||||
equipoMiembro: EquipoMiembro
|
||||
@Column({ length: 100 })
|
||||
descripcion: string;
|
||||
|
||||
@OneToMany(
|
||||
() => EquipoEvento, (equipoEvento) => equipoEvento.evento
|
||||
)
|
||||
equipoEvento: EquipoEvento
|
||||
}
|
||||
@OneToMany(() => EquipoMiembro, (equipoMiembro) => equipoMiembro.miembro)
|
||||
equipoMiembro: EquipoMiembro;
|
||||
|
||||
@OneToMany(() => EquipoEvento, (equipoEvento) => equipoEvento.evento)
|
||||
equipoEvento: EquipoEvento;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { IsNotEmpty, IsNumber } from "class-validator"
|
||||
import { IsNotEmpty, IsNumber } from 'class-validator';
|
||||
|
||||
export class registrarEnEvento {
|
||||
@IsNumber()
|
||||
@IsNotEmpty()
|
||||
id_eventoParticipante: number
|
||||
|
||||
@IsNumber()
|
||||
@IsNotEmpty()
|
||||
id_evento: number
|
||||
|
||||
@IsNumber()
|
||||
@IsNotEmpty()
|
||||
id_participante: number
|
||||
}
|
||||
@IsNumber()
|
||||
@IsNotEmpty()
|
||||
id_eventoParticipante: number;
|
||||
|
||||
@IsNumber()
|
||||
@IsNotEmpty()
|
||||
id_evento: number;
|
||||
|
||||
@IsNumber()
|
||||
@IsNotEmpty()
|
||||
id_participante: number;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ export class RegistrarParticipanteDto {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
apellido_paterno: string;
|
||||
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
apellido_materno: string;
|
||||
@@ -21,7 +21,6 @@ export class RegistrarParticipanteDto {
|
||||
@IsNotEmpty()
|
||||
institucion_procedencia: string;
|
||||
|
||||
|
||||
@IsEmail()
|
||||
email: string;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,31 @@
|
||||
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 { EventoParticipanteService } from './evento-participante.service';
|
||||
import { EventoParticipante } from './eventoParticipante.entity';
|
||||
|
||||
@Controller('evento-participante')
|
||||
export class EventoParticipanteController {
|
||||
constructor(private readonly eventoParticipanteService: EventoParticipanteService){}
|
||||
constructor(
|
||||
private readonly eventoParticipanteService: EventoParticipanteService,
|
||||
) {}
|
||||
|
||||
@Post(':id')
|
||||
regitrarParticipante(@Param("id", ParseIntPipe)id: number, @Body() datos: RegistrarParticipanteDto){
|
||||
return this.eventoParticipanteService.registrarParticipante(id, datos)
|
||||
}
|
||||
@Post(':id')
|
||||
regitrarParticipante(
|
||||
@Param('id', ParseIntPipe) id: number,
|
||||
@Body() datos: RegistrarParticipanteDto,
|
||||
) {
|
||||
return this.eventoParticipanteService.registrarParticipante(id, datos);
|
||||
}
|
||||
|
||||
@Get()
|
||||
getEventoParticipante(): Promise<EventoParticipante[]> {
|
||||
return this.eventoParticipanteService.getEventoParticipantes();
|
||||
}
|
||||
@Get()
|
||||
getEventoParticipante(): Promise<EventoParticipante[]> {
|
||||
return this.eventoParticipanteService.getEventoParticipantes();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ import { EventoParticipanteService } from './evento-participante.service';
|
||||
import { EventoParticipante } from './eventoParticipante.entity';
|
||||
|
||||
@Module({
|
||||
imports:[TypeOrmModule.forFeature([EventoParticipante,Participante])],
|
||||
imports: [TypeOrmModule.forFeature([EventoParticipante, Participante])],
|
||||
controllers: [EventoParticipanteController],
|
||||
providers: [EventoParticipanteService]
|
||||
providers: [EventoParticipanteService],
|
||||
})
|
||||
export class EventoParticipanteModule {}
|
||||
|
||||
@@ -49,7 +49,6 @@ export class EventoParticipanteService {
|
||||
return this.participanteExiste(registrarParticipanteDto.email).then(
|
||||
(res) => {
|
||||
if (res) {
|
||||
|
||||
res.nombre = registrarParticipanteDto.nombre;
|
||||
res.apellido_paterno = registrarParticipanteDto.apellido_paterno;
|
||||
res.apellido_materno = registrarParticipanteDto.apellido_materno;
|
||||
@@ -57,7 +56,7 @@ export class EventoParticipanteService {
|
||||
res.institucion_procedencia =
|
||||
registrarParticipanteDto.institucion_procedencia;
|
||||
|
||||
//si el correo ya existe en la base de datos solo se le cambia el nombre, apellidos, carrera e institucion
|
||||
//si el correo ya existe en la base de datos solo se le cambia el nombre, apellidos, carrera e institucion
|
||||
|
||||
return this.participanteRepository
|
||||
.save(res)
|
||||
@@ -77,6 +76,6 @@ export class EventoParticipanteService {
|
||||
}
|
||||
|
||||
getEventoParticipantes() {
|
||||
return this.eventoParticipanteRepository.find()
|
||||
return this.eventoParticipanteRepository.find();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
import { Evento } from 'src/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';
|
||||
|
||||
@Entity()
|
||||
export class EventoParticipante {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_eventoParticipante: number
|
||||
id_eventoParticipante: number;
|
||||
|
||||
@Column({type: Number, nullable:false})
|
||||
id_evento: number
|
||||
@Column({ type: Number, nullable: false })
|
||||
id_evento: number;
|
||||
|
||||
@Column({type:Number, nullable:false})
|
||||
id_participante: number
|
||||
@Column({ type: Number, nullable: false })
|
||||
id_participante: number;
|
||||
|
||||
@ManyToOne(() => Evento, (evento) => evento.eventoParticipantes)
|
||||
@JoinColumn({ name: 'id_evento' })
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
export class actualizarEventoDto {
|
||||
nombre?: string;
|
||||
tipo_evento?: string;
|
||||
organizadores?: string;
|
||||
proyecto?: string;
|
||||
modalidad?: string;
|
||||
lugar?: string;
|
||||
observaciones?: string;
|
||||
cuota_inscripcion?: number;
|
||||
patrocinador?: string;
|
||||
tipo_acreditacion?: string;
|
||||
descripcion?: string;
|
||||
fecha_inicio?: Date;
|
||||
fecha_fin?: Date;
|
||||
fecha_limite_inscripcion?: Date;
|
||||
}
|
||||
nombre?: string;
|
||||
tipo_evento?: string;
|
||||
organizadores?: string;
|
||||
proyecto?: string;
|
||||
modalidad?: string;
|
||||
lugar?: string;
|
||||
observaciones?: string;
|
||||
cuota_inscripcion?: number;
|
||||
patrocinador?: string;
|
||||
tipo_acreditacion?: string;
|
||||
descripcion?: string;
|
||||
fecha_inicio?: Date;
|
||||
fecha_fin?: Date;
|
||||
fecha_limite_inscripcion?: Date;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
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 { InjectRepository } from '@nestjs/typeorm';
|
||||
import { EventoParticipante } from 'src/evento-participante/evento-participante/eventoParticipante.entity';
|
||||
@@ -11,62 +22,66 @@ import { AuthGuard } from '@nestjs/passport';
|
||||
|
||||
@Controller('eventos')
|
||||
export class EventosController {
|
||||
|
||||
constructor(private readonly eventoService: EventosService){}
|
||||
constructor(private readonly eventoService: EventosService) {}
|
||||
|
||||
@Get()
|
||||
getEventos(): Promise<Evento[]>{
|
||||
return this.eventoService.getEventos()
|
||||
}
|
||||
@Get()
|
||||
getEventos(): Promise<Evento[]> {
|
||||
return this.eventoService.getEventos();
|
||||
}
|
||||
|
||||
@Get('disponibles')
|
||||
getEventosDisponibles (){
|
||||
return this.eventoService.getEventosDisponibles()
|
||||
}
|
||||
@Get('disponibles')
|
||||
getEventosDisponibles() {
|
||||
return this.eventoService.getEventosDisponibles();
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
getEventosPorId(@Param('id', ParseIntPipe)id: number):Promise<Evento>{
|
||||
return this.eventoService.getEventosPorId(id)
|
||||
}
|
||||
@Get(':id')
|
||||
getEventosPorId(@Param('id', ParseIntPipe) id: number): Promise<Evento> {
|
||||
return this.eventoService.getEventosPorId(id);
|
||||
}
|
||||
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@Post()
|
||||
postEvento(@Body() nuevoEvento: crearEventoDto){
|
||||
return this.eventoService.postEvento(nuevoEvento)
|
||||
}
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@Post()
|
||||
postEvento(@Body() nuevoEvento: crearEventoDto) {
|
||||
return this.eventoService.postEvento(nuevoEvento);
|
||||
}
|
||||
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@Patch(':id')
|
||||
patchEvento(@Param('id', ParseIntPipe)id:number, @Body() actualizacion: actualizarEventoDto){
|
||||
return this.eventoService.updateEvento(id,actualizacion)
|
||||
}
|
||||
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@Delete(':id')
|
||||
deleteEvento(@Param('id', ParseIntPipe)id: number){
|
||||
return this.eventoService.deleteEventoParticipante(id)
|
||||
}
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@Patch(':id')
|
||||
patchEvento(
|
||||
@Param('id', ParseIntPipe) id: number,
|
||||
@Body() actualizacion: actualizarEventoDto,
|
||||
) {
|
||||
return this.eventoService.updateEvento(id, actualizacion);
|
||||
}
|
||||
|
||||
@Get(':id/cupos')
|
||||
async getCupos(@Param('id', ParseIntPipe)id: number){
|
||||
return this.eventoService.getCupos(id)
|
||||
}
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@Delete(':id')
|
||||
deleteEvento(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.eventoService.deleteEventoParticipante(id);
|
||||
}
|
||||
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@Get(':id/participante')
|
||||
async getParticipnates(@Param('id', ParseIntPipe)id:number){
|
||||
return this.eventoService.getParticipantes(id)
|
||||
}
|
||||
@Get(':id/cupos')
|
||||
async getCupos(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.eventoService.getCupos(id);
|
||||
}
|
||||
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@Get(':id/exportExcel')
|
||||
async exportarExcel (@Param('id', ParseIntPipe)id:number ,@Res() res: Response){
|
||||
this.eventoService.exportarParticipantes(id, res)
|
||||
}
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@Get(':id/participante')
|
||||
async getParticipnates(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.eventoService.getParticipantes(id);
|
||||
}
|
||||
|
||||
@Post('disponibles/pendientesDconstancia')
|
||||
getEventosDisponiblesPendientes(){
|
||||
return this.eventoService.geteventosDisponiblesMasDosDias()
|
||||
}
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@Get(':id/exportExcel')
|
||||
async exportarExcel(
|
||||
@Param('id', ParseIntPipe) id: number,
|
||||
@Res() res: Response,
|
||||
) {
|
||||
this.eventoService.exportarParticipantes(id, res);
|
||||
}
|
||||
|
||||
@Post('disponibles/pendientesDconstancia')
|
||||
getEventosDisponiblesPendientes() {
|
||||
return this.eventoService.geteventosDisponiblesMasDosDias();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,10 @@ import { EventosController } from './eventos.controller';
|
||||
import { EventosService } from './eventos.service';
|
||||
|
||||
@Module({
|
||||
imports:[TypeOrmModule.forFeature([Evento, EventoParticipante, Participante])],
|
||||
controllers:[EventosController],
|
||||
providers:[EventosService]
|
||||
imports: [
|
||||
TypeOrmModule.forFeature([Evento, EventoParticipante, Participante]),
|
||||
],
|
||||
controllers: [EventosController],
|
||||
providers: [EventosService],
|
||||
})
|
||||
export class EventosModule {}
|
||||
|
||||
@@ -191,11 +191,12 @@ export class EventosService {
|
||||
});
|
||||
}
|
||||
|
||||
geteventosDisponiblesMasDosDias(){
|
||||
geteventosDisponiblesMasDosDias() {
|
||||
const hoy = new Date();
|
||||
return this.eventoRepository.createQueryBuilder("evento")
|
||||
.where(`DATE_ADD(evento.fecha_fin, INTERVAL 3 DAY) >= :hoy`, { hoy })
|
||||
.andWhere('fecha_fin <= :hoy', {hoy})
|
||||
.getMany();
|
||||
return this.eventoRepository
|
||||
.createQueryBuilder('evento')
|
||||
.where(`DATE_ADD(evento.fecha_fin, INTERVAL 3 DAY) >= :hoy`, { hoy })
|
||||
.andWhere('fecha_fin <= :hoy', { hoy })
|
||||
.getMany();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,9 @@ export class InscripcionArea {
|
||||
area: Area;
|
||||
|
||||
@ManyToOne(
|
||||
() => InscripcionDSC, (inscripcionDsc) => inscripcionDsc.inscripcionArea
|
||||
() => InscripcionDSC,
|
||||
(inscripcionDsc) => inscripcionDsc.inscripcionArea,
|
||||
)
|
||||
@JoinColumn({name:"id_inscripcion"})
|
||||
inscripcionDsc: InscripcionDSC
|
||||
@JoinColumn({ name: 'id_inscripcion' })
|
||||
inscripcionDsc: InscripcionDSC;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ import { InscripcionAreaService } from './inscripcion-area.service';
|
||||
|
||||
@Module({
|
||||
controllers: [InscripcionAreaController],
|
||||
providers: [InscripcionAreaService]
|
||||
providers: [InscripcionAreaService],
|
||||
})
|
||||
export class InscripcionAreaModule {}
|
||||
|
||||
@@ -2,44 +2,51 @@ import { InscripcionArea } from 'src/inscripcion-area/entity/inscripcion_area.en
|
||||
import { InscripcionStatus } from 'src/inscripcion-status/entity/inscripcion_status.entity';
|
||||
import { InscripcionUsuario } from 'src/inscripcion-usuario/entity/inscripcion_usuario.entity';
|
||||
import { Periodo } from 'src/periodo/entity/periodo.entity';
|
||||
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class InscripcionDSC {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_inscripcion: number;
|
||||
|
||||
@Column({ default: 2})
|
||||
@Column({ default: 2 })
|
||||
validacion: number;
|
||||
|
||||
@Column({ nullable: false, default: false})
|
||||
@Column({ nullable: false, default: false })
|
||||
confirmacion: boolean;
|
||||
|
||||
@Column({ length: 5, unique: true, default: null})
|
||||
@Column({ length: 5, unique: true, default: null })
|
||||
folio: string;
|
||||
|
||||
@Column({ default: null})
|
||||
@Column({ default: null })
|
||||
monto: number;
|
||||
|
||||
@Column({ default: null})
|
||||
@Column({ default: null })
|
||||
hizoPago: boolean;
|
||||
|
||||
@Column({ length: 100, default: null})
|
||||
@Column({ length: 100, default: null })
|
||||
rutaTicket: string;
|
||||
|
||||
@Column({ length: 6, default: null})
|
||||
@Column({ length: 6, default: null })
|
||||
extension: string;
|
||||
|
||||
@Column({ default: null})
|
||||
@Column({ default: null })
|
||||
fechaInscripcion: Date;
|
||||
|
||||
@Column({ default: null})
|
||||
@Column({ default: null })
|
||||
fechaFin: Date;
|
||||
|
||||
@Column({nullable:false})
|
||||
@Column({ nullable: false })
|
||||
id_status: number;
|
||||
|
||||
@Column({nullable: false})
|
||||
@Column({ nullable: false })
|
||||
id_periodo: number;
|
||||
|
||||
@OneToMany(
|
||||
@@ -49,20 +56,19 @@ export class InscripcionDSC {
|
||||
inscripcionArea: InscripcionArea[];
|
||||
|
||||
@ManyToOne(
|
||||
() => InscripcionStatus, (inscripcionStatus) => inscripcionStatus.inscripcionDsc
|
||||
() => InscripcionStatus,
|
||||
(inscripcionStatus) => inscripcionStatus.inscripcionDsc,
|
||||
)
|
||||
@JoinColumn({name: "id_status"})
|
||||
inscripcionStatus: InscripcionStatus
|
||||
@JoinColumn({ name: 'id_status' })
|
||||
inscripcionStatus: InscripcionStatus;
|
||||
|
||||
@ManyToOne(
|
||||
() => Periodo, (periodo) => periodo.inscripcionDsc
|
||||
)
|
||||
@JoinColumn({name: "id_periodo"})
|
||||
periodo: Periodo
|
||||
@ManyToOne(() => Periodo, (periodo) => periodo.inscripcionDsc)
|
||||
@JoinColumn({ name: 'id_periodo' })
|
||||
periodo: Periodo;
|
||||
|
||||
@OneToMany(
|
||||
() => InscripcionUsuario, (inscripcionUsuario) => inscripcionUsuario.inscripcionDsc
|
||||
() => InscripcionUsuario,
|
||||
(inscripcionUsuario) => inscripcionUsuario.inscripcionDsc,
|
||||
)
|
||||
inscripcionUsuario: InscripcionUsuario[]
|
||||
|
||||
inscripcionUsuario: InscripcionUsuario[];
|
||||
}
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
NotFoundException,
|
||||
Post,
|
||||
} from '@nestjs/common';
|
||||
import { Body, Controller, NotFoundException, Post } from '@nestjs/common';
|
||||
import { InscripcionDscService } from './inscripcion-dsc.service';
|
||||
import { And } from 'typeorm';
|
||||
|
||||
@@ -14,12 +9,14 @@ export class InscripcionDscController {
|
||||
@Post('confirmacion')
|
||||
async confirmacionDsc(@Body() body: any) {
|
||||
const { accountNumber } = body;
|
||||
console.log('Entro a la confirmacion')
|
||||
console.log('Entro a la confirmacion');
|
||||
|
||||
const userVerification = await this.inscripcionService.userVerification(accountNumber);
|
||||
/* console.log(userVerification) */
|
||||
console.log('Usuario verificacion', userVerification);
|
||||
if(!userVerification){
|
||||
const userVerification = await this.inscripcionService.userVerification(
|
||||
accountNumber,
|
||||
);
|
||||
/* console.log(userVerification) */
|
||||
console.log('Usuario verificacion', userVerification);
|
||||
if (!userVerification) {
|
||||
throw new NotFoundException('El usuario no se encuentra inscrito');
|
||||
|
||||
// return {
|
||||
@@ -30,12 +27,14 @@ console.log('Usuario verificacion', userVerification);
|
||||
}
|
||||
|
||||
const userInformation = userVerification;
|
||||
/* console.log(userInformation[0].confirmacion) */
|
||||
/* console.log(userInformation[0].confirmacion) */
|
||||
|
||||
|
||||
try{
|
||||
/* console.log("verificando confirmacion:", userInformation);
|
||||
*/ if (userInformation[0].confirmacion && userInformation[1].confirmacion) {
|
||||
try {
|
||||
/* console.log("verificando confirmacion:", userInformation);
|
||||
*/ if (
|
||||
userInformation[0].confirmacion &&
|
||||
userInformation[1].confirmacion
|
||||
) {
|
||||
return {
|
||||
error: true,
|
||||
msj: 'El usuario ya hizo la confirmación anteriormente',
|
||||
@@ -60,6 +59,6 @@ console.log('Usuario verificacion', userVerification);
|
||||
msj: `No se pudo realizar la confirmación del usuario`,
|
||||
desc: `${err}`,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ import { InscripcionDscService } from './inscripcion-dsc.service';
|
||||
|
||||
@Module({
|
||||
controllers: [InscripcionDscController],
|
||||
providers: [InscripcionDscService]
|
||||
providers: [InscripcionDscService],
|
||||
})
|
||||
export class InscripcionDscModule {}
|
||||
|
||||
@@ -14,15 +14,15 @@ export class InscripcionDscService {
|
||||
});
|
||||
|
||||
// const userInformationQuery = `SELECT A.id_cuenta, nombre, if(AI.platica=true,1,0) as confirmacion FROM alumno A
|
||||
// JOIN alumno_inscrito AI ON (A.id_cuenta = AI.id_cuenta)
|
||||
// JOIN periodo P ON (P.id_periodo = AI.id_periodo)
|
||||
// JOIN alumno_inscrito AI ON (A.id_cuenta = AI.id_cuenta)
|
||||
// JOIN periodo P ON (P.id_periodo = AI.id_periodo)
|
||||
// WHERE A.id_cuenta = "${accountNumber}" and P.activo=true`;
|
||||
const userInformationQuery = `SELECT A.id_cuenta, nombre, if(AI.platica=true,1,0) as confirmacion FROM alumno A
|
||||
JOIN alumno_inscrito AI ON (A.id_cuenta = AI.id_cuenta) and (AI.id_plataforma = 1 || AI.id_plataforma = 2)
|
||||
JOIN periodo P ON (P.id_periodo = AI.id_periodo)
|
||||
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}";`;
|
||||
|
||||
@@ -32,10 +32,10 @@ export class InscripcionDscService {
|
||||
/* console.log('The solution is: ', resultsArray); */
|
||||
console.log('The solution is: ', resultsArray);
|
||||
|
||||
console.log('Resultados', results)
|
||||
console.log('Resultados', results);
|
||||
return results;
|
||||
} catch (error) {
|
||||
console.log('Entro al error', error)
|
||||
console.log('Entro al error', error);
|
||||
throw error;
|
||||
} finally {
|
||||
if (connection) {
|
||||
@@ -44,7 +44,6 @@ export class InscripcionDscService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async userConfirmation(accountNumber: string): Promise<any> {
|
||||
try {
|
||||
const connection = await createConnection({
|
||||
@@ -56,9 +55,9 @@ export class InscripcionDscService {
|
||||
|
||||
const userInformationQuery = `UPDATE alumno_inscrito SET platica=true
|
||||
WHERE id_cuenta="${accountNumber}" and id_periodo=(SELECT id_periodo FROM periodo WHERE activo=true)`;
|
||||
|
||||
|
||||
const qryEjemplo = `select platica from alumno_inscrito WHERE id_cuenta="${accountNumber}"`;
|
||||
|
||||
|
||||
const [results] = await connection.query(userInformationQuery);
|
||||
const resultsArray = JSON.parse(JSON.stringify(results));
|
||||
if (resultsArray.length === 0) return null;
|
||||
@@ -68,7 +67,7 @@ export class InscripcionDscService {
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
|
||||
/* const { accountNumber } = data;
|
||||
|
||||
try {
|
||||
@@ -90,9 +89,9 @@ export class InscripcionDscService {
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
validarNumeroCuenta = (numeroCuenta) => {
|
||||
if (typeof numeroCuenta !== 'string' || numeroCuenta.length > 9)
|
||||
return numeroCuenta;
|
||||
};
|
||||
|
||||
validarNumeroCuenta = (numeroCuenta) => {
|
||||
if (typeof numeroCuenta !== 'string' || numeroCuenta.length > 9)
|
||||
return numeroCuenta;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,12 +6,15 @@ export class InscripcionStatus {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_inscripcion_status: number;
|
||||
|
||||
@Column({ nullable: false})
|
||||
@Column({ nullable: false })
|
||||
id_status: number;
|
||||
|
||||
@Column({ nullable: false})
|
||||
@Column({ nullable: false })
|
||||
status: number;
|
||||
|
||||
@OneToMany(() => InscripcionDSC, (inscripcionDsc) => inscripcionDsc.inscripcionStatus)
|
||||
@OneToMany(
|
||||
() => InscripcionDSC,
|
||||
(inscripcionDsc) => inscripcionDsc.inscripcionStatus,
|
||||
)
|
||||
inscripcionDsc: InscripcionDSC[];
|
||||
}
|
||||
|
||||
@@ -1,29 +1,32 @@
|
||||
import { InscripcionDSC } from "src/inscripcion-dsc/entity/inscripcion_dsc.entity";
|
||||
import { Miembro } from "src/miembro/entity/miembro.entity";
|
||||
import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
|
||||
|
||||
import { InscripcionDSC } from 'src/inscripcion-dsc/entity/inscripcion_dsc.entity';
|
||||
import { Miembro } from 'src/miembro/entity/miembro.entity';
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class InscripcionUsuario {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_inscripcion_usuario: number
|
||||
@PrimaryGeneratedColumn()
|
||||
id_inscripcion_usuario: number;
|
||||
|
||||
@Column({nullable: false})
|
||||
id_miembro: number
|
||||
@Column({ nullable: false })
|
||||
id_miembro: number;
|
||||
|
||||
@Column({nullable: false})
|
||||
id_inscripcion: number
|
||||
@Column({ nullable: false })
|
||||
id_inscripcion: number;
|
||||
|
||||
@ManyToOne(
|
||||
() => InscripcionDSC, (inscripcionDsc) => inscripcionDsc.inscripcionUsuario
|
||||
)
|
||||
@JoinColumn({name: "id_inscripcion"})
|
||||
inscripcionDsc: InscripcionDSC
|
||||
@ManyToOne(
|
||||
() => InscripcionDSC,
|
||||
(inscripcionDsc) => inscripcionDsc.inscripcionUsuario,
|
||||
)
|
||||
@JoinColumn({ name: 'id_inscripcion' })
|
||||
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({
|
||||
controllers: [InscripcionUsuarioController],
|
||||
providers: [InscripcionUsuarioService]
|
||||
providers: [InscripcionUsuarioService],
|
||||
})
|
||||
export class InscripcionUsuarioModule {}
|
||||
|
||||
@@ -20,7 +20,6 @@ async function bootstrap() {
|
||||
prefix: '/public/',
|
||||
});
|
||||
|
||||
|
||||
app.enableCors();
|
||||
await app.listen(AppModule.port);
|
||||
|
||||
|
||||
@@ -1,26 +1,30 @@
|
||||
import { Contacto } from "src/contacto/entity/contacto.entity";
|
||||
import { Miembro } from "src/miembro/entity/miembro.entity";
|
||||
import { Column, Entity, JoinColumn, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { Contacto } from 'src/contacto/entity/contacto.entity';
|
||||
import { Miembro } from 'src/miembro/entity/miembro.entity';
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
OneToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class MiembroContacto {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_miembro_contacto: number
|
||||
@PrimaryGeneratedColumn()
|
||||
id_miembro_contacto: number;
|
||||
|
||||
@Column()
|
||||
id_miembro: number
|
||||
@Column()
|
||||
id_miembro: number;
|
||||
|
||||
@Column()
|
||||
id_contacto: number
|
||||
@Column()
|
||||
id_contacto: number;
|
||||
|
||||
/* @OneToMany(
|
||||
/* @OneToMany(
|
||||
() => Miembro, (miembro) => miembro.miembroContacto
|
||||
)
|
||||
miembro: Miembro[] */
|
||||
|
||||
@OneToMany(
|
||||
() => Contacto, (contacto) => contacto.miembroContacto
|
||||
)
|
||||
@JoinColumn({name: "id_contacto"})
|
||||
contacto: Contacto
|
||||
}
|
||||
@OneToMany(() => Contacto, (contacto) => contacto.miembroContacto)
|
||||
@JoinColumn({ name: 'id_contacto' })
|
||||
contacto: Contacto;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@ describe('MiembroContactoController', () => {
|
||||
controllers: [MiembroContactoController],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<MiembroContactoController>(MiembroContactoController);
|
||||
controller = module.get<MiembroContactoController>(
|
||||
MiembroContactoController,
|
||||
);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
|
||||
@@ -4,6 +4,6 @@ import { MiembroContactoService } from './miembro-contacto.service';
|
||||
|
||||
@Module({
|
||||
controllers: [MiembroContactoController],
|
||||
providers: [MiembroContactoService]
|
||||
providers: [MiembroContactoService],
|
||||
})
|
||||
export class MiembroContactoModule {}
|
||||
|
||||
@@ -1,26 +1,29 @@
|
||||
import { Miembro } from "src/miembro/entity/miembro.entity";
|
||||
import { Proyecto } from "src/proyecto/entity/proyecto.entity";
|
||||
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { Miembro } from 'src/miembro/entity/miembro.entity';
|
||||
import { Proyecto } from 'src/proyecto/entity/proyecto.entity';
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class MiembroProyecto {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_miembro_proyecto: number
|
||||
@PrimaryGeneratedColumn()
|
||||
id_miembro_proyecto: number;
|
||||
|
||||
@Column()
|
||||
id_proyecto: number
|
||||
@Column()
|
||||
id_proyecto: number;
|
||||
|
||||
@Column()
|
||||
id_miembro: number
|
||||
@Column()
|
||||
id_miembro: number;
|
||||
|
||||
@ManyToOne(
|
||||
() => Miembro, (miembro) => miembro.miembroProyecto
|
||||
)
|
||||
@JoinColumn({name: "id_miembro"})
|
||||
miembro: Miembro[]
|
||||
@ManyToOne(() => Miembro, (miembro) => miembro.miembroProyecto)
|
||||
@JoinColumn({ name: 'id_miembro' })
|
||||
miembro: Miembro[];
|
||||
|
||||
@OneToMany(
|
||||
() => Proyecto, (proyecto) => proyecto.miembroProyecto
|
||||
)
|
||||
proyecto: Proyecto[]
|
||||
}
|
||||
@OneToMany(() => Proyecto, (proyecto) => proyecto.miembroProyecto)
|
||||
proyecto: Proyecto[];
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@ describe('MiembroProyectoController', () => {
|
||||
controllers: [MiembroProyectoController],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<MiembroProyectoController>(MiembroProyectoController);
|
||||
controller = module.get<MiembroProyectoController>(
|
||||
MiembroProyectoController,
|
||||
);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
|
||||
@@ -4,6 +4,6 @@ import { MiembroProyectoService } from './miembro-proyecto.service';
|
||||
|
||||
@Module({
|
||||
controllers: [MiembroProyectoController],
|
||||
providers: [MiembroProyectoService]
|
||||
providers: [MiembroProyectoService],
|
||||
})
|
||||
export class MiembroProyectoModule {}
|
||||
|
||||
@@ -31,20 +31,20 @@ export class Miembro {
|
||||
@Column({ nullable: false })
|
||||
id_tipo_miembro: number;
|
||||
|
||||
@Column({length: 40, nullable: false })
|
||||
@Column({ length: 40, nullable: false })
|
||||
@IsEmail()
|
||||
email: string;
|
||||
|
||||
@Column({length: 180, nullable: false })
|
||||
@Column({ length: 180, nullable: false })
|
||||
password: string;
|
||||
|
||||
@Column({ length: 200, nullable:true})
|
||||
@Column({ length: 200, nullable: true })
|
||||
descripcion: string;
|
||||
|
||||
@Column({nullable: true})
|
||||
@Column({ nullable: true })
|
||||
id_carrera: number;
|
||||
|
||||
@Column({ length: 40, nullable:true})
|
||||
@Column({ length: 40, nullable: true })
|
||||
semestre: string;
|
||||
|
||||
@Column({ nullable: false })
|
||||
@@ -64,19 +64,18 @@ export class Miembro {
|
||||
@JoinColumn({ name: 'id_carrera' })
|
||||
carrera: Carrera;
|
||||
|
||||
/* @ManyToOne(
|
||||
/* @ManyToOne(
|
||||
() => MiembroContacto, (miembroContacto) => miembroContacto.miembro
|
||||
)
|
||||
@JoinColumn({name: "id_miembro"})
|
||||
miembroContacto: MiembroContacto */
|
||||
|
||||
@OneToMany(
|
||||
() => MiembroProyecto, (miembroProyecto) => miembroProyecto.miembro
|
||||
() => MiembroProyecto,
|
||||
(miembroProyecto) => miembroProyecto.miembro,
|
||||
)
|
||||
miembroProyecto: MiembroProyecto
|
||||
miembroProyecto: MiembroProyecto;
|
||||
|
||||
@OneToMany(
|
||||
() => EquipoMiembro, (equipoMiembro) => equipoMiembro.miembro
|
||||
)
|
||||
equipoMiembro: EquipoMiembro
|
||||
@OneToMany(() => EquipoMiembro, (equipoMiembro) => equipoMiembro.miembro)
|
||||
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 { Miembro } from './entity/miembro.entity';
|
||||
import { MiembroService } from './miembro.service';
|
||||
|
||||
@Controller('miembro')
|
||||
export class MiembroController {
|
||||
constructor(private readonly miembroService: MiembroService) {}
|
||||
|
||||
constructor(private readonly miembroService: MiembroService){}
|
||||
@Get()
|
||||
getUsuarios(): Promise<Miembro[]> {
|
||||
return this.miembroService.getUsuarios();
|
||||
}
|
||||
|
||||
@Get()
|
||||
getUsuarios(): Promise<Miembro[]>{
|
||||
return this.miembroService.getUsuarios()
|
||||
}
|
||||
@Get(':tipo')
|
||||
getMiembros(@Param('tipo', ParseIntPipe) tipo: number): Promise<Miembro[]> {
|
||||
return this.miembroService.getMiembros(tipo);
|
||||
}
|
||||
|
||||
@Get(':tipo')
|
||||
getMiembros(@Param('tipo', ParseIntPipe)tipo: number): Promise<Miembro[]>{
|
||||
return this.miembroService.getMiembros(tipo)
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
deleteMiembro(@Param('id', ParseIntPipe)id: number){
|
||||
return this.miembroService.deleteMiembro(id)
|
||||
}
|
||||
@Delete(':id')
|
||||
deleteMiembro(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.miembroService.deleteMiembro(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import { MiembroController } from './miembro.controller';
|
||||
import { MiembroService } from './miembro.service';
|
||||
|
||||
@Module({
|
||||
imports:[TypeOrmModule.forFeature([Miembro])],
|
||||
imports: [TypeOrmModule.forFeature([Miembro])],
|
||||
controllers: [MiembroController],
|
||||
providers: [MiembroService]
|
||||
providers: [MiembroService],
|
||||
})
|
||||
export class MiembroModule {}
|
||||
|
||||
@@ -5,31 +5,31 @@ import { Miembro } from './entity/miembro.entity';
|
||||
|
||||
@Injectable()
|
||||
export class MiembroService {
|
||||
constructor(
|
||||
@InjectRepository(Miembro) private miembroRepository: Repository<Miembro>,
|
||||
) {}
|
||||
|
||||
getUsuarios(){
|
||||
return this.miembroRepository.find()
|
||||
}
|
||||
|
||||
getUsuario(email: string) {
|
||||
return this.miembroRepository.findOne({
|
||||
where: {
|
||||
email,
|
||||
},
|
||||
});
|
||||
}
|
||||
constructor(
|
||||
@InjectRepository(Miembro) private miembroRepository: Repository<Miembro>,
|
||||
) {}
|
||||
|
||||
getMiembros(tipo: number){
|
||||
return this.miembroRepository.find({
|
||||
where:{
|
||||
id_tipo_miembro: tipo
|
||||
}
|
||||
})
|
||||
}
|
||||
getUsuarios() {
|
||||
return this.miembroRepository.find();
|
||||
}
|
||||
|
||||
deleteMiembro(id: number){
|
||||
return this.miembroRepository.delete({id_miembro: id})
|
||||
}
|
||||
getUsuario(email: string) {
|
||||
return this.miembroRepository.findOne({
|
||||
where: {
|
||||
email,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
getMiembros(tipo: number) {
|
||||
return this.miembroRepository.find({
|
||||
where: {
|
||||
id_tipo_miembro: tipo,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
deleteMiembro(id: number) {
|
||||
return this.miembroRepository.delete({ id_miembro: id });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@ import { Participante } from './participante.entity';
|
||||
|
||||
@Controller('participante')
|
||||
export class ParticipanteController {
|
||||
constructor(private participanteService: ParticipanteService) {}
|
||||
constructor(private participanteService: ParticipanteService) {}
|
||||
|
||||
@Get()
|
||||
getParticipantes(): Promise<Participante[]> {
|
||||
return this.participanteService.getParticipantes();
|
||||
}
|
||||
@Get()
|
||||
getParticipantes(): Promise<Participante[]> {
|
||||
return this.participanteService.getParticipantes();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,16 +21,16 @@ export class Participante {
|
||||
@Column({ nullable: false, length: 40 })
|
||||
email: string;
|
||||
|
||||
@Column({ nullable: true, length: 180}) //
|
||||
@Column({ nullable: true, length: 180 }) //
|
||||
password: string;
|
||||
|
||||
@Column({length:20, nullable: true }) //
|
||||
@Column({ length: 20, nullable: true }) //
|
||||
tipo: string;
|
||||
|
||||
@Column({ nullable: true, length: 50})
|
||||
@Column({ nullable: true, length: 50 })
|
||||
institucion_procedencia: string;
|
||||
|
||||
@Column({ nullable: true, length:50})
|
||||
@Column({ nullable: true, length: 50 })
|
||||
carrera: string;
|
||||
|
||||
@OneToMany(
|
||||
|
||||
@@ -5,8 +5,8 @@ import { Participante } from './participante.entity';
|
||||
import { ParticipanteService } from './participante.service';
|
||||
|
||||
@Module({
|
||||
imports:[TypeOrmModule.forFeature([Participante])],
|
||||
controllers:[ParticipanteController],
|
||||
providers: [ParticipanteService]
|
||||
imports: [TypeOrmModule.forFeature([Participante])],
|
||||
controllers: [ParticipanteController],
|
||||
providers: [ParticipanteService],
|
||||
})
|
||||
export class ParticipanteModule {}
|
||||
|
||||
@@ -19,7 +19,9 @@ export class ParticipanteService {
|
||||
return this.participanteRepository.findOne({ where: { email } });
|
||||
}
|
||||
|
||||
async registrarParticipante(registrarParticipanteDto: RegistrarParticipanteDto) {
|
||||
async registrarParticipante(
|
||||
registrarParticipanteDto: RegistrarParticipanteDto,
|
||||
) {
|
||||
return this.participanteExiste(registrarParticipanteDto.email).then(
|
||||
(participante) => {
|
||||
if (participante) {
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
import { InscripcionDSC } from "src/inscripcion-dsc/entity/inscripcion_dsc.entity";
|
||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||
|
||||
import { InscripcionDSC } from 'src/inscripcion-dsc/entity/inscripcion_dsc.entity';
|
||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class Periodo {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_periodo: number
|
||||
|
||||
@Column()
|
||||
activo: number
|
||||
@PrimaryGeneratedColumn()
|
||||
id_periodo: number;
|
||||
|
||||
@OneToMany(
|
||||
() => InscripcionDSC, (inscripcionDsc) => inscripcionDsc.periodo
|
||||
)
|
||||
inscripcionDsc: InscripcionDSC[]
|
||||
}
|
||||
@Column()
|
||||
activo: number;
|
||||
|
||||
@OneToMany(() => InscripcionDSC, (inscripcionDsc) => inscripcionDsc.periodo)
|
||||
inscripcionDsc: InscripcionDSC[];
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ import { PeriodoService } from './periodo.service';
|
||||
|
||||
@Module({
|
||||
controllers: [PeriodoController],
|
||||
providers: [PeriodoService]
|
||||
providers: [PeriodoService],
|
||||
})
|
||||
export class PeriodoModule {}
|
||||
|
||||
@@ -9,7 +9,9 @@ describe('ProyectoActividadController', () => {
|
||||
controllers: [ProyectoActividadController],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<ProyectoActividadController>(ProyectoActividadController);
|
||||
controller = module.get<ProyectoActividadController>(
|
||||
ProyectoActividadController,
|
||||
);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
|
||||
@@ -4,6 +4,6 @@ import { ProyectoActividadService } from './proyecto-actividad.service';
|
||||
|
||||
@Module({
|
||||
controllers: [ProyectoActividadController],
|
||||
providers: [ProyectoActividadService]
|
||||
providers: [ProyectoActividadService],
|
||||
})
|
||||
export class ProyectoActividadModule {}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import { MiembroProyecto } from 'src/miembro-proyecto/entity/miembro_proyecto.entity';
|
||||
import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class Proyecto {
|
||||
@@ -22,8 +28,9 @@ export class Proyecto {
|
||||
descripcion: string;
|
||||
|
||||
@ManyToOne(
|
||||
() => MiembroProyecto, (miembroProyecto) => miembroProyecto.proyecto
|
||||
() => MiembroProyecto,
|
||||
(miembroProyecto) => miembroProyecto.proyecto,
|
||||
)
|
||||
@JoinColumn({name: "id_proyecto"})
|
||||
miembroProyecto: MiembroProyecto
|
||||
@JoinColumn({ name: 'id_proyecto' })
|
||||
miembroProyecto: MiembroProyecto;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ import { ProyectoService } from './proyecto.service';
|
||||
|
||||
@Module({
|
||||
controllers: [ProyectoController],
|
||||
providers: [ProyectoService]
|
||||
providers: [ProyectoService],
|
||||
})
|
||||
export class ProyectoModule {}
|
||||
|
||||
+31
-26
@@ -1,40 +1,45 @@
|
||||
import { Body, Controller, InternalServerErrorException, Post } from '@nestjs/common';
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
InternalServerErrorException,
|
||||
Post,
|
||||
} from '@nestjs/common';
|
||||
|
||||
@Controller('tyl')
|
||||
export class TylController {
|
||||
@Post('')
|
||||
async enviarTyl(@Body() body: { email: string }) {
|
||||
@Post('')
|
||||
async enviarTyl(@Body() body: { email: string }) {
|
||||
try {
|
||||
const user = 'acatlan'
|
||||
const api = 'LW2rtatYP8o2PhCkIqeJV94d6a60cSvTmJXPbRpP';
|
||||
const params = new URLSearchParams();
|
||||
params.append('user_name', user!);
|
||||
params.append('email', body.email);
|
||||
params.append('api_key', process.env.API_KEY!);
|
||||
const user = 'acatlan';
|
||||
const api = 'LW2rtatYP8o2PhCkIqeJV94d6a60cSvTmJXPbRpP';
|
||||
const params = new URLSearchParams();
|
||||
params.append('user_name', user!);
|
||||
params.append('email', body.email);
|
||||
params.append('api_key', process.env.API_KEY!);
|
||||
|
||||
const response = await fetch(
|
||||
const response = await fetch(
|
||||
'https://accede.estudio.app/ventas-acatlan',
|
||||
{
|
||||
method: 'POST',
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/x-www-form-urlencoded',
|
||||
// },
|
||||
body: params,
|
||||
redirect: 'manual',
|
||||
}
|
||||
);
|
||||
method: 'POST',
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/x-www-form-urlencoded',
|
||||
// },
|
||||
body: params,
|
||||
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)
|
||||
|
||||
return { redirectUrl };
|
||||
console.log('redirect', redirectUrl);
|
||||
|
||||
return { redirectUrl };
|
||||
} 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