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

35 lines
1.0 KiB
Python

from typing import Any, List
from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.orm import Session
from app.core.deps import get_db
from app.models.cryptocurrency import Cryptocurrency
from app.schemas.cryptocurrency import Cryptocurrency as CryptocurrencySchema
router = APIRouter()
@router.get("/", response_model=List[CryptocurrencySchema])
def read_cryptocurrencies(
skip: int = 0,
limit: int = 100,
db: Session = Depends(get_db),
) -> Any:
cryptocurrencies = db.query(Cryptocurrency).filter(
Cryptocurrency.is_active
).offset(skip).limit(limit).all()
return cryptocurrencies
@router.get("/{cryptocurrency_id}", response_model=CryptocurrencySchema)
def read_cryptocurrency(
cryptocurrency_id: int,
db: Session = Depends(get_db),
) -> Any:
cryptocurrency = db.query(Cryptocurrency).filter(
Cryptocurrency.id == cryptocurrency_id
).first()
if not cryptocurrency:
raise HTTPException(status_code=404, detail="Cryptocurrency not found")
return cryptocurrency