This commit is contained in:
Iliyan Angelov
2025-12-03 01:31:34 +02:00
parent e32527ae8c
commit 5fb50983a9
37 changed files with 5844 additions and 201 deletions

View File

@@ -1,11 +1,13 @@
import sys
import os
from pathlib import Path
# Add both the seeds_data directory and the Backend directory to the path
sys.path.insert(0, str(Path(__file__).parent))
sys.path.insert(0, str(Path(__file__).parent.parent))
from sqlalchemy.orm import Session
from src.shared.config.database import SessionLocal, engine
from src.models.room import Room, RoomStatus
from src.models.room_type import RoomType
from src.rooms.models.room import Room, RoomStatus
from src.rooms.models.room_type import RoomType
from datetime import datetime
import json
import random
@@ -28,9 +30,9 @@ def seed_rooms(db: Session):
print(f'\n✓ Found {len(room_types)} room type(s)')
for rt in room_types:
print(f' - {rt.name} (ID: {rt.id}, Base Price: {rt.base_price})')
from src.models.booking import Booking
from src.models.review import Review
from src.models.favorite import Favorite
from src.bookings.models.booking import Booking
from src.reviews.models.review import Review
from src.reviews.models.favorite import Favorite
existing_rooms = db.query(Room).all()
if existing_rooms:
print(f'\n🗑️ Deleting {len(existing_rooms)} existing room(s)...')