docker compose front, modulo de validacion de preguntas, crud de participante, get participantes por evento y evento por participantes

This commit is contained in:
Your Name
2025-04-04 14:39:04 -06:00
parent bc07c307cf
commit e5c6f611f4
24 changed files with 979 additions and 74 deletions
+10
View File
@@ -88,6 +88,16 @@ export class CreatePreguntaDto {
@IsNumber()
id_opcion_dependiente?: number;
@ApiProperty({
description: 'Tipo de validación para la respuesta',
required: false,
examples: ['cuenta_alumno', 'correo', 'telefono', 'nombre', 'entero', 'decimal'],
example: 'correo'
})
@IsOptional()
@IsString()
validacion?: string;
@ApiProperty({
description: 'Lista de opciones para preguntas de tipo Cerrada o Multiple',
type: [OpcionDto],
+3
View File
@@ -28,6 +28,9 @@ export class Pregunta {
@Column({ type: 'int', nullable: true })
id_opcion_dependiente?: number;
@Column({ nullable: true })
validacion?: string;
@OneToMany(() => SeccionPregunta, seccionPregunta => seccionPregunta.pregunta)
seccionPreguntas: SeccionPregunta[];
+14 -3
View File
@@ -28,6 +28,11 @@ export class PreguntaApiDocumentation {
},
contador_opcion: { type: 'number', example: 0 },
id_opcion_dependiente: { type: 'number', example: null },
validacion: {
type: 'string',
description: 'Tipo de validación para la respuesta (cuenta_alumno, correo, telefono, nombre, entero, decimal, etc)',
example: 'correo'
},
opciones: {
type: 'array',
items: {
@@ -46,6 +51,7 @@ export class PreguntaApiDocumentation {
titulo: '¿Eres parte de la comunidad de la FES Acatlán?',
obligatoria: true,
tipo: TipoPreguntaEnum.CERRADA,
validacion: null,
opciones: [
{ valor: 'Sí' },
{ valor: 'No' }
@@ -57,7 +63,8 @@ export class PreguntaApiDocumentation {
value: {
titulo: '¿Qué mejorarías en nuestro servicio?',
obligatoria: false,
tipo: TipoPreguntaEnum.ABIERTA
tipo: TipoPreguntaEnum.ABIERTA,
validacion: null
}
},
multiple: {
@@ -66,6 +73,7 @@ export class PreguntaApiDocumentation {
titulo: '¿Qué aspectos del servicio fueron de tu agrado?',
obligatoria: false,
tipo: TipoPreguntaEnum.MULTIPLE,
validacion: null,
opciones: [
{ valor: 'Rapidez' },
{ valor: 'Atención al cliente' },
@@ -86,7 +94,8 @@ export class PreguntaApiDocumentation {
obligatoria: { type: 'boolean', example: true },
contador_opcion: { type: 'number', example: 0 },
id_tipo_pregunta: { type: 'number', example: 1 },
id_opcion_dependiente: { type: 'number', example: null }
id_opcion_dependiente: { type: 'number', example: null },
validacion: { type: 'string', example: 'correo' }
}
}
}),
@@ -113,7 +122,8 @@ export class PreguntaApiDocumentation {
obligatoria: { type: 'boolean', example: true },
contador_opcion: { type: 'number', example: 0 },
id_tipo_pregunta: { type: 'number', example: 1 },
id_opcion_dependiente: { type: 'number', example: null }
id_opcion_dependiente: { type: 'number', example: null },
validacion: { type: 'string', example: 'correo' }
}
}
}
@@ -146,6 +156,7 @@ export class PreguntaApiDocumentation {
contador_opcion: { type: 'number', example: 0 },
id_tipo_pregunta: { type: 'number', example: 1 },
id_opcion_dependiente: { type: 'number', example: null },
validacion: { type: 'string', example: 'correo' },
opciones: {
type: 'array',
items: {
+2
View File
@@ -44,6 +44,7 @@ export class PreguntaService {
pregunta.id_tipo_pregunta = tipoPregunta.id_tipo;
pregunta.id_opcion_dependiente = createPreguntaDto.id_opcion_dependiente || undefined;
pregunta.contador_opcion = createPreguntaDto.opciones?.length || 0;
pregunta.validacion = createPreguntaDto.validacion || undefined;
const savedPregunta = await queryRunner.manager.save(pregunta);
@@ -158,6 +159,7 @@ export class PreguntaService {
if (updatePreguntaDto.titulo) pregunta.pregunta = updatePreguntaDto.titulo;
if (updatePreguntaDto.obligatoria !== undefined) pregunta.obligatoria = updatePreguntaDto.obligatoria;
if (updatePreguntaDto.id_opcion_dependiente !== undefined) pregunta.id_opcion_dependiente = updatePreguntaDto.id_opcion_dependiente;
if (updatePreguntaDto.validacion !== undefined) pregunta.validacion = updatePreguntaDto.validacion;
// Si se proporciona un nuevo tipo de pregunta, actualizarlo
if (updatePreguntaDto.tipo) {