-
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
Conversation
app/api/events.py
Outdated
query_ = self.session.query(Event).filter( | ||
Event.ends_at > current_time, | ||
Event.state=='published', | ||
Event.privacy=='public').order_by(Event.starts_at) |
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.
missing whitespace around operator
app/api/events.py
Outdated
current_time = datetime.now(pytz.utc) | ||
query_ = self.session.query(Event).filter( | ||
Event.ends_at > current_time, | ||
Event.state=='published', |
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.
missing whitespace around operator
else: | ||
self.schema = EventSchemaPublic | ||
|
||
self.schema.self_view_many = 'v1.upcoming_event_list' |
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?
'session': db.session, | ||
'model': Event, | ||
'methods': {'query': query}, | ||
} |
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.
This is already defined in superclass as well I believe
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.
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 comment
The 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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, other things are working fine.
Please also add a dredd test in the docs to ensure it works and conforms to the docs |
Codecov Report
@@ Coverage Diff @@
## development #7049 +/- ##
============================================
Coverage 61.15% 61.16%
============================================
Files 260 260
Lines 12881 12894 +13
============================================
+ Hits 7878 7887 +9
- Misses 5003 5007 +4
Continue to review full report at Codecov.
|
This pull request fixes 1 alert when merging aa23466 into 98aca7d - view on LGTM.com fixed alerts:
|
I am quite confused if the URL parameters filter and sort should still be added to the docs, as one may want to further filter these events ? |
You just need to add the URL without filter and sorting |
This pull request fixes 1 alert when merging 73a6f97 into 98e6c5c - view on LGTM.com fixed alerts:
|
Actual response returned no events https://app.apiary.io/public/tests/run/acb5ac2f-cba0-44d1-bd68-48248bc5ede0 |
Also, remove the page size and number |
: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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, deleted events are not returned.
This pull request fixes 1 alert when merging d2484ae into 98e6c5c - view on LGTM.com fixed alerts:
|
Don't know why test hasn't run https://app.apiary.io/public/tests/run/245ae4a9-6419-48ef-bad2-20e669787022 |
Working fine. Can you please change PR title to match semantic guidelines? |
This pull request fixes 1 alert when merging 3a10c5c into 98e6c5c - view on LGTM.com fixed alerts:
|
Fixes #6955
Short description of what this resolves:
The filtering for upcoming events is done on the frontend using the filter query parameter. This should be handled by the server, so an endpoint /events/upcoming is created to automatically return the upcoming events.
Checklist
development
branch.