refactor: remove redundant user ID and host ID validation in scheduling handlers

This commit is contained in:
2026-02-02 14:51:32 +05:30
parent cb92fbe400
commit e92eb230a0
2 changed files with 4 additions and 18 deletions

View File

@@ -29,14 +29,6 @@ export const handler = safeHandler(async (
const userInfo = await verifyMinglarAdminHostToken(token);
const userId = Number(userInfo.id);
if (!userId) {
throw new ApiError(400, 'User ID is required');
}
if (isNaN(userId)) {
throw new ApiError(400, 'Invalid user ID format');
}
// Get status filter from query parameters
const status = event.queryStringParameters?.status as string | undefined;

View File

@@ -26,21 +26,15 @@ export const handler = safeHandler(async (
}
const userInfo = await verifyHostToken(token);
const hostId = Number(userInfo.id);
if (!hostId) {
throw new ApiError(400, 'Host ID is required');
}
if (isNaN(hostId)) {
throw new ApiError(400, 'Invalid host ID format');
}
const userId = Number(userInfo.id);
const activityXid = event.pathParameters?.activityXid
if (!activityXid) {
throw new ApiError(400, 'activityXid is required in path parameters');
}
const hostId = await schedulingService.getHostIdByUserId(userId);
const result = await schedulingService.getVenueDurationByAct(Number(activityXid), Number(hostId));
return {