fixed the submit last pqq question api logic

This commit is contained in:
2025-11-27 20:00:29 +05:30
parent 75077c00da
commit 8ccbdc8f32
3 changed files with 27 additions and 24 deletions

View File

@@ -85,7 +85,7 @@ export const handler = safeHandler(async (
}
// Send OTP email outside the DB transaction
// await sendOtpEmailForHost(transactionResult.newUser.emailAddress, transactionResult.otp);
await sendOtpEmailForHost(transactionResult.newUser.emailAddress, transactionResult.otp);
return {
statusCode: 200,

View File

@@ -12,6 +12,8 @@ import { User } from '@prisma/client';
import { z } from 'zod';
import { hostCompanyDetailsSchema } from '@/common/utils/validation/host/hostCompanyDetails.validation';
import {
ACTIVITY_AM_DISPLAY_STATUS,
ACTIVITY_AM_INTERNAL_STATUS,
ACTIVITY_DISPLAY_STATUS, ACTIVITY_INTERNAL_STATUS, HOST_STATUS_DISPLAY,
HOST_STATUS_INTERNAL,
STEPPER,
@@ -791,28 +793,6 @@ 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);
@@ -1072,7 +1052,10 @@ export class HostService {
hostXid: host.id,
activityTypeXid: activityTypeXid,
frequenciesXid: frequenciesXid || null,
isActive: true,
activityInternalStatus: ACTIVITY_INTERNAL_STATUS.DRAFT_PQ,
activityDisplayStatus: ACTIVITY_DISPLAY_STATUS.DRAFT_PQ,
amInternalStatus: ACTIVITY_AM_INTERNAL_STATUS.DRAFT_PQ,
amDisplayStatus: ACTIVITY_AM_DISPLAY_STATUS.DRAFT_PQ,
},
});