-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
feat: Add endpoint for upcoming events #7049
Changes from all commits
6e7fc4d
aa23466
73a6f97
d2484ae
3a10c5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -857,3 +857,38 @@ def clear_export_urls(event): | |
event.xcal_url = None | ||
event.pentabarf_url = None | ||
save_to_db(event) | ||
|
||
|
||
class UpcomingEventList(EventList): | ||
""" | ||
List Upcoming Events | ||
""" | ||
|
||
def before_get(self, args, kwargs): | ||
""" | ||
method for assigning schema based on admin access | ||
:param args: | ||
:param kwargs: | ||
:return: | ||
""" | ||
super().before_get(args, kwargs) | ||
self.schema.self_view_many = 'v1.upcoming_event_list' | ||
|
||
def query(self, view_kwargs): | ||
""" | ||
query method for upcoming events list | ||
:param view_kwargs: | ||
:return: | ||
""" | ||
current_time = datetime.now(pytz.utc) | ||
query_ = self.session.query(Event).filter( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not filter deleted events. Maybe that is done automatically in the library, but can you please still verify that deleted events are not being returned? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, deleted events are not returned. |
||
Event.ends_at > current_time, | ||
Event.state == 'published', | ||
Event.privacy == 'public').order_by(Event.starts_at) | ||
return query_ | ||
|
||
data_layer = { | ||
'session': db.session, | ||
'model': Event, | ||
'methods': {'query': query}, | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is already defined in superclass as well I believe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The query method is not invoked for returning the desired events without defining data_layer again in the child class. It should take methods in data_layer variable from superclass, but this isn't happening. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm. The library is not really well maintained. OK There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check other things. If they are working or not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, other things are working fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this already defined in superclass?