updating the status to under review if the pqq overall score is more than 50%

This commit is contained in:
2025-11-27 18:55:25 +05:30
parent 67da5b57e6
commit 030ec9225d
2 changed files with 39 additions and 1 deletions

View File

@@ -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'
}

View File

@@ -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);