Made a get all details of activity with venue for the big form details of activity

This commit is contained in:
2025-12-23 17:51:32 +05:30
parent 1540688b7d
commit bf16a31ae6
6 changed files with 924 additions and 626 deletions

View File

@@ -307,7 +307,6 @@ updatePQQ_LastAnswer:
path: /host/Activity_Hub/OnBoarding/submit-final-pqq-answer
method: post
submitPQQForReview:
handler: src/modules/host/handlers/Activity_Hub/OnBoarding/submitPQQForReview.handler
memorySize: 384
@@ -339,6 +338,21 @@ getAllPQQwithSubmittedAns:
path: /host/Activity_Hub/OnBoarding/get-all-pqq-ques-submited-ans
method: get
getAllDetailsOfActivityAndVenue:
handler: src/modules/host/handlers/Activity_Hub/OnBoarding/getAllDetailsOfActivityAndVenue.handler
memorySize: 512
package:
patterns:
- 'src/modules/host/handlers/Activity_Hub/OnBoarding/**'
- ${file(./serverless/patterns/base.yml):pattern1}
- ${file(./serverless/patterns/base.yml):pattern2}
- ${file(./serverless/patterns/base.yml):pattern3}
- ${file(./serverless/patterns/base.yml):pattern4}
events:
- httpApi:
path: /host/Activity_Hub/OnBoarding/get-all-details-activity-venue/{activityXid}
method: get
updateSuggestionAsReviewed:
handler: src/modules/host/handlers/Activity_Hub/OnBoarding/updateSuggestionAsReviewed.handler
memorySize: 512

View File

@@ -25,7 +25,7 @@ export const handler = safeHandler(async (
}
// Verify token and get user info
const userInfo = await verifyHostToken(token);
await verifyHostToken(token);
// Read optional search query (supports ?search= or ?q=)

View File

@@ -0,0 +1,47 @@
import { verifyMinglarAdminHostToken } from '../../../../../common/middlewares/jwt/authForMinglarAdminHost';
import { APIGatewayProxyEvent, APIGatewayProxyResult, Context } from 'aws-lambda';
import { prismaClient } from '../../../../../common/database/prisma.lambda.service';
import { safeHandler } from '../../../../../common/utils/handlers/safeHandler';
import ApiError from '../../../../../common/utils/helper/ApiError';
import { HostService } from '../../../services/host.service';
const hostService = new HostService(prismaClient);
/**
* Add suggestion handler for host applications
* Allows Minglar Admin, Co_Admin, and Account Manager to add suggestions
* Types: Setup Profile, Review Account, Add Payment Details, Agreement
*/
export const handler = safeHandler(async (
event: APIGatewayProxyEvent,
context?: Context
): Promise<APIGatewayProxyResult> => {
// Verify authentication token
const token = event.headers['x-auth-token'] || event.headers['X-Auth-Token'];
if (!token) {
throw new ApiError(401, 'This is a protected route. Please provide a valid token.');
}
// Verify token and get user info
await verifyMinglarAdminHostToken(token);
const activityXid = event.pathParameters?.activityXid
if (!activityXid) {
throw new ApiError(400, 'activityXid is required in path parameters');
}
const data = await hostService.getAllDetailsOfActivityAndVenue(Number(activityXid));
return {
statusCode: 200,
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
},
body: JSON.stringify({
success: true,
message: 'Data retrieved successfully',
data,
}),
};
});

View File

