diff --git a/service/database/db-users.go b/service/database/db-users.go index 51b2b8a..098ae85 100644 --- a/service/database/db-users.go +++ b/service/database/db-users.go @@ -125,7 +125,7 @@ func (db *appdbimpl) GetUserFollowers(uid string, requesting_uid string, start_i AND "followed" = ? LIMIT ? - OFFSET ?`, uid, requesting_uid, limit, start_index) + OFFSET ?`, requesting_uid, uid, limit, start_index) followers, err := db.uidNameQuery(rows, err) @@ -137,7 +137,7 @@ func (db *appdbimpl) GetUserFollowers(uid string, requesting_uid string, start_i } // Get user following -func (db *appdbimpl) GetUserFollowing(uid string, requesting_uid string, start_index int, offset int) (QueryResult, *[]structures.UIDName, error) { +func (db *appdbimpl) GetUserFollowing(uid string, requesting_uid string, start_index int, limit int) (QueryResult, *[]structures.UIDName, error) { // user may exist but have no followers exists, err := db.UserExistsNotBanned(uid, requesting_uid) @@ -150,7 +150,7 @@ func (db *appdbimpl) GetUserFollowing(uid string, requesting_uid string, start_i return ERR_NOT_FOUND, nil, nil } - rows, err := db.c.Query(`SELECT "followed", "user"."name" FROM "follows", "users" + rows, err := db.c.Query(`SELECT "followed", "users"."name" FROM "follows", "users" WHERE "follows"."followed" = "users"."uid" AND "follows"."followed" NOT IN ( @@ -161,7 +161,7 @@ func (db *appdbimpl) GetUserFollowing(uid string, requesting_uid string, start_i AND "follower" = ? LIMIT ? - OFFSET ?`, uid, requesting_uid, offset, start_index) + OFFSET ?`, requesting_uid, uid, limit, start_index) following, err := db.uidNameQuery(rows, err)