docker compose front, modulo de validacion de preguntas, crud de participante, get participantes por evento y evento por participantes
This commit is contained in:
@@ -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],
|
||||
|
||||
@@ -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[];
|
||||
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user