51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
import { db } from '@/lib/db';
|
|
import { announcements } from '@/lib/db/schema';
|
|
import { randomUUID } from 'crypto';
|
|
|
|
async function seedAnnouncements() {
|
|
try {
|
|
const testAnnouncements = [
|
|
{
|
|
id: randomUUID(),
|
|
title: 'Welcome to the New Booking System!',
|
|
content:
|
|
'We have upgraded our table tennis booking system with new features including mobile support, partner booking, and booking management. Enjoy your games!',
|
|
priority: 'high' as const,
|
|
isActive: true,
|
|
createdAt: new Date(),
|
|
updatedAt: new Date(),
|
|
},
|
|
{
|
|
id: randomUUID(),
|
|
title: 'Court Maintenance Schedule',
|
|
content:
|
|
'Court 2 will be under maintenance this Friday from 2 PM to 4 PM. Please plan your bookings accordingly.',
|
|
priority: 'medium' as const,
|
|
isActive: true,
|
|
createdAt: new Date(),
|
|
updatedAt: new Date(),
|
|
},
|
|
{
|
|
id: randomUUID(),
|
|
title: 'New Partnership Feature',
|
|
content:
|
|
'You can now specify your playing partner when making a booking. This helps other players know who will be using the court.',
|
|
priority: 'low' as const,
|
|
isActive: true,
|
|
createdAt: new Date(),
|
|
updatedAt: new Date(),
|
|
},
|
|
];
|
|
|
|
for (const announcement of testAnnouncements) {
|
|
await db.insert(announcements).values(announcement);
|
|
}
|
|
|
|
console.log('Test announcements created successfully!');
|
|
} catch (error) {
|
|
console.error('Error creating test announcements:', error);
|
|
}
|
|
}
|
|
|
|
seedAnnouncements();
|