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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get User Profile does not show the following #18

Open
dxps opened this issue Sep 9, 2020 · 1 comment
Open

Get User Profile does not show the following #18

dxps opened this issue Sep 9, 2020 · 1 comment

Comments

@dxps
Copy link

dxps commented Sep 9, 2020

Hi!

First of all, that's a nice project structure! 馃憤

Just playing with it and discovered that /api/profiles/:username always returns "following": false whether a token is provided or not in the standard Authorization.

Meanwhile, I'll keep looking for the root cause.

@dxps
Copy link
Author

dxps commented Sep 9, 2020

The problem is that the generated SQL is:

SELECT u.*, EXISTS (
        SELECT "fu"."user_id", "fu"."followed_user_id" FROM "follow_users" AS "fu" 
        WHERE (fu.followed_user_id = u.id) AND (fu.user_id = 31)
    ) AS following FROM "users" AS "u" WHERE (username = 'joe')

And actually this should be:

SELECT u.*, EXISTS (
       SELECT "fu"."user_id", "fu"."followed_user_id" FROM "follow_users" AS "fu", "users" AS "u"
       WHERE (fu.followed_user_id = u.id) AND (fu.user_id = 31)
   ) AS following FROM "users" AS "u" WHERE (username = 'joe')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant