feat: add TipoEvento entity and related functionality
- Introduced TipoEvento entity with enum for event types. - Created DTOs for creating and updating TipoEvento. - Implemented TipoEvento service with methods for CRUD operations and seeding initial data. - Added TipoEvento controller for handling HTTP requests related to event types. - Integrated TipoEvento into the main application module. - Updated Evento entity to include a relationship with TipoEvento. - Enhanced ParticipanteEvento service to register attendance using QR tokens. - Implemented QR token generation and validation for event attendance. - Updated API documentation for new endpoints and functionalities. - Adjusted TypeOrm configuration to include new entities.
This commit is contained in:
@@ -67,6 +67,7 @@ export class CuestionarioService {
|
||||
cuestionario.fecha_fin = new Date(createCuestionarioDto.fecha_fin);
|
||||
cuestionario.id_tipo_cuestionario =
|
||||
createCuestionarioDto.id_tipo_cuestionario;
|
||||
cuestionario.id_tipo_evento = createCuestionarioDto.id_tipo_evento;
|
||||
cuestionario.contador_secciones =
|
||||
createCuestionarioDto.secciones?.length || 0;
|
||||
cuestionario.editable = true;
|
||||
@@ -227,6 +228,7 @@ export class CuestionarioService {
|
||||
fecha_inicio: new Date(cuestionario.fecha_inicio),
|
||||
fecha_fin: new Date(cuestionario.fecha_fin),
|
||||
id_tipo_cuestionario: cuestionario.id_tipo_cuestionario,
|
||||
id_tipo_evento: cuestionario.id_tipo_evento,
|
||||
contador_secciones: cuestionario.secciones?.length || 0,
|
||||
editable: true,
|
||||
id_evento: eventoExistente.id_evento, // Asociar el evento creado
|
||||
|
||||
@@ -63,6 +63,14 @@ export class CreateCuestionarioDto {
|
||||
@IsNumber()
|
||||
id_tipo_cuestionario: number;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'ID del tipo de evento',
|
||||
example: 1,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
id_tipo_evento: number;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'Cupo máximo de participantes',
|
||||
example: 100,
|
||||
|
||||
@@ -11,6 +11,7 @@ import { Evento } from 'src/evento/entities/evento.entity';
|
||||
import { ParticipanteEvento } from 'src/participante_evento/entities/participante_evento.entity';
|
||||
import { TipoCuestionario } from 'src/tipo_cuestionario/entities/tipo_cuestionario.entity';
|
||||
import { CuestionarioRespondido } from 'src/cuestionario_respondido/entities/cuestionario_respondido.entity';
|
||||
import { TipoEvento } from 'src/tipo_evento/entities/tipo_evento.entity';
|
||||
|
||||
@Entity('cuestionario')
|
||||
export class Cuestionario {
|
||||
@@ -44,14 +45,13 @@ export class Cuestionario {
|
||||
@Column({ type: 'int' })
|
||||
id_tipo_cuestionario: number;
|
||||
|
||||
@Column({ type: 'int', nullable: true })
|
||||
id_tipo_evento: number;
|
||||
|
||||
@Column({ type: 'int' })
|
||||
id_evento: number;
|
||||
|
||||
// Relaciones
|
||||
@ManyToOne(() => Cuestionario, { nullable: true })
|
||||
@JoinColumn({ name: 'id_cuestionario_original' })
|
||||
cuestionarioOriginal?: Cuestionario;
|
||||
|
||||
@ManyToOne(() => Evento, (evento) => evento.cuestionarios, { nullable: true })
|
||||
@JoinColumn({ name: 'id_evento' })
|
||||
evento?: Evento;
|
||||
@@ -62,6 +62,12 @@ export class Cuestionario {
|
||||
@JoinColumn({ name: 'id_tipo_cuestionario' })
|
||||
tipoCuestionario: TipoCuestionario;
|
||||
|
||||
@ManyToOne(() => TipoEvento, (tipo) => tipo.cuestionarios, {
|
||||
eager: true,
|
||||
})
|
||||
@JoinColumn({ name: 'id_tipo_evento' })
|
||||
tipoEvento: TipoEvento;
|
||||
|
||||
@OneToMany(
|
||||
() => CuestionarioSeccion,
|
||||
(cuestionarioSeccion) => cuestionarioSeccion.cuestionario,
|
||||
|
||||
Reference in New Issue
Block a user