Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
__pycache__/
*.py[cod]
*$py.class

node_modules/

venv/
.venv/
env/

.env
.env.*

dist/
build/

.vscode/
.idea/

.DS_Store
Thumbs.db
4 changes: 3 additions & 1 deletion backend/app/core/database_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ async def initialize(self):
"""Initialize database connection pool"""
try:
# Create async engine with connection pooling
database_url = f"postgresql+asyncpg://{settings.supabase_db_user}:{settings.supabase_db_password}@{settings.supabase_db_host}:{settings.supabase_db_port}/{settings.supabase_db_name}"
database_url = settings.database_url
if database_url.startswith("postgresql://"):
database_url = database_url.replace("postgresql://", "postgresql+asyncpg://", 1)

self.engine = create_async_engine(
database_url,
Expand Down
2 changes: 1 addition & 1 deletion backend/app/services/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ async def get_revenue_summary(property_id: str, tenant_id: str) -> Dict[str, Any
"""
Fetches revenue summary, utilizing caching to improve performance.
"""
cache_key = f"revenue:{property_id}"
cache_key = f"revenue:{tenant_id}:{property_id}"

# Try to get from cache
cached = await redis_client.get(cache_key)
Expand Down
4 changes: 2 additions & 2 deletions backend/app/services/reservations.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async def calculate_total_revenue(property_id: str, tenant_id: str) -> Dict[str,
query = text("""
SELECT
property_id,
SUM(total_amount) as total_revenue,
SUM(ROUND(total_amount, 2)) as total_revenue,
COUNT(*) as reservation_count
FROM reservations
WHERE property_id = :property_id AND tenant_id = :tenant_id
Expand Down Expand Up @@ -91,7 +91,7 @@ async def calculate_total_revenue(property_id: str, tenant_id: str) -> Dict[str,
# Create property-specific mock data for testing when DB is unavailable
# This ensures each property shows different figures
mock_data = {
'prop-001': {'total': '1000.00', 'count': 3},
'prop-001': {'total': '2249.99', 'count': 4},
'prop-002': {'total': '4975.50', 'count': 4},
'prop-003': {'total': '6100.50', 'count': 2},
'prop-004': {'total': '1776.50', 'count': 4},
Expand Down