diff --git a/package-lock.json b/package-lock.json index 0104327..d47efe7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,10 +10,12 @@ "license": "UNLICENSED", "dependencies": { "@nestjs/common": "^11.0.1", + "@nestjs/config": "^4.0.2", "@nestjs/core": "^11.0.1", "@nestjs/mapped-types": "*", "@nestjs/platform-express": "^11.0.1", "@nestjs/typeorm": "^11.0.0", + "class-validator": "^0.14.1", "reflect-metadata": "^0.2.2", "rxjs": "^7.8.1", "typeorm": "^0.3.21" @@ -2298,6 +2300,21 @@ } } }, + "node_modules/@nestjs/config": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@nestjs/config/-/config-4.0.2.tgz", + "integrity": "sha512-McMW6EXtpc8+CwTUwFdg6h7dYcBUpH5iUILCclAsa+MbCEvC9ZKu4dCHRlJqALuhjLw97pbQu62l4+wRwGeZqA==", + "license": "MIT", + "dependencies": { + "dotenv": "16.4.7", + "dotenv-expand": "12.0.1", + "lodash": "4.17.21" + }, + "peerDependencies": { + "@nestjs/common": "^10.0.0 || ^11.0.0", + "rxjs": "^7.1.0" + } + }, "node_modules/@nestjs/core": { "version": "11.0.12", "resolved": "https://registry.npmjs.org/@nestjs/core/-/core-11.0.12.tgz", @@ -3282,6 +3299,12 @@ "@types/superagent": "^8.1.0" } }, + "node_modules/@types/validator": { + "version": "13.12.3", + "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.12.3.tgz", + "integrity": "sha512-2ipwZ2NydGQJImne+FhNdhgRM37e9lCev99KnqkbFHd94Xn/mErARWI1RSLem1QA19ch5kOhzIZd7e8CA2FI8g==", + "license": "MIT" + }, "node_modules/@types/yargs": { "version": "17.0.33", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz", @@ -4723,6 +4746,17 @@ "dev": true, "license": "MIT" }, + "node_modules/class-validator": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/class-validator/-/class-validator-0.14.1.tgz", + "integrity": "sha512-2VEG9JICxIqTpoK1eMzZqaV+u/EiwEJkMGzTrZf6sU/fwsnOITVgYJ8yojSy6CaXtO9V0Cc6ZQZ8h8m4UBuLwQ==", + "license": "MIT", + "dependencies": { + "@types/validator": "^13.11.8", + "libphonenumber-js": "^1.10.53", + "validator": "^13.9.0" + } + }, "node_modules/cli-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", @@ -5286,6 +5320,21 @@ "url": "https://dotenvx.com" } }, + "node_modules/dotenv-expand": { + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-12.0.1.tgz", + "integrity": "sha512-LaKRbou8gt0RNID/9RoI+J2rvXsBRPMV7p+ElHlPhcSARbCPDYcYG2s1TIzAfWv4YSgyY5taidWzzs31lNV3yQ==", + "license": "BSD-2-Clause", + "dependencies": { + "dotenv": "^16.4.5" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -8000,6 +8049,12 @@ "node": ">= 0.8.0" } }, + "node_modules/libphonenumber-js": { + "version": "1.12.6", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.12.6.tgz", + "integrity": "sha512-PJiS4ETaUfCOFLpmtKzAbqZQjCCKVu2OhTV4SVNNE7c2nu/dACvtCqj4L0i/KWNnIgRv7yrILvBj5Lonv5Ncxw==", + "license": "MIT" + }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", @@ -8037,7 +8092,6 @@ "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true, "license": "MIT" }, "node_modules/lodash.memoize": { @@ -11136,6 +11190,15 @@ "node": ">=10.12.0" } }, + "node_modules/validator": { + "version": "13.15.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.15.0.tgz", + "integrity": "sha512-36B2ryl4+oL5QxZ3AzD0t5SsMNGvTtQHpjgFO5tbNxfXbMFkY822ktCDe1MnlqV3301QQI9SLHDNJokDI+Z9pA==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", diff --git a/package.json b/package.json index a6267fb..b3ae839 100644 --- a/package.json +++ b/package.json @@ -21,10 +21,12 @@ }, "dependencies": { "@nestjs/common": "^11.0.1", + "@nestjs/config": "^4.0.2", "@nestjs/core": "^11.0.1", "@nestjs/mapped-types": "*", "@nestjs/platform-express": "^11.0.1", "@nestjs/typeorm": "^11.0.0", + "class-validator": "^0.14.1", "reflect-metadata": "^0.2.2", "rxjs": "^7.8.1", "typeorm": "^0.3.21" diff --git a/src/app.module.ts b/src/app.module.ts index c5ed9b7..3d16193 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -10,9 +10,41 @@ import { PreguntaModule } from './pregunta/pregunta.module'; import { TipoPreguntaModule } from './tipo_pregunta/tipo_pregunta.module'; import { OpcionModule } from './opcion/opcion.module'; import { PreguntaOpcionModule } from './pregunta_opcion/pregunta_opcion.module'; +import { RespuestaParticipanteCerradaModule } from './respuesta_participante_cerrada/respuesta_participante_cerrada.module'; +import { CuestionarioRespondidoModule } from './cuestionario_respondido/cuestionario_respondido.module'; +import { RespuestaParticipanteAbiertaModule } from './respuesta_participante_abierta/respuesta_participante_abierta.module'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { ConfigModule } from '@nestjs/config'; + @Module({ - imports: [CuestionarioModule, TipoCuestionarioModule, CuestionarioSeccionModule, SeccionModule, SeccionPreguntaModule, PreguntaModule, TipoPreguntaModule, OpcionModule, PreguntaOpcionModule], + imports: [ + ConfigModule.forRoot(), + TypeOrmModule.forRoot({ + type: 'mysql', + host: process.env.db_host, + username: process.env.db_username, + database: process.env.db_database, + password: process.env.db_password, + port: Number(process.env.db_port), + synchronize: true, + dropSchema: true, // elimina la base de datos + // logging: true, // Habilita los logs para depuración + autoLoadEntities: true, // Carga automáticamente las entidades + + }), + CuestionarioModule, + TipoCuestionarioModule, + CuestionarioSeccionModule, + SeccionModule, + SeccionPreguntaModule, + PreguntaModule, + TipoPreguntaModule, + OpcionModule, PreguntaOpcionModule, + RespuestaParticipanteCerradaModule, + CuestionarioRespondidoModule, + RespuestaParticipanteAbiertaModule], + controllers: [AppController], providers: [AppService], }) diff --git a/src/cuestionario/entities/cuestionario.entity.ts b/src/cuestionario/entities/cuestionario.entity.ts index e69de29..f6add87 100644 --- a/src/cuestionario/entities/cuestionario.entity.ts +++ b/src/cuestionario/entities/cuestionario.entity.ts @@ -0,0 +1,44 @@ +import { CuestionarioSeccion } from 'src/cuestionario_seccion/entities/cuestionario_seccion.entity'; +import { TipoCuestionario } from 'src/tipo_cuestionario/entities/tipo_cuestionario.entity'; +import { Entity, PrimaryGeneratedColumn, Column, OneToMany, ManyToMany, ManyToOne } from 'typeorm'; + + + +@Entity('cuestionario') +export class Cuestionario { + @PrimaryGeneratedColumn() + id_cuestionario: number; + + @Column({ type: 'text' }) + nombre_form: string; + + @Column({ type: 'int' }) + contador_secciones: number; + + @Column({ type: 'text', nullable: true }) + descripcion: string; + + @Column({ type: 'boolean', default: true }) + editable: boolean; + + @Column({ type: 'datetime', nullable: true }) + fecha_fin: Date; + + @Column({ type: 'datetime', nullable: true }) + fecha_inicio: Date; + + + @OneToMany(() => CuestionarioSeccion,(cuestionario_seccion) => cuestionario_seccion.id_cuestionario) + cuestionarioSeccion:CuestionarioSeccion[] + + @OneToMany(()=> Cuestionario, (cuestionario) => cuestionario.id_cuestionario) + @Column({ type: 'int' }) + id_cuestionario_original: number; + + @OneToMany(()=> TipoCuestionario, (tipo_cuestionario) => tipo_cuestionario.id_tipo_cuestionario ) + @Column({ type: 'int' }) + id_tipo_cuestionario: number; + + @ManyToOne(()=> Cuestionario, (cuestionario) => cuestionario.id_cuestionario) + Cuestionario: Cuestionario[]; +} diff --git a/src/cuestionario_respondido/cuestionario_respondido.controller.spec.ts b/src/cuestionario_respondido/cuestionario_respondido.controller.spec.ts new file mode 100644 index 0000000..c96795c --- /dev/null +++ b/src/cuestionario_respondido/cuestionario_respondido.controller.spec.ts @@ -0,0 +1,20 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { CuestionarioRespondidoController } from './cuestionario_respondido.controller'; +import { CuestionarioRespondidoService } from './cuestionario_respondido.service'; + +describe('CuestionarioRespondidoController', () => { + let controller: CuestionarioRespondidoController; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + controllers: [CuestionarioRespondidoController], + providers: [CuestionarioRespondidoService], + }).compile(); + + controller = module.get(CuestionarioRespondidoController); + }); + + it('should be defined', () => { + expect(controller).toBeDefined(); + }); +}); diff --git a/src/cuestionario_respondido/cuestionario_respondido.controller.ts b/src/cuestionario_respondido/cuestionario_respondido.controller.ts new file mode 100644 index 0000000..654f88a --- /dev/null +++ b/src/cuestionario_respondido/cuestionario_respondido.controller.ts @@ -0,0 +1,34 @@ +import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common'; +import { CuestionarioRespondidoService } from './cuestionario_respondido.service'; +import { CreateCuestionarioRespondidoDto } from './dto/create-cuestionario_respondido.dto'; +import { UpdateCuestionarioRespondidoDto } from './dto/update-cuestionario_respondido.dto'; + +@Controller('cuestionario-respondido') +export class CuestionarioRespondidoController { + constructor(private readonly cuestionarioRespondidoService: CuestionarioRespondidoService) {} + + @Post() + create(@Body() createCuestionarioRespondidoDto: CreateCuestionarioRespondidoDto) { + return this.cuestionarioRespondidoService.create(createCuestionarioRespondidoDto); + } + + @Get() + findAll() { + return this.cuestionarioRespondidoService.findAll(); + } + + @Get(':id') + findOne(@Param('id') id: string) { + return this.cuestionarioRespondidoService.findOne(+id); + } + + @Patch(':id') + update(@Param('id') id: string, @Body() updateCuestionarioRespondidoDto: UpdateCuestionarioRespondidoDto) { + return this.cuestionarioRespondidoService.update(+id, updateCuestionarioRespondidoDto); + } + + @Delete(':id') + remove(@Param('id') id: string) { + return this.cuestionarioRespondidoService.remove(+id); + } +} diff --git a/src/cuestionario_respondido/cuestionario_respondido.module.ts b/src/cuestionario_respondido/cuestionario_respondido.module.ts new file mode 100644 index 0000000..49b24eb --- /dev/null +++ b/src/cuestionario_respondido/cuestionario_respondido.module.ts @@ -0,0 +1,9 @@ +import { Module } from '@nestjs/common'; +import { CuestionarioRespondidoService } from './cuestionario_respondido.service'; +import { CuestionarioRespondidoController } from './cuestionario_respondido.controller'; + +@Module({ + controllers: [CuestionarioRespondidoController], + providers: [CuestionarioRespondidoService], +}) +export class CuestionarioRespondidoModule {} diff --git a/src/cuestionario_respondido/cuestionario_respondido.service.spec.ts b/src/cuestionario_respondido/cuestionario_respondido.service.spec.ts new file mode 100644 index 0000000..477946b --- /dev/null +++ b/src/cuestionario_respondido/cuestionario_respondido.service.spec.ts @@ -0,0 +1,18 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { CuestionarioRespondidoService } from './cuestionario_respondido.service'; + +describe('CuestionarioRespondidoService', () => { + let service: CuestionarioRespondidoService; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [CuestionarioRespondidoService], + }).compile(); + + service = module.get(CuestionarioRespondidoService); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/src/cuestionario_respondido/cuestionario_respondido.service.ts b/src/cuestionario_respondido/cuestionario_respondido.service.ts new file mode 100644 index 0000000..ac9461c --- /dev/null +++ b/src/cuestionario_respondido/cuestionario_respondido.service.ts @@ -0,0 +1,26 @@ +import { Injectable } from '@nestjs/common'; +import { CreateCuestionarioRespondidoDto } from './dto/create-cuestionario_respondido.dto'; +import { UpdateCuestionarioRespondidoDto } from './dto/update-cuestionario_respondido.dto'; + +@Injectable() +export class CuestionarioRespondidoService { + create(createCuestionarioRespondidoDto: CreateCuestionarioRespondidoDto) { + return 'This action adds a new cuestionarioRespondido'; + } + + findAll() { + return `This action returns all cuestionarioRespondido`; + } + + findOne(id: number) { + return `This action returns a #${id} cuestionarioRespondido`; + } + + update(id: number, updateCuestionarioRespondidoDto: UpdateCuestionarioRespondidoDto) { + return `This action updates a #${id} cuestionarioRespondido`; + } + + remove(id: number) { + return `This action removes a #${id} cuestionarioRespondido`; + } +} diff --git a/src/cuestionario_respondido/dto/create-cuestionario_respondido.dto.ts b/src/cuestionario_respondido/dto/create-cuestionario_respondido.dto.ts new file mode 100644 index 0000000..bb6424f --- /dev/null +++ b/src/cuestionario_respondido/dto/create-cuestionario_respondido.dto.ts @@ -0,0 +1 @@ +export class CreateCuestionarioRespondidoDto {} diff --git a/src/cuestionario_respondido/dto/update-cuestionario_respondido.dto.ts b/src/cuestionario_respondido/dto/update-cuestionario_respondido.dto.ts new file mode 100644 index 0000000..378d244 --- /dev/null +++ b/src/cuestionario_respondido/dto/update-cuestionario_respondido.dto.ts @@ -0,0 +1,4 @@ +import { PartialType } from '@nestjs/mapped-types'; +import { CreateCuestionarioRespondidoDto } from './create-cuestionario_respondido.dto'; + +export class UpdateCuestionarioRespondidoDto extends PartialType(CreateCuestionarioRespondidoDto) {} diff --git a/src/cuestionario_respondido/entities/cuestionario_respondido.entity.ts b/src/cuestionario_respondido/entities/cuestionario_respondido.entity.ts new file mode 100644 index 0000000..85611b0 --- /dev/null +++ b/src/cuestionario_respondido/entities/cuestionario_respondido.entity.ts @@ -0,0 +1 @@ +export class CuestionarioRespondido {} diff --git a/src/cuestionario_seccion/entities/cuestionario_seccion.entity.ts b/src/cuestionario_seccion/entities/cuestionario_seccion.entity.ts index cea5033..7bd9b70 100644 --- a/src/cuestionario_seccion/entities/cuestionario_seccion.entity.ts +++ b/src/cuestionario_seccion/entities/cuestionario_seccion.entity.ts @@ -1 +1,21 @@ -export class CuestionarioSeccion {} +import { Entity, PrimaryGeneratedColumn, Column, ManyToOne } from 'typeorm'; +import { Cuestionario } from '../../cuestionario/entities/cuestionario.entity'; // Asegúrate de importar la entidad Cuestionario +import { Seccion } from 'src/seccion/entities/seccion.entity'; + +@Entity('cuestionario_seccion') +export class CuestionarioSeccion { + @PrimaryGeneratedColumn() + id_cuestionario_seccion: number; + + @Column({ type: 'tinyint' }) + posicion: number; + + + @ManyToOne(() => Cuestionario, (cuestionario) => cuestionario.id_cuestionario) + @Column({ type: 'int' }) + id_cuestionario: number; + + @ManyToOne(() => Seccion, (seccion) => seccion.id_seccion) + @Column({type:'int'}) + id_seccion:number; +} diff --git a/src/opcion/dto/create-opcion.dto.ts b/src/opcion/dto/create-opcion.dto.ts index e9b256d..69957f1 100644 --- a/src/opcion/dto/create-opcion.dto.ts +++ b/src/opcion/dto/create-opcion.dto.ts @@ -1 +1,11 @@ -export class CreateOpcionDto {} +import { IsString, MaxLength } from "class-validator"; + +export class CreateOpcionDto { + + + @IsString() + @MaxLength(50) + opcion: string; + + +} diff --git a/src/opcion/entities/opcion.entity.ts b/src/opcion/entities/opcion.entity.ts index e69de29..9b7a1fc 100644 --- a/src/opcion/entities/opcion.entity.ts +++ b/src/opcion/entities/opcion.entity.ts @@ -0,0 +1,15 @@ +import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm"; + +@Entity() +export class Opcion { + @PrimaryGeneratedColumn() + id_opcion: number; + + @Column({ type: String, nullable: false, length: 200, default: '' }) + opcion: string; + + @OneToMany(() => PreguntaOpcion, (preguntaOpcion) => preguntaOpcion.Opcion) + Preguntas: PreguntaOpcion[]; + + +} \ No newline at end of file diff --git a/src/opcion/opcion.service.ts b/src/opcion/opcion.service.ts index 8335797..9c44854 100644 --- a/src/opcion/opcion.service.ts +++ b/src/opcion/opcion.service.ts @@ -1,11 +1,21 @@ import { Injectable } from '@nestjs/common'; import { CreateOpcionDto } from './dto/create-opcion.dto'; import { UpdateOpcionDto } from './dto/update-opcion.dto'; +import { Opcion } from './entities/opcion.entity'; +import { InjectRepository } from '@nestjs/typeorm'; +import { Repository } from 'typeorm'; @Injectable() export class OpcionService { - create(createOpcionDto: CreateOpcionDto) { - return 'This action adds a new opcion'; + constructor( + @InjectRepository(Opcion) + private repository: Repository, + ){} + + + + create():Promise { + return this.repository.save(this.repository.create()); } findAll() { diff --git a/src/respuesta_participante_abierta/dto/create-respuesta_participante_abierta.dto.ts b/src/respuesta_participante_abierta/dto/create-respuesta_participante_abierta.dto.ts new file mode 100644 index 0000000..f1c195d --- /dev/null +++ b/src/respuesta_participante_abierta/dto/create-respuesta_participante_abierta.dto.ts @@ -0,0 +1 @@ +export class CreateRespuestaParticipanteAbiertaDto {} diff --git a/src/respuesta_participante_abierta/dto/update-respuesta_participante_abierta.dto.ts b/src/respuesta_participante_abierta/dto/update-respuesta_participante_abierta.dto.ts new file mode 100644 index 0000000..98efe06 --- /dev/null +++ b/src/respuesta_participante_abierta/dto/update-respuesta_participante_abierta.dto.ts @@ -0,0 +1,4 @@ +import { PartialType } from '@nestjs/mapped-types'; +import { CreateRespuestaParticipanteAbiertaDto } from './create-respuesta_participante_abierta.dto'; + +export class UpdateRespuestaParticipanteAbiertaDto extends PartialType(CreateRespuestaParticipanteAbiertaDto) {} diff --git a/src/respuesta_participante_abierta/entities/respuesta_participante_abierta.entity.ts b/src/respuesta_participante_abierta/entities/respuesta_participante_abierta.entity.ts new file mode 100644 index 0000000..f35032c --- /dev/null +++ b/src/respuesta_participante_abierta/entities/respuesta_participante_abierta.entity.ts @@ -0,0 +1 @@ +export class RespuestaParticipanteAbierta {} diff --git a/src/respuesta_participante_abierta/respuesta_participante_abierta.controller.spec.ts b/src/respuesta_participante_abierta/respuesta_participante_abierta.controller.spec.ts new file mode 100644 index 0000000..931601e --- /dev/null +++ b/src/respuesta_participante_abierta/respuesta_participante_abierta.controller.spec.ts @@ -0,0 +1,20 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { RespuestaParticipanteAbiertaController } from './respuesta_participante_abierta.controller'; +import { RespuestaParticipanteAbiertaService } from './respuesta_participante_abierta.service'; + +describe('RespuestaParticipanteAbiertaController', () => { + let controller: RespuestaParticipanteAbiertaController; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + controllers: [RespuestaParticipanteAbiertaController], + providers: [RespuestaParticipanteAbiertaService], + }).compile(); + + controller = module.get(RespuestaParticipanteAbiertaController); + }); + + it('should be defined', () => { + expect(controller).toBeDefined(); + }); +}); diff --git a/src/respuesta_participante_abierta/respuesta_participante_abierta.controller.ts b/src/respuesta_participante_abierta/respuesta_participante_abierta.controller.ts new file mode 100644 index 0000000..141459e --- /dev/null +++ b/src/respuesta_participante_abierta/respuesta_participante_abierta.controller.ts @@ -0,0 +1,34 @@ +import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common'; +import { RespuestaParticipanteAbiertaService } from './respuesta_participante_abierta.service'; +import { CreateRespuestaParticipanteAbiertaDto } from './dto/create-respuesta_participante_abierta.dto'; +import { UpdateRespuestaParticipanteAbiertaDto } from './dto/update-respuesta_participante_abierta.dto'; + +@Controller('respuesta-participante-abierta') +export class RespuestaParticipanteAbiertaController { + constructor(private readonly respuestaParticipanteAbiertaService: RespuestaParticipanteAbiertaService) {} + + @Post() + create(@Body() createRespuestaParticipanteAbiertaDto: CreateRespuestaParticipanteAbiertaDto) { + return this.respuestaParticipanteAbiertaService.create(createRespuestaParticipanteAbiertaDto); + } + + @Get() + findAll() { + return this.respuestaParticipanteAbiertaService.findAll(); + } + + @Get(':id') + findOne(@Param('id') id: string) { + return this.respuestaParticipanteAbiertaService.findOne(+id); + } + + @Patch(':id') + update(@Param('id') id: string, @Body() updateRespuestaParticipanteAbiertaDto: UpdateRespuestaParticipanteAbiertaDto) { + return this.respuestaParticipanteAbiertaService.update(+id, updateRespuestaParticipanteAbiertaDto); + } + + @Delete(':id') + remove(@Param('id') id: string) { + return this.respuestaParticipanteAbiertaService.remove(+id); + } +} diff --git a/src/respuesta_participante_abierta/respuesta_participante_abierta.module.ts b/src/respuesta_participante_abierta/respuesta_participante_abierta.module.ts new file mode 100644 index 0000000..125f0d5 --- /dev/null +++ b/src/respuesta_participante_abierta/respuesta_participante_abierta.module.ts @@ -0,0 +1,9 @@ +import { Module } from '@nestjs/common'; +import { RespuestaParticipanteAbiertaService } from './respuesta_participante_abierta.service'; +import { RespuestaParticipanteAbiertaController } from './respuesta_participante_abierta.controller'; + +@Module({ + controllers: [RespuestaParticipanteAbiertaController], + providers: [RespuestaParticipanteAbiertaService], +}) +export class RespuestaParticipanteAbiertaModule {} diff --git a/src/respuesta_participante_abierta/respuesta_participante_abierta.service.spec.ts b/src/respuesta_participante_abierta/respuesta_participante_abierta.service.spec.ts new file mode 100644 index 0000000..92be7e0 --- /dev/null +++ b/src/respuesta_participante_abierta/respuesta_participante_abierta.service.spec.ts @@ -0,0 +1,18 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { RespuestaParticipanteAbiertaService } from './respuesta_participante_abierta.service'; + +describe('RespuestaParticipanteAbiertaService', () => { + let service: RespuestaParticipanteAbiertaService; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [RespuestaParticipanteAbiertaService], + }).compile(); + + service = module.get(RespuestaParticipanteAbiertaService); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/src/respuesta_participante_abierta/respuesta_participante_abierta.service.ts b/src/respuesta_participante_abierta/respuesta_participante_abierta.service.ts new file mode 100644 index 0000000..7cf4fc8 --- /dev/null +++ b/src/respuesta_participante_abierta/respuesta_participante_abierta.service.ts @@ -0,0 +1,26 @@ +import { Injectable } from '@nestjs/common'; +import { CreateRespuestaParticipanteAbiertaDto } from './dto/create-respuesta_participante_abierta.dto'; +import { UpdateRespuestaParticipanteAbiertaDto } from './dto/update-respuesta_participante_abierta.dto'; + +@Injectable() +export class RespuestaParticipanteAbiertaService { + create(createRespuestaParticipanteAbiertaDto: CreateRespuestaParticipanteAbiertaDto) { + return 'This action adds a new respuestaParticipanteAbierta'; + } + + findAll() { + return `This action returns all respuestaParticipanteAbierta`; + } + + findOne(id: number) { + return `This action returns a #${id} respuestaParticipanteAbierta`; + } + + update(id: number, updateRespuestaParticipanteAbiertaDto: UpdateRespuestaParticipanteAbiertaDto) { + return `This action updates a #${id} respuestaParticipanteAbierta`; + } + + remove(id: number) { + return `This action removes a #${id} respuestaParticipanteAbierta`; + } +} diff --git a/src/respuesta_participante_cerrada/dto/create-respuesta_participante_cerrada.dto.ts b/src/respuesta_participante_cerrada/dto/create-respuesta_participante_cerrada.dto.ts new file mode 100644 index 0000000..90223d6 --- /dev/null +++ b/src/respuesta_participante_cerrada/dto/create-respuesta_participante_cerrada.dto.ts @@ -0,0 +1 @@ +export class CreateRespuestaParticipanteCerradaDto {} diff --git a/src/respuesta_participante_cerrada/dto/update-respuesta_participante_cerrada.dto.ts b/src/respuesta_participante_cerrada/dto/update-respuesta_participante_cerrada.dto.ts new file mode 100644 index 0000000..3a74a72 --- /dev/null +++ b/src/respuesta_participante_cerrada/dto/update-respuesta_participante_cerrada.dto.ts @@ -0,0 +1,4 @@ +import { PartialType } from '@nestjs/mapped-types'; +import { CreateRespuestaParticipanteCerradaDto } from './create-respuesta_participante_cerrada.dto'; + +export class UpdateRespuestaParticipanteCerradaDto extends PartialType(CreateRespuestaParticipanteCerradaDto) {} diff --git a/src/respuesta_participante_cerrada/entities/respuesta_participante_cerrada.entity.ts b/src/respuesta_participante_cerrada/entities/respuesta_participante_cerrada.entity.ts new file mode 100644 index 0000000..1c60109 --- /dev/null +++ b/src/respuesta_participante_cerrada/entities/respuesta_participante_cerrada.entity.ts @@ -0,0 +1 @@ +export class RespuestaParticipanteCerrada {} diff --git a/src/respuesta_participante_cerrada/respuesta_participante_cerrada.controller.spec.ts b/src/respuesta_participante_cerrada/respuesta_participante_cerrada.controller.spec.ts new file mode 100644 index 0000000..258f135 --- /dev/null +++ b/src/respuesta_participante_cerrada/respuesta_participante_cerrada.controller.spec.ts @@ -0,0 +1,20 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { RespuestaParticipanteCerradaController } from './respuesta_participante_cerrada.controller'; +import { RespuestaParticipanteCerradaService } from './respuesta_participante_cerrada.service'; + +describe('RespuestaParticipanteCerradaController', () => { + let controller: RespuestaParticipanteCerradaController; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + controllers: [RespuestaParticipanteCerradaController], + providers: [RespuestaParticipanteCerradaService], + }).compile(); + + controller = module.get(RespuestaParticipanteCerradaController); + }); + + it('should be defined', () => { + expect(controller).toBeDefined(); + }); +}); diff --git a/src/respuesta_participante_cerrada/respuesta_participante_cerrada.controller.ts b/src/respuesta_participante_cerrada/respuesta_participante_cerrada.controller.ts new file mode 100644 index 0000000..88764e4 --- /dev/null +++ b/src/respuesta_participante_cerrada/respuesta_participante_cerrada.controller.ts @@ -0,0 +1,34 @@ +import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common'; +import { RespuestaParticipanteCerradaService } from './respuesta_participante_cerrada.service'; +import { CreateRespuestaParticipanteCerradaDto } from './dto/create-respuesta_participante_cerrada.dto'; +import { UpdateRespuestaParticipanteCerradaDto } from './dto/update-respuesta_participante_cerrada.dto'; + +@Controller('respuesta-participante-cerrada') +export class RespuestaParticipanteCerradaController { + constructor(private readonly respuestaParticipanteCerradaService: RespuestaParticipanteCerradaService) {} + + @Post() + create(@Body() createRespuestaParticipanteCerradaDto: CreateRespuestaParticipanteCerradaDto) { + return this.respuestaParticipanteCerradaService.create(createRespuestaParticipanteCerradaDto); + } + + @Get() + findAll() { + return this.respuestaParticipanteCerradaService.findAll(); + } + + @Get(':id') + findOne(@Param('id') id: string) { + return this.respuestaParticipanteCerradaService.findOne(+id); + } + + @Patch(':id') + update(@Param('id') id: string, @Body() updateRespuestaParticipanteCerradaDto: UpdateRespuestaParticipanteCerradaDto) { + return this.respuestaParticipanteCerradaService.update(+id, updateRespuestaParticipanteCerradaDto); + } + + @Delete(':id') + remove(@Param('id') id: string) { + return this.respuestaParticipanteCerradaService.remove(+id); + } +} diff --git a/src/respuesta_participante_cerrada/respuesta_participante_cerrada.module.ts b/src/respuesta_participante_cerrada/respuesta_participante_cerrada.module.ts new file mode 100644 index 0000000..5fdf968 --- /dev/null +++ b/src/respuesta_participante_cerrada/respuesta_participante_cerrada.module.ts @@ -0,0 +1,9 @@ +import { Module } from '@nestjs/common'; +import { RespuestaParticipanteCerradaService } from './respuesta_participante_cerrada.service'; +import { RespuestaParticipanteCerradaController } from './respuesta_participante_cerrada.controller'; + +@Module({ + controllers: [RespuestaParticipanteCerradaController], + providers: [RespuestaParticipanteCerradaService], +}) +export class RespuestaParticipanteCerradaModule {} diff --git a/src/respuesta_participante_cerrada/respuesta_participante_cerrada.service.spec.ts b/src/respuesta_participante_cerrada/respuesta_participante_cerrada.service.spec.ts new file mode 100644 index 0000000..71e1776 --- /dev/null +++ b/src/respuesta_participante_cerrada/respuesta_participante_cerrada.service.spec.ts @@ -0,0 +1,18 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { RespuestaParticipanteCerradaService } from './respuesta_participante_cerrada.service'; + +describe('RespuestaParticipanteCerradaService', () => { + let service: RespuestaParticipanteCerradaService; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [RespuestaParticipanteCerradaService], + }).compile(); + + service = module.get(RespuestaParticipanteCerradaService); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/src/respuesta_participante_cerrada/respuesta_participante_cerrada.service.ts b/src/respuesta_participante_cerrada/respuesta_participante_cerrada.service.ts new file mode 100644 index 0000000..1801ab7 --- /dev/null +++ b/src/respuesta_participante_cerrada/respuesta_participante_cerrada.service.ts @@ -0,0 +1,26 @@ +import { Injectable } from '@nestjs/common'; +import { CreateRespuestaParticipanteCerradaDto } from './dto/create-respuesta_participante_cerrada.dto'; +import { UpdateRespuestaParticipanteCerradaDto } from './dto/update-respuesta_participante_cerrada.dto'; + +@Injectable() +export class RespuestaParticipanteCerradaService { + create(createRespuestaParticipanteCerradaDto: CreateRespuestaParticipanteCerradaDto) { + return 'This action adds a new respuestaParticipanteCerrada'; + } + + findAll() { + return `This action returns all respuestaParticipanteCerrada`; + } + + findOne(id: number) { + return `This action returns a #${id} respuestaParticipanteCerrada`; + } + + update(id: number, updateRespuestaParticipanteCerradaDto: UpdateRespuestaParticipanteCerradaDto) { + return `This action updates a #${id} respuestaParticipanteCerrada`; + } + + remove(id: number) { + return `This action removes a #${id} respuestaParticipanteCerrada`; + } +} diff --git a/src/seccion/entities/seccion.entity.ts b/src/seccion/entities/seccion.entity.ts index e69de29..ee2701d 100644 --- a/src/seccion/entities/seccion.entity.ts +++ b/src/seccion/entities/seccion.entity.ts @@ -0,0 +1,24 @@ +import { CuestionarioSeccion } from 'src/cuestionario_seccion/entities/cuestionario_seccion.entity'; +import { SeccionPregunta } from 'src/seccion_pregunta/entities/seccion_pregunta.entity'; +import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm'; + +@Entity('seccion') +export class Seccion { + @PrimaryGeneratedColumn() + id_seccion: number; + + @Column({ type: 'int' }) + contador_pregunta: number; + + @Column({ type: 'text', nullable: true }) + descripcion: string; + + @Column({ type: 'text', nullable: true }) + titulo: string; + + @OneToMany(() => CuestionarioSeccion,(cuestionario_seccion) => cuestionario_seccion.id_seccion ) + seccion:CuestionarioSeccion[]; + + @OneToMany(()=> SeccionPregunta, (seccion_pregunta)=> seccion_pregunta.id_seccion) + seccion_pregunta:SeccionPregunta[]; +} diff --git a/src/tipo_cuestionario/entities/tipo_cuestionario.entity.ts b/src/tipo_cuestionario/entities/tipo_cuestionario.entity.ts index e69de29..3a2ccf5 100644 --- a/src/tipo_cuestionario/entities/tipo_cuestionario.entity.ts +++ b/src/tipo_cuestionario/entities/tipo_cuestionario.entity.ts @@ -0,0 +1,14 @@ +import { Cuestionario } from 'src/cuestionario/entities/cuestionario.entity'; +import { Entity, PrimaryGeneratedColumn, Column, ManyToMany, ManyToOne } from 'typeorm'; + +@Entity('tipo_cuestionario') +export class TipoCuestionario { + @PrimaryGeneratedColumn() + id_tipo_cuestionario: number; + + @Column({ type: 'varchar', length: 30 }) + tipo_cuestionario: string; + + @ManyToOne(()=> Cuestionario,(cuestionario)=> cuestionario.id_tipo_cuestionario) + cuestionario:Cuestionario[]; +}