Se quito el orden en los banners
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 194 KiB |
+1
-1
@@ -75,7 +75,7 @@ import { Almacenamiento } from './almacenamiento/entity/almacenamiento.entity';
|
||||
username: configService.get('DB_USER'),
|
||||
password: configService.get('DB_PASSWORD'),
|
||||
database: configService.get('DB_NAME'),
|
||||
synchronize: true,
|
||||
synchronize: false,
|
||||
entities: [
|
||||
Evento,
|
||||
Participante,
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
Get,
|
||||
Param,
|
||||
ParseIntPipe,
|
||||
Patch,
|
||||
Post,
|
||||
Res,
|
||||
UploadedFile,
|
||||
@@ -48,6 +49,14 @@ export class CarruselController {
|
||||
return this.carruselService.addImagenToCarrusel(carruselDto, file.filename);
|
||||
}
|
||||
|
||||
@Patch('update/:id')
|
||||
updateImagenCarrusel(
|
||||
@Param('id', ParseIntPipe) id: number,
|
||||
@Body() carruselDto: carruselDto,
|
||||
) {
|
||||
return this.carruselService.updateImagenCarrusel(id, carruselDto);
|
||||
}
|
||||
|
||||
@Delete('delete/:id')
|
||||
deleteImagenByRuta(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.carruselService.deleteImagenByRuta(id);
|
||||
|
||||
@@ -60,6 +60,41 @@ export class CarruselService {
|
||||
});
|
||||
}
|
||||
}
|
||||
async updateImagenCarrusel(
|
||||
id: number,
|
||||
carruselDto: carruselDto,
|
||||
): Promise<{ message: string; carrusel: Carrusel }> {
|
||||
const carrusel = await this.carruselRepository.findOne({
|
||||
where: { id_imagen_carrusel: id },
|
||||
});
|
||||
|
||||
if (!carrusel) {
|
||||
throw new BadRequestException({
|
||||
message: `No se encontró una imagen de carrusel con el id ${id}`,
|
||||
});
|
||||
}
|
||||
|
||||
Object.assign(carrusel, carruselDto);
|
||||
|
||||
try {
|
||||
const carruselUpdated = await this.carruselRepository.save(carrusel);
|
||||
return {
|
||||
message: 'Imagen de carrusel actualizada correctamente',
|
||||
carrusel: carruselUpdated,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('❌ Error al actualizar carrusel en base de datos');
|
||||
console.table({
|
||||
code: error.code,
|
||||
message: error.message,
|
||||
});
|
||||
|
||||
throw new InternalServerErrorException({
|
||||
message: 'Ocurrió un error inesperado al actualizar la imagen',
|
||||
error: error.message,
|
||||
});
|
||||
}
|
||||
}
|
||||
async deleteImagenByRuta(id: number) {
|
||||
try {
|
||||
const res = await this.carruselRepository.findOne({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IsNotEmpty } from "class-validator";
|
||||
import { IsNotEmpty, IsOptional } from "class-validator";
|
||||
|
||||
export class carruselDto {
|
||||
@IsNotEmpty()
|
||||
@@ -6,4 +6,8 @@ export class carruselDto {
|
||||
|
||||
@IsNotEmpty()
|
||||
link: string
|
||||
|
||||
// @IsNotEmpty() valida que no sea nulo ni undefined ni cadena vacía
|
||||
// @IsOptional()
|
||||
// orden?: string
|
||||
}
|
||||
@@ -12,4 +12,8 @@ export class Carrusel {
|
||||
@Column({length: 150})
|
||||
link: string
|
||||
/* "https://www.acatlan.unam.mx/" */
|
||||
|
||||
// @Column({length: 20})
|
||||
// orden: string
|
||||
|
||||
}
|
||||
@@ -35,7 +35,7 @@ export class Evento {
|
||||
@Column({ nullable: false })
|
||||
cupo: number;
|
||||
|
||||
@Column({ length: 300, nullable: false })
|
||||
@Column({ length: 500, nullable: false })
|
||||
observaciones: string;
|
||||
|
||||
@Column({ type: 'decimal', precision: 7, scale: 2, nullable: true })
|
||||
@@ -47,7 +47,7 @@ export class Evento {
|
||||
@Column({ length: 40, nullable: true })
|
||||
tipo_acreditacion: string;
|
||||
|
||||
@Column({ length: 200, nullable: false })
|
||||
@Column({ length: 500, nullable: false })
|
||||
objetivo: string;
|
||||
|
||||
@Column({ nullable: false, type: 'datetime' })
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
Post,
|
||||
} from '@nestjs/common';
|
||||
import { InscripcionDscService } from './inscripcion-dsc.service';
|
||||
import { And } from 'typeorm';
|
||||
|
||||
@Controller('inscripcion-dsc')
|
||||
export class InscripcionDscController {
|
||||
@@ -34,7 +35,7 @@ console.log('Usuario verificacion', userVerification);
|
||||
|
||||
try{
|
||||
/* console.log("verificando confirmacion:", userInformation);
|
||||
*/ if (userInformation[0].confirmacion) {
|
||||
*/ if (userInformation[0].confirmacion && userInformation[1].confirmacion) {
|
||||
return {
|
||||
error: true,
|
||||
msj: 'El usuario ya hizo la confirmación anteriormente',
|
||||
|
||||
@@ -4,18 +4,21 @@ import { createConnection } from 'mysql2/promise';
|
||||
@Injectable()
|
||||
export class InscripcionDscService {
|
||||
async userVerification(accountNumber: string) {
|
||||
let connection;
|
||||
try {
|
||||
const connection = await createConnection({
|
||||
connection = await createConnection({
|
||||
host: process.env.DB_HOST_DSC,
|
||||
user: process.env.DB_USER_DSC,
|
||||
password: process.env.DB_PASS_DSC,
|
||||
database: process.env.DB_NAME_DSC,
|
||||
});
|
||||
|
||||
console.log('despues de la conecion a la base')
|
||||
|
||||
// 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)
|
||||
// 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)
|
||||
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`;
|
||||
|
||||
@@ -27,12 +30,17 @@ export class InscripcionDscService {
|
||||
const resultsArray = JSON.parse(JSON.stringify(results));
|
||||
if (resultsArray.length === 0) return null;
|
||||
/* console.log('The solution is: ', resultsArray); */
|
||||
console.log('The solution is: ', resultsArray);
|
||||
|
||||
console.log('Resultados', results)
|
||||
return results;
|
||||
} catch (error) {
|
||||
console.log('Entro al error', error)
|
||||
throw error;
|
||||
} finally {
|
||||
if (connection) {
|
||||
await connection.end();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user