-
Notifications
You must be signed in to change notification settings - Fork 2
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
REST API for channels #39
Conversation
Codecov Report
@@ Coverage Diff @@
## master #39 +/- ##
=========================================
+ Coverage 89.21% 90.6% +1.39%
=========================================
Files 18 22 +4
Lines 519 575 +56
Branches 38 41 +3
=========================================
+ Hits 463 521 +58
+ Misses 46 42 -4
- Partials 10 12 +2
Continue to review full report at Codecov.
|
94055a5
to
179c6b6
Compare
channels/serializers.py
Outdated
api.user = True | ||
|
||
name = instance.display_name | ||
key_map = { |
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.
Could this be a module-level constant instead?
channels/serializers.py
Outdated
|
||
def update(self, instance, validated_data): | ||
api = Api() | ||
api.user = True |
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.
I could see this burning us later on, I think maybe it's better to just comment out any validation code (an early return from _assert_authenticated
should suffice to avoid this.
channels/serializers.py
Outdated
name = instance.display_name | ||
key_map = { | ||
'title': 'title', | ||
'channel_type': 'subreddit_type', |
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 arg for update_channel
is actually also channel_type
so this mapping is unnecessary and actually causing updates to channel_type
to not work. update_channel validates it's
kwargsso you could probably just catch the
ValueErrorand reraise as a drf
ValidationError`.
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.
I tried fixing this locally and still didn't see the channel_type update so something else is going on here too.
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.
I see a problem too, I'll look into it
5920bef
to
63fb2f8
Compare
Should be ready for review again. I also rebased on #44 |
63fb2f8
to
aeab5da
Compare
aeab5da
to
e562e62
Compare
What are the relevant tickets?
Part of #29
What's this PR do?
Implements rest API for channels
How should this be manually tested?
You can go to
/api/v0/channels/
and play around with it using the DRF HTML view. You should also be able to go to/api/v0/channels/<subreddit>/
to view a particular channel or to patch it