To support displaying HTTP status codes in the Crawl Queue UI, the data model for URL tracking must transition from a simple string-based status to a structured object.
Backend (Python/Pydantic):
Use a UrlDetails model to ensure type safety when storing status information.
class UrlDetails(BaseModel):
status: str
statusCode: Optional[int] = None
The CrawlJobStatus model should then be updated to use this structure:
urls: dict[str, UrlDetails]
Frontend (TypeScript):
Define a corresponding UrlDetails interface to match the backend structure:
interface UrlDetails {
status: UrlStatus;
statusCode: number | null;
}
Update the CrawlJobStatus and CrawlUrlsProps interfaces to use this new record type:
urls: Record<string, UrlDetails>
class UrlDetails(BaseModel):
status: str
statusCode: Optional[int] = None
interface UrlDetails {
status: UrlStatus;
statusCode: number | null;
}