se agrego controller para traer solo eventos disponibles y no todos
This commit is contained in:
@@ -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
|
||||
|
||||
+1
-1
@@ -1,3 +1,4 @@
|
||||
.env
|
||||
# compiled output
|
||||
/dist
|
||||
/node_modules
|
||||
@@ -34,4 +35,3 @@ lerna-debug.log*
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
|
||||
.env
|
||||
Binary file not shown.
@@ -54,4 +54,9 @@ export class EventosController {
|
||||
res.download(filePath);
|
||||
}
|
||||
|
||||
@Post('disponibles')
|
||||
getEventosDisponibles (){
|
||||
return this.eventoService.getEventosDisponibles()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user