Skip to content

Commit ead65be

Browse files
ImTotemclaude
andcommitted
feat(filter): multi-select filtering support
Exact match fields (status, track, team, creator_id) now accept list[str] for multi-select: status: ["Regular", "Mentor"]. - list value → OR match (cell in values) - str value → exact match or substring search (unchanged) - Search fields (name, email, etc.) remain str for LIKE matching Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1983e42 commit ead65be

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

src/bcsd_api/filter/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ class PagedResponse(BaseModel, Generic[T]):
3030
size: int
3131

3232

33-
def _matches_row(row: dict, key: str, value: str, search: set[str]) -> bool:
33+
def _matches_row(row: dict, key: str, value, search: set[str]) -> bool:
3434
cell = row.get(key, "")
35+
if isinstance(value, list):
36+
return cell in value
3537
if key in search:
3638
return value.lower() in cell.lower()
3739
return cell == value

src/bcsd_api/filter/links.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
class LinkFilter(BaseFilter):
7-
creator_id: str | None = None
7+
creator_id: list[str] | str | None = None
88
expired: str | None = None
99
title: str | None = None
1010
code: str | None = None

src/bcsd_api/filter/members.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33

44
class MemberFilter(BaseFilter):
5-
status: str | None = None
6-
track: str | None = None
7-
team: str | None = None
5+
status: list[str] | str | None = None
6+
track: list[str] | str | None = None
7+
team: list[str] | str | None = None
88
name: str | None = None
99
email: str | None = None
1010
department: str | None = None

src/bcsd_api/member/types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ class MemberFilterInput:
5454
page: int = 1
5555
size: int = 20
5656
sorts: list[SortFieldInput] | None = None
57-
status: str | None = None
58-
track: str | None = None
59-
team: str | None = None
57+
status: list[str] | None = None
58+
track: list[str] | None = None
59+
team: list[str] | None = None
6060
name: str | None = None
6161
email: str | None = None
6262
department: str | None = None

src/bcsd_api/shorten/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class LinkFilterInput:
5656
page: int = 1
5757
size: int = 20
5858
sorts: list[SortFieldInput] | None = None
59-
creator_id: str | None = None
59+
creator_id: list[str] | None = None
6060
expired: str | None = None
6161
title: str | None = None
6262
code: str | None = None

0 commit comments

Comments
 (0)