diff --git a/src/modules/follows/index.ts b/src/modules/follows/index.ts index f14918f7..19e69cb9 100644 --- a/src/modules/follows/index.ts +++ b/src/modules/follows/index.ts @@ -4,7 +4,7 @@ import { USER_FOLLOW_MUTATION, USER_UNFOLLOW_MUTATION } from '../../mutations/'; import { IS_FOLLOWING_QUERY, - USER_FOLLOWERS_QUERY, + GET_FOLLOWERS_QUERY, GET_FOLLOWING_QUERY, GET_TOTAL_FOLLOWERS_QUERY, } from '../../queries/follows.query'; @@ -16,7 +16,7 @@ export class Follow { public async followUser(user_id: number): Promise { const response = await this.client.mutate({ mutation: USER_FOLLOW_MUTATION, - variables: { user_id }, + variables: { user_id: user_id }, }); return response.data.userFollow as boolean; } @@ -24,7 +24,7 @@ export class Follow { public async unFollowUser(user_id: number): Promise { const response = await this.client.mutate({ mutation: USER_UNFOLLOW_MUTATION, - variables: { user_id }, + variables: { user_id: user_id }, }); return response.data.userUnFollow as boolean; } @@ -32,22 +32,23 @@ export class Follow { public async isFollowing(user_id: number): Promise { const response = await this.client.query({ query: IS_FOLLOWING_QUERY, - variables: { user_id }, + variables: { user_id: user_id }, }); return response.data.isFollowing as boolean; } - public async userFollowers(user_id: number): Promise { + public async getFollowers(user_id: number): Promise { const response = await this.client.query({ - query: USER_FOLLOWERS_QUERY, + query: GET_FOLLOWERS_QUERY, variables: { user_id }, }); - return response.data.userFollowers.data as UserInterface[]; + return response.data.getFollowers.data as UserInterface[]; } - public async getFollowing(): Promise { + public async getFollowing(user_id: number): Promise { const response = await this.client.query({ query: GET_FOLLOWING_QUERY, + variables: { user_id: user_id }, }); return response.data.getFollowing.data as FollowingInterface[]; } diff --git a/src/modules/people/index.ts b/src/modules/people/index.ts index 586240a6..7e0d6fb3 100644 --- a/src/modules/people/index.ts +++ b/src/modules/people/index.ts @@ -1,4 +1,4 @@ -import { ClientType } from '../../index'; +import { ClientType } from './../../index'; import { PeopleInputInterface, @@ -14,7 +14,7 @@ import { RESTORE_PEOPLE_MUTATION, } from '../../mutations'; -import { PEOPLE_QUERY } from '../../index'; +import { PEOPLE_QUERY } from './../../queries/'; export class People { constructor(protected client: ClientType) {} diff --git a/src/queries/follows.query.ts b/src/queries/follows.query.ts index c869819e..bc1c7c97 100644 --- a/src/queries/follows.query.ts +++ b/src/queries/follows.query.ts @@ -6,9 +6,9 @@ export const IS_FOLLOWING_QUERY = gql` } `; -export const USER_FOLLOWERS_QUERY = gql` - query userFollowers($user_id: Int!) { - userFollowers(user_id: $user_id) { +export const GET_FOLLOWERS_QUERY = gql` + query getFollowers($user_id: Int!) { + getFollowers(user_id: $user_id) { data { id uuid @@ -49,11 +49,11 @@ export const USER_FOLLOWERS_QUERY = gql` `; export const GET_FOLLOWING_QUERY = gql` - query getFollowing { - getFollowing { + query getFollowing($user_id: Int!) { + getFollowing(user_id: $user_id) { data { id - user_id + users_id entity_namespace entity_id entity { diff --git a/src/types/follows.ts b/src/types/follows.ts index a66cd5e6..278b8e5a 100644 --- a/src/types/follows.ts +++ b/src/types/follows.ts @@ -2,7 +2,7 @@ import { UserInterface } from './users'; export interface FollowingInterface { id: number; - user_id: number; + users_id: number; entity_namespace: string; entity_id: number; entity: UserInterface;