Skip to content

Commit 9160b1b

Browse files
authored
Merge branch 'main' into hot-fix
2 parents 32523ac + f8ec1a7 commit 9160b1b

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

src/modules/follows/index.ts

+9
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
GET_FOLLOWING_QUERY,
99
GET_TOTAL_FOLLOWERS_QUERY,
1010
GET_FOLLOWING_ENTITY_QUERY,
11+
USER_RECOMMENDATIONS_QUERY,
1112
} from '../../queries/follows.query';
1213

1314
import { UserInterface, FollowingInterface } from '../../types';
@@ -71,4 +72,12 @@ export class Follow {
7172
});
7273
return response.data.getTotalFollowers;
7374
}
75+
76+
public async getFollowRecomendations(user_id: number | string, static_recommendation: boolean): Promise<UserInterface[]> {
77+
const response = await this.client.query({
78+
query: USER_RECOMMENDATIONS_QUERY,
79+
variables: { user_id, static_recommendation },
80+
});
81+
return response.data.getWhoToFollow.data;
82+
}
7483
}

src/queries/follows.query.ts

+32
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,35 @@ export const GET_TOTAL_FOLLOWERS_QUERY = gql`
165165
getTotalFollowers(user_id: $user_id)
166166
}
167167
`;
168+
169+
export const USER_RECOMMENDATIONS_QUERY = gql`
170+
query getWhoToFollow($user_id: ID!, $static_recommendation: Boolean!) {
171+
getWhoToFollow(user_id: $user_id, static_recommendation: $static_recommendation) {
172+
data {
173+
id
174+
uuid
175+
firstname
176+
lastname
177+
displayname
178+
description
179+
dob
180+
default_company
181+
default_company_uuid
182+
default_company_branch
183+
default_company_branch_uuid
184+
email
185+
is_active
186+
verify_two_factor
187+
sex
188+
user_active
189+
timezone
190+
abilities
191+
roles
192+
mainRole
193+
welcome
194+
created_at
195+
updated_at
196+
}
197+
}
198+
}
199+
`;

test/followers.test.ts

+18
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,22 @@ describe('Test the Social Messages', () => {
4949

5050
expect(isFollowing).toBeDefined();
5151
});
52+
53+
it('get follow user recommendations', async () => {
54+
const client = getClient();
55+
const userInfo = await client.users.getUserByDisplayName('test');
56+
57+
const getFollowRecomendations = await client.follow.getFollowRecomendations(userInfo.id, false);
58+
59+
expect(getFollowRecomendations).toBeDefined();
60+
});
61+
62+
it('get static user follow recommendations', async () => {
63+
const client = getClient();
64+
const userInfo = await client.users.getUserByDisplayName('test');
65+
66+
const getFollowRecomendations = await client.follow.getFollowRecomendations(userInfo.id, true);
67+
68+
expect(getFollowRecomendations).toBeDefined();
69+
});
5270
});

0 commit comments

Comments
 (0)