diff --git a/.env b/.env index 17d9caa..c8879e3 100644 --- a/.env +++ b/.env @@ -1,16 +1,16 @@ PORT=5089 - DB_HOST=132.248.180.82 - DB_USER=user_cedetec - DB_PASSWORD=c3t3d3c - DB_NAME=Betelgeuse_Cedetec_Prueba - DB_PORT= +# DB_HOST=132.248.180.82 +# DB_USER=user_cedetec +# DB_PASSWORD=c3t3d3c +# DB_NAME=Betelgeuse_Cedetec_Prueba +# DB_PORT= -# DB_HOST=localhost -# DB_USER=root -# DB_PASSWORD=password -# DB_NAME=cedetec_proyectos -# DB_PORT= + DB_HOST=localhost + DB_USER=root + DB_PASSWORD=Dosmiluno2001 + DB_NAME=cedetec_proyectos + DB_PORT=3306 DB_HOST_DSC = 132.248.180.82 DB_USER_DSC = sites_user diff --git a/.gitignore b/.gitignore index ea48d65..0fade4f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.env # compiled output /dist /node_modules @@ -34,4 +35,3 @@ lerna-debug.log* !.vscode/launch.json !.vscode/extensions.json -.env \ No newline at end of file diff --git a/participantes-7.xlsx b/participantes-7.xlsx new file mode 100644 index 0000000..fb33d27 Binary files /dev/null and b/participantes-7.xlsx differ diff --git a/src/eventos/eventos.controller.ts b/src/eventos/eventos.controller.ts index 3580989..c58b340 100644 --- a/src/eventos/eventos.controller.ts +++ b/src/eventos/eventos.controller.ts @@ -54,4 +54,9 @@ export class EventosController { res.download(filePath); } + @Post('disponibles') + getEventosDisponibles (){ + return this.eventoService.getEventosDisponibles() + } + } diff --git a/src/eventos/eventos.service.ts b/src/eventos/eventos.service.ts index 8f0e075..ef40c0b 100644 --- a/src/eventos/eventos.service.ts +++ b/src/eventos/eventos.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { EventoParticipante } from 'src/evento-participante/evento-participante/eventoParticipante.entity'; import { Participante } from 'src/participante/participante.entity'; -import { Repository } from 'typeorm'; +import { MoreThanOrEqual, Repository } from 'typeorm'; import { actualizarEventoDto } from './dto/actualizarEvento.dto'; import { crearEventoDto } from './dto/crearEvento.dto'; import { Evento } from './evento.entity'; @@ -103,17 +103,6 @@ export class EventosService { const workbook = new ExcelJS.Workbook(); const worksheet = workbook.addWorksheet('Participantes'); - // Definir estilos - const headerStyle = { - font: { bold: true }, - alignment: { horizontal: 'center' }, - border: { bottom: { style: 'medium' } }, - }; - - const dataStyle = { - alignment: { horizontal: 'left' }, - }; - // Definir las columnas worksheet.columns = [ { header: 'Asistencia', key: 'asistencia', width: 10, style: {alignment: {horizontal: 'center'}}}, @@ -147,9 +136,18 @@ export class EventosService { // Generar el archivo Excel y guardarlo en el servidor const fileName = `participantes-${idEvento}.xlsx`; const filePath = `./${fileName}`; - await workbook.xlsx.writeFile(filePath); - +/* await workbook.xlsx.writeFile(filePath); + */ // Devolver la ruta del archivo para que el cliente pueda descargarlo return filePath; } + + getEventosDisponibles(){ + const hoy = new Date(); + return this.eventoRepository.find({ + where: { + fecha_fin: MoreThanOrEqual(hoy) + } + }) + } }