@@ -1703,6 +1703,241 @@ export class HostService {
});
}
async getAllDetailsOfActivityAndVenue(activityXid: number) {
return await this.prisma.activities.findMany({
where: { id: activityXid, isActive: true },
select: {
id: true,
activityTitle: true,
activityDescription: true,
activityDisplayStatus: true,
activityInternalStatus: true,
activityRefNumber: true,
checkInAddress: true,
checkInLat: true,
checkInLong: true,
checkOutAddress: true,
checkOutLat: true,
checkOutLong: true,
pickUpDropAvailable: true,
pickUpDropIsChargeable: true,
activityDurationMins: true,
activityType: {
select: {
id: true,
activityTypeName: true,
}
},
ActivityPickUpDetails: {
where: {
isActive: true,
activityPickUpTransport: {
isActive: true,
transportMode: {
isActive: true
}
}
},
select: {
id: true,
isPickUp: true,
locationAddress: true,
locationLat: true,
locationLong: true,
transportTotalPrice: true,
transportBasePrice: true,
activityPickUpTransport: {
select: {
id: true,
isTransportModeChargeable: true,
transportMode: {
select: {
transportModeName: true,
transportModeIcon: true
}
}
}
}
}
},
foodAvailable: true,
foodIsChargeable: true,
activityFoodTypes: {
where: { isActive: true },
select: {
id: true,
foodType: {
select: {
id: true,
foodTypeName: true
}
},
}
},
activityCuisines: {
where: {
isActive: true
},
select: {
id: true,
foodCuisine: {
select: {
id: true,
cuisineName: true
}
}
}
},
alcoholAvailable: true,
trainerAvailable: true,
trainerIsChargeable: true,
ActivityTrainers: {
where: {
isActive: true
},
select: {
id: true,
totalAmount: true
}
},
ActivityNavigationModes: {
where: {
isActive: true
},
select: {
id: true,
isInActivityChargeable: true,
navigationModesTotalPrice: true,
navigationMode: {
select: {
id: true,
navigationModeName: true,
navigationModeIcon: true
}
}
}
},
equipmentAvailable: true,
equipmentIsChargeable: true,
ActivityEquipments: {
where: {
isActive: true
},
select: {
id: true,
equipmentName: true,
isEquipmentChargeable: true,
equipmentTotalPrice: true,
}
},
ActivityOtherDetails: {
where: {
isActive: true
},
select: {
id: true,
exclusiveNotes: true,
dosNotes: true,
dontsNotes: true,
tipsNotes: true,
termsAndCondition: true,
}
},
energyLevel: {
where: {
isActive: true
},
select: {
id: true,
energyLevelName: true,
energyIcon: true,
energyColor: true
}
},
ActivityEligibility: {
where: {
isActive: true
},
select: {
id: true,
isAgeRestriction: true,
ageRestriction: {
select: {
id: true,
ageRestrictionName: true,
minAge: true,
maxAge: true,
}
},
isWeightRestriction: true,
weightRestrictionName: true,
weightEntered: true,
weightIn: true,
minWeight: true,
maxWeight: true,
isHeightRestriction: true,
heightRestrictionName: true,
heightEntered: true,
heightIn: true,
minHeight: true,
maxHeight: true
}
},
ActivityAllowedEntry: {
where: {
isActive: true
},
select: {
id: true,
allowedEntryType: {
select: {
id: true,
allowedEntryTypeName: true
}
}
}
},
ActivityAmenities: {
where: {
isActive: true
},
select: {
id: true,
amenities: {
select: {
id: true,
amenitiesName: true
}
}
}
},
cancellationAvailable: true,
cancellationAllowedBeforeMins: true
// accountManager: {
// select: {
// id: true,
// firstName: true,
// lastName: true,
// emailAddress: true,
// mobileNumber: true,
// }
// },
// host: {
// select: {
// id: true,
// companyName: true,
// stepper: true,
// adminStatusDisplay: true,
// adminStatusInternal: true,
// }
// }
}
})
}
async createActivity(
userId: number,
activityTypeXid: number,

View File

@@ -5,6 +5,7 @@ import { safeHandler } from '../../../../../common/utils/handlers/safeHandler';
import ApiError from '../../../../../common/utils/helper/ApiError';
import { MinglarService } from '../../../services/minglar.service';
import { sendAMRejectionMailtoHost } from '../../../services/rejectionMailtoHost.service';
import config from '../../../../../config/config';
const minglarService = new MinglarService(prismaClient);
@@ -47,7 +48,7 @@ export const handler = safeHandler(async (
// Add suggestion using service
await minglarService.rejectHostApplicationAM(hostXid, userInfo.id);
const hostDetails = await minglarService.getUserDetails(hostXid)
await sendAMRejectionMailtoHost(hostDetails.emailAddress, hostDetails.firstName)
await sendAMRejectionMailtoHost(hostDetails.emailAddress, hostDetails.firstName, config.HOST_LINK)
return {
statusCode: 200,

View File

@@ -39,7 +39,8 @@ export async function sendEmailToHostForRejectedApplication(
export async function sendAMRejectionMailtoHost(
emailAddress: string,
name: string
name: string,
link: string
): Promise<{
sent: boolean;
// messageId: string
@@ -53,8 +54,8 @@ export async function sendAMRejectionMailtoHost(
Please make the necessary improvements and re-submit your application to proceed with the onboarding process on Minglar.</p>
<p> You may access your application using the link below:<br/>
<strong>Link:</strong>
<a href="${config.HOST_LINK}" target="_blank">
${config.HOST_LINK}
<a href="${link}" target="_blank">
${link}
</a>
</p>
<p> If you have any questions, please feel free to contact the Minglar Support Team. </p>