refactor: remove redundant user ID and host ID validation in scheduling handlers
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user