taking the activity xid in get all submited ques ans
This commit is contained in:
@@ -1,11 +1,9 @@
|
|||||||
import { verifyOnlyMinglarAdminToken } from '@/common/middlewares/jwt/authForOnlyMinglarAdmin';
|
import { verifyMinglarAdminHostToken } from '@/common/middlewares/jwt/authForMinglarAdmin&Host';
|
||||||
import { APIGatewayProxyEvent, APIGatewayProxyResult, Context } from 'aws-lambda';
|
import { APIGatewayProxyEvent, APIGatewayProxyResult, Context } from 'aws-lambda';
|
||||||
import { PrismaService } from '../../../../../common/database/prisma.service';
|
import { PrismaService } from '../../../../../common/database/prisma.service';
|
||||||
import { safeHandler } from '../../../../../common/utils/handlers/safeHandler';
|
import { safeHandler } from '../../../../../common/utils/handlers/safeHandler';
|
||||||
import ApiError from '../../../../../common/utils/helper/ApiError';
|
import ApiError from '../../../../../common/utils/helper/ApiError';
|
||||||
import { PrePopulateService } from '../../../../prepopulate/services/prepopulate.service';
|
|
||||||
import { HostService } from '../../../services/host.service';
|
import { HostService } from '../../../services/host.service';
|
||||||
import { verifyMinglarAdminHostToken } from '@/common/middlewares/jwt/authForMinglarAdmin&Host';
|
|
||||||
|
|
||||||
const prismaService = new PrismaService();
|
const prismaService = new PrismaService();
|
||||||
const hostService = new HostService(prismaService);
|
const hostService = new HostService(prismaService);
|
||||||
@@ -23,7 +21,15 @@ export const handler = safeHandler(async (
|
|||||||
// Authenticate user using the shared authForHost function
|
// Authenticate user using the shared authForHost function
|
||||||
await verifyMinglarAdminHostToken(token);
|
await verifyMinglarAdminHostToken(token);
|
||||||
|
|
||||||
const result = await hostService.getAllPQQQuesAndSubmittedAns();
|
const activity_xid = event.queryStringParameters?.activity_xid
|
||||||
|
? Number(event.queryStringParameters.activity_xid)
|
||||||
|
: null;
|
||||||
|
|
||||||
|
if (!activity_xid) {
|
||||||
|
throw new ApiError(409, "Activity ID is required")
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await hostService.getAllPQQQuesAndSubmittedAns(Number(activity_xid));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
|
|||||||
@@ -1386,9 +1386,9 @@ export class HostService {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAllPQQQuesAndSubmittedAns() {
|
async getAllPQQQuesAndSubmittedAns(activity_xid: number) {
|
||||||
return await this.prisma.activityPQQheader.findMany({
|
return await this.prisma.activityPQQheader.findMany({
|
||||||
where: { isActive: true },
|
where: { isActive: true, activityXid: activity_xid },
|
||||||
include: {
|
include: {
|
||||||
pqqQuestions: {
|
pqqQuestions: {
|
||||||
select: {
|
select: {
|
||||||
|
|||||||
Reference in New Issue
Block a user