- ci.yml: API lint (ruff F+I) + pytest, web vue-tsc + vitest + build - mirror.yml: push to GitHub (CircuitForgeLLC) + Codeberg (CircuitForge) on main/tags - release.yml: Docker build → Forgejo registry + release via API; GHCR deferred pending BSL policy (cf-agents#3) - .cliff.toml: git-cliff changelog config for semver releases - pyproject.toml: add [dev] extras (pytest, ruff), ruff config - Fix 45 ruff violations across codebase (import sorting, unused vars, unused imports)
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
"""PlatformAdapter abstract base and shared types."""
|
|
from __future__ import annotations
|
|
|
|
from abc import ABC, abstractmethod
|
|
from dataclasses import dataclass, field
|
|
from typing import Optional
|
|
|
|
from app.db.models import Listing, Seller
|
|
|
|
|
|
@dataclass
|
|
class SearchFilters:
|
|
max_price: Optional[float] = None
|
|
min_price: Optional[float] = None
|
|
condition: Optional[list[str]] = field(default_factory=list)
|
|
location_radius_km: Optional[int] = None
|
|
pages: int = 1 # number of result pages to fetch (48 listings/page)
|
|
must_include: list[str] = field(default_factory=list) # client-side title filter
|
|
must_exclude: list[str] = field(default_factory=list) # forwarded to eBay -term AND client-side
|
|
category_id: Optional[str] = None # eBay category ID (e.g. "27386" = GPUs)
|
|
|
|
|
|
class PlatformAdapter(ABC):
|
|
@abstractmethod
|
|
def search(self, query: str, filters: SearchFilters) -> list[Listing]: ...
|
|
|
|
@abstractmethod
|
|
def get_seller(self, seller_platform_id: str) -> Optional[Seller]: ...
|
|
|
|
@abstractmethod
|
|
def get_completed_sales(self, query: str) -> list[Listing]:
|
|
"""Fetch recently completed/sold listings for price comp data."""
|
|
...
|