Files
sd-park-pass-map/app/api/notifications/route.ts

33 lines
974 B
TypeScript

import { NextResponse } from 'next/server';
import { NotificationManager } from '../../utils/notifications';
// This API endpoint can be used for periodic checking
export async function GET() {
try {
const notifications = NotificationManager.getNotifications();
// In a real implementation, you might want to:
// 1. Fetch current availability data
// 2. Check against notification preferences
// 3. Send email notifications
// 4. Return results
return NextResponse.json({
notificationCount: notifications.length,
notifications: notifications.map(n => ({
id: n.id,
libraryName: n.libraryName,
passTypes: n.passTypes,
createdAt: n.createdAt,
lastChecked: n.lastChecked,
})),
});
} catch (error) {
console.error('Error checking notifications:', error);
return NextResponse.json(
{ error: 'Failed to check notifications' },
{ status: 500 }
);
}
}