Some checks failed
Release / release (push) Has been cancelled
Full-stack dashboard for controlling, automating, and analyzing Artifacts MMO characters via the game's HTTP API. Backend (FastAPI): - Async Artifacts API client with rate limiting and retry - 6 automation strategies (combat, gathering, crafting, trading, task, leveling) - Automation engine with runner, manager, cooldown tracker, pathfinder - WebSocket relay (game server -> frontend) - Game data cache, character snapshots, price history, analytics - 9 API routers, 7 database tables, 3 Alembic migrations - 108 unit tests Frontend (Next.js 15 + shadcn/ui): - Live character dashboard with HP/XP bars and cooldowns - Character detail with stats, equipment, inventory, skills, manual actions - Automation management with live log streaming - Interactive canvas map with content-type coloring and zoom/pan - Bank management, Grand Exchange with price charts - Events, logs, analytics pages with Recharts - WebSocket auto-reconnect with query cache invalidation - Settings page, error boundaries, dark theme Infrastructure: - Docker Compose (dev + prod) - GitHub Actions CI/CD - Documentation (Architecture, Automation, Deployment, API)
52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
from fastapi import APIRouter, Depends, Request
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.database import get_db
|
|
from app.schemas.game import ItemSchema, MapSchema, MonsterSchema, ResourceSchema
|
|
from app.services.game_data_cache import GameDataCacheService
|
|
|
|
router = APIRouter(prefix="/api/game", tags=["game-data"])
|
|
|
|
|
|
def _get_cache_service(request: Request) -> GameDataCacheService:
|
|
return request.app.state.cache_service
|
|
|
|
|
|
@router.get("/items", response_model=list[ItemSchema])
|
|
async def list_items(
|
|
request: Request,
|
|
db: AsyncSession = Depends(get_db),
|
|
) -> list[ItemSchema]:
|
|
"""Return all items from the local cache."""
|
|
service = _get_cache_service(request)
|
|
return await service.get_items(db)
|
|
|
|
|
|
@router.get("/monsters", response_model=list[MonsterSchema])
|
|
async def list_monsters(
|
|
request: Request,
|
|
db: AsyncSession = Depends(get_db),
|
|
) -> list[MonsterSchema]:
|
|
"""Return all monsters from the local cache."""
|
|
service = _get_cache_service(request)
|
|
return await service.get_monsters(db)
|
|
|
|
|
|
@router.get("/resources", response_model=list[ResourceSchema])
|
|
async def list_resources(
|
|
request: Request,
|
|
db: AsyncSession = Depends(get_db),
|
|
) -> list[ResourceSchema]:
|
|
"""Return all resources from the local cache."""
|
|
service = _get_cache_service(request)
|
|
return await service.get_resources(db)
|
|
|
|
|
|
@router.get("/maps", response_model=list[MapSchema])
|
|
async def list_maps(
|
|
request: Request,
|
|
db: AsyncSession = Depends(get_db),
|
|
) -> list[MapSchema]:
|
|
"""Return all maps from the local cache."""
|
|
service = _get_cache_service(request)
|
|
return await service.get_maps(db)
|