Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix getRecordings endpoint #131

Merged
merged 3 commits into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# ChangeLog

## 3.2.4 - 2024-06-15

Fixes:
- fix bug in getRecordings endpoint
PhilippKilian marked this conversation as resolved.
Show resolved Hide resolved

## 3.2.3 - 2024-05-28

Fixes:
Expand Down
14 changes: 6 additions & 8 deletions b3lb/rest/classes/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def allowed_methods(self) -> List[Literal["GET", "POST", "DELETE", "PATCH", "PUT

def filter_recordings(self, meeting_id: str = "", recording_id: str = "") -> QuerySet[Record]:
if self.state and self.state not in ["unpublished", "published"]:
return QuerySet(model=Record) # return empty QuerySet if state isn't in allowed states
return Record.objects.none() # return empty QuerySet if state isn't in allowed states

query = Q(record_set__secret=self.secret)

Expand All @@ -344,14 +344,12 @@ def filter_recordings(self, meeting_id: str = "", recording_id: str = "") -> Que
UUID(recording_id)
query &= Q(uuid=recording_id)
except ValueError:
return QuerySet(model=Record) # return empty QuerySet for BadRequest
return Record.objects.none() # return empty QuerySet for BadRequest

if meeting_id:
try:
UUID(meeting_id)
query %= Q(record_set__meta_meeting_id=meeting_id)
except ValueError:
return QuerySet(model=Record) # return empty QuerySet for BadRequest
if meeting_id and 2 <= len(self.meeting_id) <= cst.MEETING_ID_LENGTH:
query &= Q(record_set__meta_meeting_id=meeting_id)
elif meeting_id:
PhilippKilian marked this conversation as resolved.
Show resolved Hide resolved
return Record.objects.none() # return empty QuerySet for BadRequest

if self.state == "published":
query &= Q(published=True)
Expand Down
Loading