added transaction for calculating the pqq final answer score
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import { verifyMinglarAdminToken } from '@/common/middlewares/jwt/authForMinglarAdmin';
|
||||
import { APIGatewayProxyEvent, APIGatewayProxyResult, Context } from 'aws-lambda';
|
||||
import { PrismaService } from '../../../../../common/database/prisma.service';
|
||||
import { safeHandler } from '../../../../../common/utils/handlers/safeHandler';
|
||||
import ApiError from '../../../../../common/utils/helper/ApiError';
|
||||
import { string } from 'zod';
|
||||
import { PrePopulateService } from '../../../../prepopulate/services/prepopulate.service';
|
||||
import { MinglarService } from '../../../services/minglar.service';
|
||||
import { verifyMinglarAdminHostToken } from '@/common/middlewares/jwt/authForMinglarAdmin&Host';
|
||||
|
||||
const prismaService = new PrismaService();
|
||||
const minglarService = new MinglarService(prismaService);
|
||||
@@ -27,7 +26,7 @@ export const handler = safeHandler(async (
|
||||
}
|
||||
|
||||
// Verify token and get user info
|
||||
const userInfo = await verifyMinglarAdminHostToken(token);
|
||||
const userInfo = await verifyMinglarAdminToken(token);
|
||||
|
||||
const hostXid = Number(event.pathParameters?.id)
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user