Decicus / DecAPI

API provider/proxy that provides plaintext responses - Documentation: https://docs.decapi.me/
https://decapi.me/
MIT License
118 stars 23 forks source link

Update user handling for authed Twitch users #17

Closed Decicus closed 7 years ago

Decicus commented 7 years ago

Currently the users table stores both user IDs and usernames, which is unnecessary now that we have the CachedTwitchUser model.

This PR modifies the behavior of /twitch/subcount that instead of looking up the username in the users table directly, it checks the Twitch user cache and then uses the user ID from that and checks the users table to retrieve the OAuth token and do the call that way.
Because of this, /twitch/subcount and any other potential routes that require authentication with Twitch should handle name changes (and the API V3 removal) a lot better.

This also completely drops the username column from users, so it will have to rely on the CachedTwitchUser model or be queried by user ID directly.