Skip to content
Open
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
5 changes: 3 additions & 2 deletions generics/services/survey.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@ const createObservation = function (token, solutionId, data, userRoleAndProfileI
* @param {String} resourceType - Type of the resource being deleted ('solution', 'program', etc.).
* @param {String} tenantId - Tenant identifier (used for multi-tenancy).
* @param {String} orgId - Organization ID from where the deletion is triggered.
*
* @param {String} isAPrivateProgram - If Program is Private `true` else `false`.
* @returns {Promise<Object>} - Result indicating success/failure and optional response data.
*/
const deleteSolutionResource = function (solutionIds, resourceType, tenantId, orgId, userId) {
const deleteSolutionResource = function (solutionIds, resourceType, tenantId, orgId, userId, isAPrivateProgram) {
return new Promise(async (resolve, reject) => {
try {
// Construct the API URL to call the delete endpoint on the Survey Service
Expand All @@ -353,6 +353,7 @@ const deleteSolutionResource = function (solutionIds, resourceType, tenantId, or
tenantId: tenantId,
orgId: orgId,
deletedBy: userId,
isAPrivateProgram: isAPrivateProgram,
},
}
// Send a POST request to the Survey Service to delete the resource
Expand Down
16 changes: 11 additions & 5 deletions module/admin/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ module.exports = class AdminHelper {
CONSTANTS.common.SOLUTION,
tenantId,
orgId,
deletedBy
deletedBy,
isAPrivateProgram
)

deletedSurveysCount += deleteResponse.data.result.deletedSurveysCount || 0
Expand All @@ -245,6 +246,7 @@ module.exports = class AdminHelper {
deletedObservationsCount += deleteResponse.data.result.deletedObservationsCount || 0
deletedObservationSubmissionsCount +=
deleteResponse.data.result.deletedObservationSubmissionsCount || 0
deletedSolutionsCount += deleteResponse.data.result.deletedSolutionsCount || 0
}

const deletedSolutions = await solutionsQueries.delete(solutionFilter)
Expand Down Expand Up @@ -287,7 +289,8 @@ module.exports = class AdminHelper {
projectTemplateIds,
tenantId,
orgId,
deletedBy
deletedBy,
isAPrivateProgram
)

if (result.success) {
Expand Down Expand Up @@ -383,7 +386,8 @@ module.exports = class AdminHelper {
[solutionDetails[0].projectTemplateId],
tenantId,
orgId,
deletedBy
deletedBy,
isAPrivateProgram
)

if (result.success) {
Expand Down Expand Up @@ -437,8 +441,9 @@ module.exports = class AdminHelper {
* @param {string} tenantId - Tenant identifier.
* @param {string} orgId - Organization identifier.
* @param {string} deletedBy - Auth token for downstream service calls.
* @param {String} isAPrivateProgram - If Program is Private `true` else `false`.
*/
static deleteAssociatedResources(projectTemplateIds, tenantId, orgId, deletedBy) {
static deleteAssociatedResources(projectTemplateIds, tenantId, orgId, deletedBy, isAPrivateProgram) {
return new Promise(async (resolve, reject) => {
try {
// Initialize counters to track deletions
Expand Down Expand Up @@ -509,7 +514,8 @@ module.exports = class AdminHelper {
CONSTANTS.common.SOLUTION,
tenantId,
orgId,
deletedBy
deletedBy,
isAPrivateProgram
)

deletedSurveysCount += deleteResponse.data.result.deletedSurveysCount || 0
Expand Down