mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-21 02:31:08 -05:00
Initialize frontend project with Next.js, Tailwind CSS, and essential configurations
This commit is contained in:
148
frontend/prisma/seed.ts
Normal file
148
frontend/prisma/seed.ts
Normal file
@@ -0,0 +1,148 @@
|
||||
import { PrismaClient, ParkStatus } from '@prisma/client';
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
// Create test users
|
||||
const user1 = await prisma.user.create({
|
||||
data: {
|
||||
email: 'admin@thrillwiki.com',
|
||||
username: 'admin',
|
||||
password: 'hashed_password_here',
|
||||
isActive: true,
|
||||
isStaff: true,
|
||||
isSuperuser: true,
|
||||
},
|
||||
});
|
||||
|
||||
const user2 = await prisma.user.create({
|
||||
data: {
|
||||
email: 'testuser@thrillwiki.com',
|
||||
username: 'testuser',
|
||||
password: 'hashed_password_here',
|
||||
isActive: true,
|
||||
},
|
||||
});
|
||||
|
||||
// Create test companies
|
||||
const company1 = await prisma.company.create({
|
||||
data: {
|
||||
name: 'Universal Parks & Resorts',
|
||||
website: 'https://www.universalparks.com',
|
||||
},
|
||||
});
|
||||
|
||||
const company2 = await prisma.company.create({
|
||||
data: {
|
||||
name: 'Cedar Fair Entertainment Company',
|
||||
website: 'https://www.cedarfair.com',
|
||||
},
|
||||
});
|
||||
|
||||
// Create test parks
|
||||
const park1 = await prisma.park.create({
|
||||
data: {
|
||||
name: 'Universal Studios Florida',
|
||||
slug: 'universal-studios-florida',
|
||||
description: 'Movie and TV-based theme park in Orlando, Florida',
|
||||
status: ParkStatus.OPERATING,
|
||||
location: {
|
||||
latitude: 28.4742,
|
||||
longitude: -81.4678,
|
||||
},
|
||||
opening_date: new Date('1990-06-07'),
|
||||
operating_season: 'Year-round',
|
||||
size_acres: 108,
|
||||
website: 'https://www.universalorlando.com',
|
||||
average_rating: 4.5,
|
||||
ride_count: 25,
|
||||
coaster_count: 2,
|
||||
creatorId: user1.id,
|
||||
ownerId: company1.id,
|
||||
areas: {
|
||||
create: [
|
||||
{
|
||||
name: 'Production Central',
|
||||
slug: 'production-central',
|
||||
description: 'The main entrance area of the park',
|
||||
opening_date: new Date('1990-06-07'),
|
||||
},
|
||||
{
|
||||
name: 'New York',
|
||||
slug: 'new-york',
|
||||
description: 'Themed after New York City streets',
|
||||
opening_date: new Date('1990-06-07'),
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const park2 = await prisma.park.create({
|
||||
data: {
|
||||
name: 'Cedar Point',
|
||||
slug: 'cedar-point',
|
||||
description: 'The Roller Coaster Capital of the World',
|
||||
status: ParkStatus.OPERATING,
|
||||
location: {
|
||||
latitude: 41.4822,
|
||||
longitude: -82.6837,
|
||||
},
|
||||
opening_date: new Date('1870-05-01'),
|
||||
operating_season: 'May through October',
|
||||
size_acres: 364,
|
||||
website: 'https://www.cedarpoint.com',
|
||||
average_rating: 4.8,
|
||||
ride_count: 71,
|
||||
coaster_count: 17,
|
||||
creatorId: user1.id,
|
||||
ownerId: company2.id,
|
||||
areas: {
|
||||
create: [
|
||||
{
|
||||
name: 'FrontierTown',
|
||||
slug: 'frontiertown',
|
||||
description: 'Western-themed area of the park',
|
||||
opening_date: new Date('1968-05-01'),
|
||||
},
|
||||
{
|
||||
name: 'Millennium Island',
|
||||
slug: 'millennium-island',
|
||||
description: 'Home of the Millennium Force',
|
||||
opening_date: new Date('2000-05-13'),
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Create test reviews
|
||||
await prisma.review.create({
|
||||
data: {
|
||||
content: 'Amazing theme park with great attention to detail!',
|
||||
rating: 5,
|
||||
parkId: park1.id,
|
||||
userId: user2.id,
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.review.create({
|
||||
data: {
|
||||
content: 'Best roller coasters in the world!',
|
||||
rating: 5,
|
||||
parkId: park2.id,
|
||||
userId: user2.id,
|
||||
},
|
||||
});
|
||||
|
||||
console.log('Seed data created successfully');
|
||||
}
|
||||
|
||||
main()
|
||||
.catch((e) => {
|
||||
console.error('Error creating seed data:', e);
|
||||
process.exit(1);
|
||||
})
|
||||
.finally(async () => {
|
||||
await prisma.$disconnect();
|
||||
});
|
||||
Reference in New Issue
Block a user