Automated Action b9798f0eaf Implement comprehensive crypto P2P trading platform
- Complete FastAPI application with JWT authentication
- SQLite database with SQLAlchemy ORM and Alembic migrations
- User registration/login with secure password hashing
- Multi-cryptocurrency wallet system with balance tracking
- Advertisement system for buy/sell listings with fund locking
- Order management with automatic payment integration
- Payment provider API integration with mock fallback
- Automatic crypto release after payment confirmation
- Health monitoring endpoint and CORS configuration
- Comprehensive API documentation with OpenAPI/Swagger
- Database models for users, wallets, ads, orders, and payments
- Complete CRUD operations for all entities
- Security features including fund locking and order expiration
- Detailed README with setup and usage instructions

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-26 14:48:18 +00:00

39 lines
1.1 KiB
Python

from typing import Any
from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session
from app.core.deps import get_current_active_user, get_db
from app.models.user import User
from app.schemas.user import User as UserSchema, UserUpdate
router = APIRouter()
@router.get("/me", response_model=UserSchema)
def read_user_me(
db: Session = Depends(get_db),
current_user: User = Depends(get_current_active_user),
) -> Any:
return current_user
@router.put("/me", response_model=UserSchema)
def update_user_me(
*,
db: Session = Depends(get_db),
user_in: UserUpdate,
current_user: User = Depends(get_current_active_user),
) -> Any:
if user_in.email is not None:
current_user.email = user_in.email
if user_in.username is not None:
current_user.username = user_in.username
if user_in.password is not None:
from app.core.security import get_password_hash
current_user.hashed_password = get_password_hash(user_in.password)
db.add(current_user)
db.commit()
db.refresh(current_user)
return current_user