🔥 refactor(store.py): remove unused imports and commented out code
🔒 chore(store.py): pass 'liked' parameter to 'update_components_with_user_data' function to improve code readability and maintainability
This commit is contained in:
parent
bd4e88273b
commit
dfcee85374
1 changed files with 1 additions and 37 deletions
|
|
@ -1,4 +1,3 @@
|
|||
from datetime import datetime
|
||||
from typing import Annotated, Any, Dict, List, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
|
|
@ -124,7 +123,7 @@ def get_components(
|
|||
# Now, from the result, we need to get the components
|
||||
# the user likes and set the liked_by_user to True
|
||||
try:
|
||||
updated_result = update_components_with_user_data(result, store_service, store_api_Key)
|
||||
updated_result = update_components_with_user_data(result, store_service, store_api_Key, liked=liked)
|
||||
authorized = True
|
||||
result = updated_result
|
||||
except Exception:
|
||||
|
|
@ -160,41 +159,6 @@ def read_component(
|
|||
return component
|
||||
|
||||
|
||||
@router.get("/search", response_model=List[ComponentResponse])
|
||||
async def search_endpoint(
|
||||
query: str = Query(...),
|
||||
page: int = Query(1),
|
||||
limit: int = Query(10),
|
||||
status: Optional[str] = Query(None),
|
||||
is_component: Optional[bool] = Query(None),
|
||||
tags: Optional[List[str]] = Query(None),
|
||||
date_from: Optional[datetime] = Query(None),
|
||||
date_to: Optional[datetime] = Query(None),
|
||||
sort: Optional[List[str]] = Query(None),
|
||||
filter_by_user: bool = Query(False),
|
||||
fields: Optional[List[str]] = Query(None),
|
||||
store_service: "StoreService" = Depends(get_store_service),
|
||||
store_api_Key: str = Depends(get_optional_user_store_api_key),
|
||||
):
|
||||
try:
|
||||
return store_service.search(
|
||||
api_key=store_api_Key,
|
||||
query=query,
|
||||
page=page,
|
||||
limit=limit,
|
||||
status=status,
|
||||
is_component=is_component,
|
||||
tags=tags,
|
||||
date_from=date_from,
|
||||
date_to=date_to,
|
||||
sort=sort,
|
||||
fields=fields,
|
||||
filter_by_user=filter_by_user,
|
||||
)
|
||||
except Exception as exc:
|
||||
raise HTTPException(status_code=500, detail=str(exc))
|
||||
|
||||
|
||||
@router.get("/tags", response_model=List[TagResponse])
|
||||
def get_tags(
|
||||
store_service: StoreService = Depends(get_store_service),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue