added transaction for calculating the pqq final answer score

This commit is contained in:
2025-11-27 19:16:46 +05:30
parent b0bae33b6e
commit 326ea2f96b
3 changed files with 184 additions and 110 deletions

View File

@@ -23,7 +23,7 @@ import { sendAMEmailForHostAssign } from './AMEmail.service';
@Injectable()
export class MinglarService {
constructor(private prisma: PrismaService) {}
constructor(private prisma: PrismaService) { }
async createPassword(user_xid: number, password: string): Promise<boolean> {
// Find user by id
@@ -203,16 +203,36 @@ export class MinglarService {
}
async getAllHostActivityForMinglar(search?: string, hostXid?: number) {
return await this.prisma.activities.findMany({
return await this.prisma.activities.findMany({
where: {
isActive: true,
hostXid: hostXid,
},
include: {
ActivitiesMedia: true,
ActivityAmDetails: true,
ActivitiesMedia: {
select: {
id: true,
mediaFileName: true,
mediaType: true,
displayOrder: true,
}
},
ActivityAmDetails: {
select: {
accountManager: {
select: {
id: true,
firstName: true,
lastName: true,
profileImage: true,
emailAddress: true,
roleXid: true,
}
}
}
},
activityType: true,
},
},
});
}
@@ -614,7 +634,7 @@ export class MinglarService {
if (
userStatus &&
userStatus.trim().toLowerCase() ===
MINGLAR_STATUS_DISPLAY.NEW.toLowerCase()
MINGLAR_STATUS_DISPLAY.NEW.toLowerCase()
) {
filters.adminStatusInternal = MINGLAR_STATUS_INTERNAL.ADMIN_TO_REVIEW;
}
@@ -872,7 +892,7 @@ export class MinglarService {
if (
hostDetails.adminStatusInternal !==
MINGLAR_STATUS_INTERNAL.AM_NOT_ASSIGNED &&
MINGLAR_STATUS_INTERNAL.AM_NOT_ASSIGNED &&
hostDetails.adminStatusDisplay !== MINGLAR_STATUS_DISPLAY.AM_NOT_ASSIGNED
) {
throw new ApiError(400, 'Invalid host status');