Initial commit - cleaned repository

This commit is contained in:
jungwoo choi
2025-09-28 20:41:57 +09:00
commit e3c28f796a
188 changed files with 28102 additions and 0 deletions

View File

@ -0,0 +1,22 @@
from motor.motor_asyncio import AsyncIOMotorClient
from beanie import init_beanie
import os
from models import User
async def init_db():
"""Initialize database connection"""
# Get MongoDB URL from environment
mongodb_url = os.getenv("MONGODB_URL", "mongodb://mongodb:27017")
db_name = os.getenv("DB_NAME", "users_db")
# Create Motor client
client = AsyncIOMotorClient(mongodb_url)
# Initialize beanie with the User model
await init_beanie(
database=client[db_name],
document_models=[User]
)
print(f"Connected to MongoDB: {mongodb_url}/{db_name}")