diff --git a/src/common/utils/constants/host.constant.ts b/src/common/utils/constants/host.constant.ts index de82a0e..51c008a 100644 --- a/src/common/utils/constants/host.constant.ts +++ b/src/common/utils/constants/host.constant.ts @@ -78,6 +78,7 @@ export const ACTIVITY_AM_INTERNAL_STATUS = { ACTIVITY_REJECTED: 'Activity Rejected', ACTIVITY_APPROVED: 'Activity Approved', ACTIVITY_LISTED: 'Activity Listed', + ACTIVITY_SUBMITED: 'Activity Submitted', }; export const ACTIVITY_AM_DISPLAY_STATUS = { @@ -93,9 +94,10 @@ export const ACTIVITY_AM_DISPLAY_STATUS = { REVISED: 'Revised', ACTIVITY_DRAFT: 'Draft - Activity', - ACTIVITY_NEW: 'To Review', + ACTIVITY_NEW: 'New', + ACTIVITY_TO_REVIEW: 'Activity To Review', ACTIVITY_ENHANCING: 'Enhancing', NOT_LISTED: 'Not Listed', ACTIVITY_LISTED: 'Listed', - ACITIVITY_REVISED:'Activity Revised' + ACTIVITY_REVISED:'Activity Revised' }; diff --git a/src/modules/host/handlers/Activity_Hub/OnBoarding/submitPQAnswer.ts b/src/modules/host/handlers/Activity_Hub/OnBoarding/submitPQAnswer.ts index ca76754..33350e1 100644 --- a/src/modules/host/handlers/Activity_Hub/OnBoarding/submitPQAnswer.ts +++ b/src/modules/host/handlers/Activity_Hub/OnBoarding/submitPQAnswer.ts @@ -156,9 +156,9 @@ export const handler = safeHandler(async (event: APIGatewayProxyEvent): Promise< const pqqAnswerXid = Number(fields.pqqAnswerXid); const comments = fields.comments || null; - if (!activityXid || isNaN(activityXid)) throw new ApiError(400, "Valid activityXid is required"); - if (!pqqQuestionXid || isNaN(pqqQuestionXid)) throw new ApiError(400, "Valid pqqQuestionXid is required"); - if (!pqqAnswerXid || isNaN(pqqAnswerXid)) throw new ApiError(400, "Valid pqqAnswerXid is required"); + if (!activityXid || isNaN(activityXid)) throw new ApiError(400, "Please provide a valid activity"); + if (!pqqQuestionXid || isNaN(pqqQuestionXid)) throw new ApiError(400, "Please select a valid question"); + if (!pqqAnswerXid || isNaN(pqqAnswerXid)) throw new ApiError(400, "Please select a valid answer"); // 6) UPSERT header const existingHeader = await hostService.findHeaderByCompositeKey( diff --git a/src/modules/host/handlers/Activity_Hub/OnBoarding/submitPQQ_Answer.ts b/src/modules/host/handlers/Activity_Hub/OnBoarding/submitPQQ_Answer.ts index 509635e..21591da 100644 --- a/src/modules/host/handlers/Activity_Hub/OnBoarding/submitPQQ_Answer.ts +++ b/src/modules/host/handlers/Activity_Hub/OnBoarding/submitPQQ_Answer.ts @@ -147,9 +147,9 @@ export const handler = safeHandler(async (event: APIGatewayProxyEvent): Promise< const pqqAnswerXid = Number(fields.pqqAnswerXid); const comments = fields.comments || null; - if (!activityXid || isNaN(activityXid)) throw new ApiError(400, "Valid activityXid is required"); - if (!pqqQuestionXid || isNaN(pqqQuestionXid)) throw new ApiError(400, "Valid pqqQuestionXid is required"); - if (!pqqAnswerXid || isNaN(pqqAnswerXid)) throw new ApiError(400, "Valid pqqAnswerXid is required"); + if (!activityXid || isNaN(activityXid)) throw new ApiError(400, "Please provide a valid activity"); + if (!pqqQuestionXid || isNaN(pqqQuestionXid)) throw new ApiError(400, "Please select a valid question"); + if (!pqqAnswerXid || isNaN(pqqAnswerXid)) throw new ApiError(400, "Please select a valid answer"); // 6) UPSERT header const existingHeader = await pqqService.findHeaderByCompositeKey( diff --git a/src/modules/host/services/host.service.ts b/src/modules/host/services/host.service.ts index 8e2afed..678d93e 100644 --- a/src/modules/host/services/host.service.ts +++ b/src/modules/host/services/host.service.ts @@ -2007,6 +2007,15 @@ export class HostService { }, }, }, + frequency: { + where: { + isActive: true + }, + select: { + id: true, + frequencyName: true + } + }, ActivityAmenities: { where: { isActive: true, @@ -2598,18 +2607,18 @@ export class HostService { activityInternalStatus = ACTIVITY_INTERNAL_STATUS.ACTIVITY_SUBMITTED; activityDisplayStatus = ACTIVITY_DISPLAY_STATUS.ACTIVITY_IN_REVIEW; amInternalStatus = ACTIVITY_AM_INTERNAL_STATUS.ACTIVITY_TO_REVIEW; - amDisplayStatus = ACTIVITY_AM_DISPLAY_STATUS.ACITIVITY_REVISED; + amDisplayStatus = ACTIVITY_AM_DISPLAY_STATUS.ACTIVITY_REVISED; } } else { if (isDraft) { activityInternalStatus = ACTIVITY_INTERNAL_STATUS.ACTIVITY_DRAFT; activityDisplayStatus = ACTIVITY_DISPLAY_STATUS.ACTIVITY_DRAFT; - amInternalStatus = ACTIVITY_AM_INTERNAL_STATUS.ACTIVITY_DRAFT; - amDisplayStatus = ACTIVITY_AM_DISPLAY_STATUS.ACTIVITY_DRAFT; + amInternalStatus = existingActivity.amInternalStatus; + amDisplayStatus = existingActivity.amDisplayStatus; } else { activityInternalStatus = ACTIVITY_INTERNAL_STATUS.ACTIVITY_SUBMITTED; activityDisplayStatus = ACTIVITY_DISPLAY_STATUS.ACTIVITY_IN_REVIEW; - amInternalStatus = ACTIVITY_AM_INTERNAL_STATUS.ACTIVITY_TO_REVIEW; + amInternalStatus = ACTIVITY_AM_INTERNAL_STATUS.ACTIVITY_SUBMITED; amDisplayStatus = ACTIVITY_AM_DISPLAY_STATUS.ACTIVITY_NEW; } } diff --git a/src/modules/minglaradmin/services/minglar.service.ts b/src/modules/minglaradmin/services/minglar.service.ts index 07f1c6f..1bb7d72 100644 --- a/src/modules/minglaradmin/services/minglar.service.ts +++ b/src/modules/minglaradmin/services/minglar.service.ts @@ -839,6 +839,10 @@ export class MinglarService { internal: MINGLAR_STATUS_INTERNAL.AM_REJECTED, display: MINGLAR_STATUS_DISPLAY.ENHANCING, }, + Approved: { + internal: MINGLAR_STATUS_INTERNAL.AM_APPROVED, + display: MINGLAR_STATUS_DISPLAY.APPROVED, + } }; if (applicationStatus?.trim()) { @@ -2051,6 +2055,19 @@ export class MinglarService { id: true, comments: true, pqqAnswerXid: true, + activity: { + select: { + id: true, + activityTitle: true, + host: { + select: { + id: true, + companyName: true, + logoPath: true + } + } + } + }, pqqQuestions: { select: { id: true, @@ -2120,6 +2137,9 @@ export class MinglarService { id: cat.id, categoryName: cat.categoryName, displayOrder: cat.displayOrder, + hostId: item.activity.host.id, + hostCompanyName: item.activity.host.companyName, + hostLogoPath: item.activity.host.logoPath, pqqsubCategories: [], }; } else if (!grouped[cat.id].activityPqqHeaderId) {