diff --git a/src/common/utils/constants/host.constant.ts b/src/common/utils/constants/host.constant.ts index 71145e3..d5ac757 100644 --- a/src/common/utils/constants/host.constant.ts +++ b/src/common/utils/constants/host.constant.ts @@ -25,4 +25,20 @@ export const STEPPER = { export const LAST_QUESTION_ID = { Q_ID: 55 +} + +export const ACTIVITY_INTERNAL_STATUS = { + APPROVED: 'Approved', + REJECTED: 'Rejected', + DRAFT: 'Draft', + UNDER_REVIEW: 'Under-Review', + PQQ_FAILED: 'PQQ Failed' +} + +export const ACTIVITY_DISPLAY_STATUS = { + APPROVED: 'Approved', + REJECTED: 'Rejected', + DRAFT: 'Draft', + UNDER_REVIEW: 'Under-Review', + PQQ_FAILED: 'PQQ Failed' } \ No newline at end of file diff --git a/src/modules/host/services/host.service.ts b/src/modules/host/services/host.service.ts index 338f946..576a336 100644 --- a/src/modules/host/services/host.service.ts +++ b/src/modules/host/services/host.service.ts @@ -7,7 +7,7 @@ import ApiError from '../../../common/utils/helper/ApiError'; import { User } from '@prisma/client'; import { z } from 'zod'; import { hostCompanyDetailsSchema } from '@/common/utils/validation/host/hostCompanyDetails.validation'; -import { HOST_STATUS_DISPLAY, HOST_STATUS_INTERNAL, STEPPER } from '@/common/utils/constants/host.constant'; +import { ACTIVITY_DISPLAY_STATUS, ACTIVITY_INTERNAL_STATUS, HOST_STATUS_DISPLAY, HOST_STATUS_INTERNAL, STEPPER } from '@/common/utils/constants/host.constant'; import { MINGLAR_STATUS_DISPLAY, MINGLAR_STATUS_INTERNAL } from '@/common/utils/constants/minglar.constant'; import { ROLE, ROLE_NAME, USER_STATUS } from '@/common/utils/constants/common.constant'; import { getPresignedUrl } from '@/common/middlewares/aws/getPreSignedUrl'; @@ -737,6 +737,28 @@ export class HostService { const overallPercentage = totalMaxPoints > 0 ? (totalUserPoints / totalMaxPoints) * 100 : 0; + if (overallPercentage > 50) { + await this.prisma.activities.update({ + where: { + id: activityXid + }, + data: { + activityInternalStatus: ACTIVITY_INTERNAL_STATUS.UNDER_REVIEW, + activityDisplayStatus: ACTIVITY_DISPLAY_STATUS.UNDER_REVIEW + } + }) + } else { + await this.prisma.activities.update({ + where: { + id: activityXid + }, + data: { + activityInternalStatus: ACTIVITY_INTERNAL_STATUS.PQQ_FAILED, + activityDisplayStatus: ACTIVITY_DISPLAY_STATUS.PQQ_FAILED + } + }) + } + // ---------- 🔥 ONLY FIRST 2 CATEGORIES ---------- const categoryArray = Object.values(categories);