Refactor geo re-resolve endpoint into geo_service and add typed response

This commit is contained in:
2026-04-15 08:56:37 +02:00
parent 2451ec77b2
commit a8f2d2d7b9
7 changed files with 115 additions and 31 deletions

View File

@@ -57,6 +57,19 @@ class GeoCacheStatsResponse(BaseModel):
dirty_size: int = Field(..., description="Number of newly resolved entries not yet flushed to disk.")
class GeoReResolveResponse(BaseModel):
"""Response for ``POST /api/geo/re-resolve``.
Reports how many previously unresolved IPs were retried and how many
gained a resolved country code after the re-resolve operation.
"""
model_config = ConfigDict(strict=True)
resolved: int = Field(..., description="Number of IPs successfully resolved.")
total: int = Field(..., description="Number of IPs retried.")
class IpLookupResponse(BaseModel):
"""Response for ``GET /api/geo/lookup/{ip}``.