Initial commit: working SD Park Pass Map app with deploy scripts and .gitignore
This commit is contained in:
32
app/api/notifications/route.ts
Normal file
32
app/api/notifications/route.ts
Normal file
@ -0,0 +1,32 @@
|
||||
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 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user