Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { DeepPartial } from './ProposalDataSource';
import {
DependenciesLogicOperator,
EvaluatorOperator,
Expand Down Expand Up @@ -29,7 +30,6 @@ import {
TextInputConfig,
} from '../../resolvers/types/FieldConfig';
import { QuestionaryDataSource } from '../QuestionaryDataSource';
import { DeepPartial } from './ProposalDataSource';

export let dummyQuestionarySteps: QuestionaryStep[];
export let dummyQuestionary: Questionary;
Expand Down Expand Up @@ -74,6 +74,7 @@ export const dummyQuestionTemplateRelationFactory = (
dummyQuestionFactory(values?.question),
values?.sortOrder || Math.round(Math.random() * 100),
values?.topicId || Math.round(Math.random() * 10),
values?.templateId || Math.round(Math.random() * 100),
values?.config || { ...new BooleanConfig(), readPermissions: [] },
values?.dependencies as FieldDependency[],
values?.dependenciesOperator as DependenciesLogicOperator
Expand Down
1 change: 1 addition & 0 deletions apps/backend/src/datasources/postgres/records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,7 @@ export const createQuestionTemplateRelationObject = async <T extends DataType>(
),
record.topic_id,
record.sort_order,
record.template_id,
createConfig<any>(record.data_type as DataType, transformedConfig),
dependencies,
record.dependencies_operator
Expand Down
1 change: 1 addition & 0 deletions apps/backend/src/models/Questionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class Answer extends QuestionTemplateRelation {
questionTemplateRelation.question,
questionTemplateRelation.topicId,
questionTemplateRelation.sortOrder,
questionTemplateRelation.templateId,
questionTemplateRelation.config,
questionTemplateRelation.dependencies,
questionTemplateRelation.dependenciesOperator
Expand Down
1 change: 1 addition & 0 deletions apps/backend/src/models/Template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class QuestionTemplateRelation {
public question: Question,
public topicId: number,
public sortOrder: number,
public templateId: number,
public config: typeof FieldConfigType,
public dependencies: FieldDependency[],
public dependenciesOperator?: DependenciesLogicOperator
Expand Down
3 changes: 3 additions & 0 deletions apps/backend/src/resolvers/types/QuestionTemplateRelation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export class QuestionTemplateRelation
@Field(() => Int)
public sortOrder: number;

@Field(() => Int)
public templateId: number;

@Field(() => Int)
public topicId: number;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ const extractSearchableQuestions = (
); // only searchable questions
};

function QuestionaryFilter({
onSubmit,
callId,
templateId,
}: QuestionaryFilterProps) {
function QuestionaryFilter({ onSubmit, callId }: QuestionaryFilterProps) {
const { loading: isLoadingQuestionarySteps, questionarySteps } =
useBlankQuestionaryStepsDataByCallId(callId);

Expand Down Expand Up @@ -163,7 +159,7 @@ function QuestionaryFilter({
}}
questionTemplateRelation={selectedQuestion}
callId={callId}
templateId={templateId}
templateId={selectedQuestion.templateId}
/>
)}
</Collapse>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ fragment answer on Answer {
...question
}
sortOrder
templateId
topicId
config {
...fieldConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ fragment questionTemplateRelation on QuestionTemplateRelation {
...question
}
sortOrder
templateId
topicId
config {
...fieldConfig
Expand Down