parent
9af4f9dcf8
commit
5b31cc0e0f
|
|
@ -1,4 +1,3 @@
|
||||||
// src/config/database.config.ts
|
|
||||||
import { TypeOrmModuleOptions } from '@nestjs/typeorm';
|
import { TypeOrmModuleOptions } from '@nestjs/typeorm';
|
||||||
import { Participant } from '../participant/entity/participant.entity';
|
import { Participant } from '../participant/entity/participant.entity';
|
||||||
import { Form } from '../form/entity/form.entity';
|
import { Form } from '../form/entity/form.entity';
|
||||||
|
|
@ -19,7 +18,7 @@ export const typeOrmConfig: TypeOrmModuleOptions = {
|
||||||
port: 5433,
|
port: 5433,
|
||||||
username: 'postgres',
|
username: 'postgres',
|
||||||
password: '1111',
|
password: '1111',
|
||||||
database: 'db',
|
database: 'saha-db',
|
||||||
entities: [
|
entities: [
|
||||||
BaseEntity,
|
BaseEntity,
|
||||||
Participant,
|
Participant,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,8 @@ import { Attachment } from '../attachment/entity/attachment.entity';
|
||||||
import { Question } from '../question/entity/question.entity';
|
import { Question } from '../question/entity/question.entity';
|
||||||
import { Answer } from '../answer/entity/answer.entity';
|
import { Answer } from '../answer/entity/answer.entity';
|
||||||
import { Option } from '../option/entity/option.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({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
|
|
@ -21,8 +22,9 @@ import { Participant } from '../participant/entity/participant.entity'; // Assum
|
||||||
Question,
|
Question,
|
||||||
Answer,
|
Answer,
|
||||||
Option,
|
Option,
|
||||||
Participant, // Include Participant entity
|
Participant,
|
||||||
]),
|
]),
|
||||||
|
FormResultModule,
|
||||||
],
|
],
|
||||||
controllers: [FormController],
|
controllers: [FormController],
|
||||||
providers: [FormService],
|
providers: [FormService],
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@ export class FormResultController {
|
||||||
return this.formResultService.findAll(parseInt(page, 10), parseInt(limit, 10));
|
return this.formResultService.findAll(parseInt(page, 10), parseInt(limit, 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get('id/:id')
|
||||||
async findOne( // just gets the data in database
|
async findOne( // search based on formResultId
|
||||||
@Param('id', new ParseUUIDPipe()) id: string,
|
@Param('id', new ParseUUIDPipe()) id: string,
|
||||||
): Promise<FormResult | null> {
|
): Promise<FormResult | null> {
|
||||||
return this.formResultService.findById(id);
|
return this.formResultService.findById(id);
|
||||||
|
|
@ -44,8 +44,8 @@ export class FormResultController {
|
||||||
return this.formResultService.remove(id);
|
return this.formResultService.remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id/refresh')
|
@Get(':id')
|
||||||
async getFormStatistics( // updates data in database and then returns it
|
async getFormStatistics( // search based on formId, we prefer to use this one rather than 'id/:id'
|
||||||
@Param('formId', new ParseUUIDPipe()) formId: string,
|
@Param('formId', new ParseUUIDPipe()) formId: string,
|
||||||
): Promise<FormResult | null> {
|
): Promise<FormResult | null> {
|
||||||
return this.formResultService.getFormStatistics(formId);
|
return this.formResultService.getFormStatistics(formId);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue