Fix deprecated Pydantic features: replace dict() with model_dump(), orm_mode with from_attributes, and schema_extra with json_schema_extra
This commit is contained in:
parent
42eb59bdfe
commit
39d270fbec
|
@ -38,7 +38,7 @@ async def execute_search(
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
search_results = await search_service.execute_search(
|
search_results = await search_service.execute_search(
|
||||||
search_in.structured_query,
|
search_in.structured_query.model_dump(),
|
||||||
search_in.search_engines,
|
search_in.search_engines,
|
||||||
search_in.num_results,
|
search_in.num_results,
|
||||||
search_in.timeout,
|
search_in.timeout,
|
||||||
|
@ -142,7 +142,7 @@ async def delete_search(
|
||||||
search_id: str,
|
search_id: str,
|
||||||
current_user: User = Depends(get_current_active_user),
|
current_user: User = Depends(get_current_active_user),
|
||||||
db: Session = Depends(get_db),
|
db: Session = Depends(get_db),
|
||||||
) -> Any:
|
) -> None:
|
||||||
"""
|
"""
|
||||||
Delete a search from history.
|
Delete a search from history.
|
||||||
|
|
||||||
|
@ -166,5 +166,3 @@ async def delete_search(
|
||||||
|
|
||||||
db.delete(search)
|
db.delete(search)
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ class ProcessedQuery(BaseModel):
|
||||||
class Config:
|
class Config:
|
||||||
"""Pydantic config."""
|
"""Pydantic config."""
|
||||||
|
|
||||||
schema_extra = {
|
json_schema_extra = {
|
||||||
"example": {
|
"example": {
|
||||||
"original_query": "What are the latest advancements in quantum computing?",
|
"original_query": "What are the latest advancements in quantum computing?",
|
||||||
"structured_query": {
|
"structured_query": {
|
||||||
|
|
|
@ -50,7 +50,7 @@ class ReportInDBBase(ReportBase):
|
||||||
class Config:
|
class Config:
|
||||||
"""Pydantic config."""
|
"""Pydantic config."""
|
||||||
|
|
||||||
orm_mode = True
|
from_attributes = True
|
||||||
|
|
||||||
|
|
||||||
class Report(ReportInDBBase):
|
class Report(ReportInDBBase):
|
||||||
|
|
|
@ -65,7 +65,7 @@ class SearchHistory(BaseModel):
|
||||||
class Config:
|
class Config:
|
||||||
"""Pydantic config."""
|
"""Pydantic config."""
|
||||||
|
|
||||||
orm_mode = True
|
from_attributes = True
|
||||||
|
|
||||||
|
|
||||||
class SearchHistoryList(BaseModel):
|
class SearchHistoryList(BaseModel):
|
||||||
|
|
|
@ -37,9 +37,7 @@ class UserInDBBase(UserBase):
|
||||||
id: Optional[str] = None
|
id: Optional[str] = None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
"""Pydantic config."""
|
from_attributes = True
|
||||||
|
|
||||||
orm_mode = True
|
|
||||||
|
|
||||||
|
|
||||||
class User(UserInDBBase):
|
class User(UserInDBBase):
|
||||||
|
|
Loading…
Reference in New Issue