auto-commit for 8ed86e4d-a0e9-4c5c-b2b5-313c1bc955e5

This commit is contained in:
emergent-agent-e1
2026-03-31 17:02:14 +00:00
parent ee2daae936
commit 6488998a87
6 changed files with 14 additions and 6 deletions
+2
View File
@@ -1,3 +1,5 @@
MONGO_URL="mongodb://localhost:27017"
DB_NAME="test_database"
CORS_ORIGINS="*"
JWT_SECRET_KEY="8f3a9c2e1d7b4f6a5c8e2d9a7b3f5c1e4a6d8b2c9e5f7a3d1c4b6e8a2f5d7c9b"
ADMIN_DEFAULT_PASSWORD="Joker1974!!!"
+7 -1
View File
@@ -5,9 +5,15 @@ from passlib.context import CryptContext
from fastapi import HTTPException, Security, Depends
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
import os
from dotenv import load_dotenv
from pathlib import Path
# Load environment variables
ROOT_DIR = Path(__file__).parent
load_dotenv(ROOT_DIR / '.env')
# JWT Configuration
SECRET_KEY = os.environ.get("JWT_SECRET_KEY", "your-secret-key-change-in-production-epic-travel-2025")
SECRET_KEY = os.environ['JWT_SECRET_KEY']
ALGORITHM = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES = 1440 # 24 hours
+1 -1
View File
@@ -28,7 +28,7 @@ async def get_destinations(category: Optional[str] = None, search: Optional[str]
{"location": {"$regex": search, "$options": "i"}}
]
destinations = await db.destinations.find(query).to_list(1000)
destinations = await db.destinations.find(query, {'_id': 0}).limit(100).to_list(100)
# Convert MongoDB _id to id for response
for dest in destinations:
+1 -1
View File
@@ -17,7 +17,7 @@ def set_db(database):
@router.get("", response_model=List[Special])
async def get_specials():
"""Get all weekly specials"""
specials = await db.specials.find().to_list(1000)
specials = await db.specials.find({}, {'_id': 0}).limit(100).to_list(100)
# Convert MongoDB _id to id for response
for special in specials:
+1 -1
View File
@@ -64,7 +64,7 @@ async def startup_db_client():
admin_data = {
"id": "admin-1",
"email": "admin@epictravel.com",
"password_hash": hash_password("Joker1974!!!"),
"password_hash": hash_password(os.environ['ADMIN_DEFAULT_PASSWORD']),
"created_at": datetime.utcnow()
}
await db.admin_users.insert_one(admin_data)
+1 -1
View File
@@ -25,7 +25,7 @@ const AdminLogin = () => {
navigate('/admin/dashboard');
} catch (error) {
console.error('Login error:', error);
toast.error('Invalid credentials. Try: admin@epictravel.com / admin123');
toast.error('Invalid email or password. Please try again.');
} finally {
setLoading(false);
}