38 lines
961 B
Python
38 lines
961 B
Python
from fastapi import APIRouter, Depends, HTTPException
|
|
from core.database import fake_users_db
|
|
import uuid
|
|
|
|
router = APIRouter()
|
|
|
|
@router.post("/d")
|
|
async def create_db_handler():
|
|
"""Create a new demo database"""
|
|
db_id = str(uuid.uuid4())
|
|
|
|
if "databases" not in fake_users_db:
|
|
fake_users_db["databases"] = {}
|
|
|
|
fake_users_db["databases"][db_id] = {
|
|
"id": db_id,
|
|
"created_at": "2024-01-01T00:00:00Z",
|
|
"status": "active",
|
|
"tables": [],
|
|
"settings": {
|
|
"max_connections": 100,
|
|
"timeout": 30
|
|
}
|
|
}
|
|
|
|
return {
|
|
"message": "Database created successfully",
|
|
"db_id": db_id,
|
|
"metadata": {
|
|
"created_at": "2024-01-01T00:00:00Z",
|
|
"region": "demo-region"
|
|
},
|
|
"next_steps": [
|
|
"Configure database settings",
|
|
"Create tables",
|
|
"Set up backup schedule"
|
|
]
|
|
} |