Initial commit: SIBU 2.0 MISSION
This commit is contained in:
84
backend/seed_shuttles.py
Normal file
84
backend/seed_shuttles.py
Normal file
@ -0,0 +1,84 @@
|
||||
from app.core.database import engine, init_db
|
||||
from app.models.shuttle import Shuttle
|
||||
from sqlmodel import Session, select
|
||||
import uuid
|
||||
|
||||
def seed_shuttles():
|
||||
# Ensure table exists
|
||||
init_db()
|
||||
|
||||
shuttles_data = [
|
||||
{
|
||||
'route_name': 'Boquete > Santa Catalina',
|
||||
'origin': 'Boquete',
|
||||
'destination': 'Santa Catalina',
|
||||
'vehicle_type': 'Mini Van Compartida',
|
||||
'company_name': 'Chiriqui Transfers',
|
||||
'trip_type': 'one_way',
|
||||
'price_per_person': 35.0,
|
||||
'price_private_trip': 180.0,
|
||||
'estimated_duration': '4.5 horas',
|
||||
'departure_times': 'Todos los días 8:00 AM',
|
||||
'contact_whatsapp': '+50760000000',
|
||||
'description': 'Viaje directo desde el centro de Boquete hasta Santa Catalina. Ideal para surfistas y turistas.',
|
||||
'is_active': True
|
||||
},
|
||||
{
|
||||
'route_name': 'Boquete > Bocas del Toro',
|
||||
'origin': 'Boquete',
|
||||
'destination': 'Bocas del Toro',
|
||||
'vehicle_type': 'Mini Van + Bote',
|
||||
'company_name': 'Hello Panama Tours',
|
||||
'trip_type': 'one_way',
|
||||
'price_per_person': 30.0,
|
||||
'price_private_trip': 150.0,
|
||||
'estimated_duration': '3.5 horas',
|
||||
'departure_times': 'Diario 8:00 AM / 12:00 PM',
|
||||
'contact_whatsapp': '+50760000000',
|
||||
'description': 'Incluye transporte terrestre hasta Almirante y el bote taxi hacia Isla Colón.',
|
||||
'is_active': True
|
||||
},
|
||||
{
|
||||
'route_name': 'Boquete > Las Lajas',
|
||||
'origin': 'Boquete',
|
||||
'destination': 'Las Lajas',
|
||||
'vehicle_type': 'Vehículo Privado',
|
||||
'company_name': 'Express Boquete',
|
||||
'trip_type': 'both',
|
||||
'price_per_person': 20.0,
|
||||
'price_private_trip': 100.0,
|
||||
'estimated_duration': '2 horas',
|
||||
'departure_times': 'Bajo demanda',
|
||||
'contact_whatsapp': '+50760000000',
|
||||
'description': 'Transporte directo a la playa de Las Lajas. Regreso incluido opcional.',
|
||||
'is_active': True
|
||||
},
|
||||
{
|
||||
'route_name': 'Boquete > Puerto Armuelles',
|
||||
'origin': 'Boquete',
|
||||
'destination': 'Puerto Armuelles',
|
||||
'vehicle_type': 'Sedán Privado',
|
||||
'company_name': 'Taxi Chiriqui',
|
||||
'trip_type': 'one_way',
|
||||
'price_per_person': 25.0,
|
||||
'price_private_trip': 120.0,
|
||||
'estimated_duration': '2.5 horas',
|
||||
'departure_times': 'Bajo demanda',
|
||||
'contact_whatsapp': '+50760000000',
|
||||
'description': 'Viaje cómodo y seguro hacia el puerto y las playas del sur.',
|
||||
'is_active': True
|
||||
}
|
||||
]
|
||||
|
||||
with Session(engine) as session:
|
||||
for data in shuttles_data:
|
||||
statement = select(Shuttle).where(Shuttle.route_name == data['route_name'])
|
||||
existing = session.exec(statement).first()
|
||||
if not existing:
|
||||
shuttle = Shuttle(**data)
|
||||
session.add(shuttle)
|
||||
session.commit()
|
||||
print(f"✅ Inserted shuttles successfully!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
seed_shuttles()
|
||||
Reference in New Issue
Block a user