57 lines
1.1 KiB
Python
57 lines
1.1 KiB
Python
from datetime import datetime
|
|
from typing import Optional
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class AnnouncementResponse(BaseModel):
|
|
id: int
|
|
title: str
|
|
publish_date: datetime
|
|
purchase_name: str
|
|
content_url: str
|
|
source_code: str
|
|
source_name: str
|
|
announcement_type: str
|
|
crawl_mode: str
|
|
is_new: bool
|
|
is_sent: bool
|
|
keyword_matched: bool
|
|
created_at: datetime
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class AnnouncementListResponse(BaseModel):
|
|
total: int
|
|
page: int
|
|
page_size: int
|
|
items: list[AnnouncementResponse]
|
|
|
|
|
|
class CrawlTriggerRequest(BaseModel):
|
|
keywords: Optional[list[str]] = None
|
|
sources: Optional[list[str]] = None
|
|
manual: bool = False
|
|
|
|
|
|
class CrawlStatusResponse(BaseModel):
|
|
running: bool
|
|
last_crawl_time: Optional[datetime] = None
|
|
total_sources: int
|
|
|
|
|
|
class SourceInfo(BaseModel):
|
|
code: str
|
|
name: str
|
|
type: str
|
|
|
|
|
|
class SourcesResponse(BaseModel):
|
|
sources: list[SourceInfo]
|
|
|
|
|
|
class JobResponse(BaseModel):
|
|
id: str
|
|
name: str
|
|
next_run_time: Optional[str] = None
|