diff --git a/src/config/database.config.ts b/src/config/database.config.ts index 7890db5..23816fa 100644 --- a/src/config/database.config.ts +++ b/src/config/database.config.ts @@ -1,4 +1,3 @@ -// src/config/database.config.ts import { TypeOrmModuleOptions } from '@nestjs/typeorm'; import { Participant } from '../participant/entity/participant.entity'; import { Form } from '../form/entity/form.entity'; @@ -19,7 +18,7 @@ export const typeOrmConfig: TypeOrmModuleOptions = { port: 5433, username: 'postgres', password: '1111', - database: 'db', + database: 'saha-db', entities: [ BaseEntity, Participant, diff --git a/src/form/form.module.ts b/src/form/form.module.ts index ad7cbe2..8463f7f 100644 --- a/src/form/form.module.ts +++ b/src/form/form.module.ts @@ -9,7 +9,8 @@ import { Attachment } from '../attachment/entity/attachment.entity'; import { Question } from '../question/entity/question.entity'; import { Answer } from '../answer/entity/answer.entity'; import { Option } from '../option/entity/option.entity'; -import { Participant } from '../participant/entity/participant.entity'; // Assuming Participant entity exists +import { Participant } from '../participant/entity/participant.entity'; +import { FormResultModule } from '../formResult/formResult.module'; @Module({ imports: [ @@ -21,10 +22,11 @@ import { Participant } from '../participant/entity/participant.entity'; // Assum Question, Answer, Option, - Participant, // Include Participant entity + Participant, ]), + FormResultModule, ], controllers: [FormController], providers: [FormService], }) -export class FormModule {} +export class FormModule {} \ No newline at end of file diff --git a/src/formResult/formResult.controller.ts b/src/formResult/formResult.controller.ts index 2b83dee..ec0d1f7 100644 --- a/src/formResult/formResult.controller.ts +++ b/src/formResult/formResult.controller.ts @@ -22,8 +22,8 @@ export class FormResultController { return this.formResultService.findAll(parseInt(page, 10), parseInt(limit, 10)); } - @Get(':id') - async findOne( // just gets the data in database + @Get('id/:id') + async findOne( // search based on formResultId @Param('id', new ParseUUIDPipe()) id: string, ): Promise { return this.formResultService.findById(id); @@ -44,8 +44,8 @@ export class FormResultController { return this.formResultService.remove(id); } - @Get(':id/refresh') - async getFormStatistics( // updates data in database and then returns it + @Get(':id') + async getFormStatistics( // search based on formId, we prefer to use this one rather than 'id/:id' @Param('formId', new ParseUUIDPipe()) formId: string, ): Promise { return this.formResultService.getFormStatistics(formId);