used bullmq in formResult,

database name: "saha-db"
This commit is contained in:
OkaykOrhmn 2025-07-26 11:20:23 +03:30
parent 9af4f9dcf8
commit 5b31cc0e0f
3 changed files with 10 additions and 9 deletions

View File

@ -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,

View File

@ -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 {}

View File

@ -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<FormResult | null> {
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<FormResult | null> {
return this.formResultService.getFormStatistics(formId);