Enhance PQQ data retrieval: Add comments and pqqAnswerXid fields to the selection in HostService and MinglarService. Update PQQAnswers structure to include all answer options for questions, improving data handling in responses.

This commit is contained in:
2025-12-03 19:43:22 +05:30
parent 4a7e5fbb1e
commit 1b72e65a71
2 changed files with 35 additions and 21 deletions

View File

@@ -1760,6 +1760,8 @@ export class HostService {
isActive: true,
},
select: {
comments: true,
pqqAnswerXid: true,
pqqQuestions: {
select: {
id: true,
@@ -1779,17 +1781,21 @@ export class HostService {
}
}
}
},
// 🔥 ALL ANSWER OPTIONS FOR THIS QUESTION
PQQAnswers: {
where: { isActive: true },
select: {
id: true,
answerName: true,
answerPoints: true,
displayOrder: true
},
orderBy: { displayOrder: "asc" }
}
}
},
pqqAnswers: {
select: {
id: true,
answerName: true,
answerPoints: true,
displayOrder: true
}
},
ActivityPQQSuggestions: {
where: { isActive: true },
select: {
@@ -1847,10 +1853,12 @@ export class HostService {
id: q.id,
questionName: q.questionName,
maxPoints: q.maxPoints,
pqqAnswerXid: item.pqqAnswerXid,
comments: item.comments || null,
displayOrder: q.displayOrder,
PQQAnswers: item.pqqAnswers ? [item.pqqAnswers] : [],
allAnswerOptions: q.PQQAnswers || [], // 🔥 All answers
suggestions: item.ActivityPQQSuggestions,
supportings: item.ActivityPQQSupportings
supportings: item.ActivityPQQSupportings,
});
}
@@ -1889,6 +1897,4 @@ export class HostService {
// ---------- RETURN GROUPED STRUCTURE ----------
return sortedCategories;
}
}

View File

@@ -1884,6 +1884,8 @@ export class MinglarService {
isActive: true,
},
select: {
comments: true,
pqqAnswerXid: true,
pqqQuestions: {
select: {
id: true,
@@ -1903,17 +1905,21 @@ export class MinglarService {
}
}
}
},
// 🔥 ALL ANSWER OPTIONS FOR THIS QUESTION
PQQAnswers: {
where: { isActive: true },
select: {
id: true,
answerName: true,
answerPoints: true,
displayOrder: true
},
orderBy: { displayOrder: "asc" }
}
}
},
pqqAnswers: {
select: {
id: true,
answerName: true,
answerPoints: true,
displayOrder: true
}
},
ActivityPQQSuggestions: {
where: { isActive: true },
select: {
@@ -1971,8 +1977,10 @@ export class MinglarService {
id: q.id,
questionName: q.questionName,
maxPoints: q.maxPoints,
pqqAnswerXid: item.pqqAnswerXid,
comments: item.comments || null,
displayOrder: q.displayOrder,
PQQAnswers: item.pqqAnswers ? [item.pqqAnswers] : [],
allAnswerOptions: q.PQQAnswers || [],
suggestions: item.ActivityPQQSuggestions,
supportings: item.ActivityPQQSupportings
});