Skip to content

Commit

Permalink
test_notes_get passed
Browse files Browse the repository at this point in the history
  • Loading branch information
kota-yata committed Apr 12, 2024
1 parent f111df7 commit ec777ad
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions birdxplorer/routers/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
ParticipantId,
Topic,
TweetId,
TwitterTimestamp,
UserEnrollment,
)
from ..storage import Storage
Expand Down Expand Up @@ -38,21 +39,21 @@ def get_topics() -> TopicListResponse:

@router.get("/notes", response_model=NoteListResponse)
def get_notes(
note_ids: Union[List[NoteId], None] = Query(default=None),
created_at_from: Union[None, int, str] = Query(default=None),
created_at_to: Union[None, int, str] = Query(default=None),
topic_ids: Union[List[str], None] = Query(default=None),
post_ids: Union[List[TweetId], None] = Query(default=None),
note_ids: Union[List[NoteId], None] = Query(default=None, alias="noteIds"),
created_at_from: Union[None, int] = Query(default=None, alias="createdAtFrom"),
created_at_to: Union[None, int] = Query(default=None, alias="createdAtTo"),
topic_ids: Union[List[str], None] = Query(default=None, alias="topicIds"),
post_ids: Union[List[TweetId], None] = Query(default=None, alias="postIds"),
language: Union[str, None] = Query(default=None),
) -> NoteListResponse:
filters = {}

if note_ids is not None:
filters["note_ids"] = note_ids
if created_at_from is not None:
filters["created_at_from"] = created_at_from
filters["created_at_from"] = TwitterTimestamp.from_int(created_at_from)
if created_at_to is not None:
filters["created_at_to"] = created_at_to
filters["created_at_to"] = TwitterTimestamp.from_int(created_at_to)
if topic_ids is not None:
filters["topic_ids"] = topic_ids
if post_ids is not None:
Expand Down

0 comments on commit ec777ad

Please sign in to comment.