diff --git a/backend/VERSION b/backend/VERSION new file mode 100644 index 0000000..0b1f1ed --- /dev/null +++ b/backend/VERSION @@ -0,0 +1 @@ +1.2.13 diff --git a/backend/app/routers/collections.py b/backend/app/routers/collections.py index ea44f59..fd741e0 100644 --- a/backend/app/routers/collections.py +++ b/backend/app/routers/collections.py @@ -121,6 +121,7 @@ def get_collections( sortBy: str = Query('createdAt'), sortOrder: str = Query('desc'), all_users: bool = Query(False, description="return all users data for admin"), + user_id: str = Query(None, description="filter by user id"), current_user: User = Depends(get_current_user), db: Session = Depends(get_db) ): @@ -138,6 +139,10 @@ def get_collections( else: query = db.query(Collection).filter(Collection.f99_91_user_id == current_user.f99_90_id) + # 如果指定了user_id参数,则只返回该用户的藏品 + if user_id: + query = query.filter(Collection.f99_91_user_id == user_id) + if category: query = query.filter(Collection.f01_03_category == category) if status: diff --git a/config/VERSION b/config/VERSION index dedc56c..0b1f1ed 100644 --- a/config/VERSION +++ b/config/VERSION @@ -1 +1 @@ -VERSION=1.2.12 +1.2.13