File tree 3 files changed +59
-0
lines changed
3 files changed +59
-0
lines changed Original file line number Diff line number Diff line change 8
8
GET_FOLLOWING_QUERY ,
9
9
GET_TOTAL_FOLLOWERS_QUERY ,
10
10
GET_FOLLOWING_ENTITY_QUERY ,
11
+ USER_RECOMMENDATIONS_QUERY ,
11
12
} from '../../queries/follows.query' ;
12
13
13
14
import { UserInterface , FollowingInterface } from '../../types' ;
@@ -71,4 +72,12 @@ export class Follow {
71
72
} ) ;
72
73
return response . data . getTotalFollowers ;
73
74
}
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
+ }
74
83
}
Original file line number Diff line number Diff line change @@ -165,3 +165,35 @@ export const GET_TOTAL_FOLLOWERS_QUERY = gql`
165
165
getTotalFollowers(user_id: $user_id)
166
166
}
167
167
` ;
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
+ ` ;
Original file line number Diff line number Diff line change @@ -49,4 +49,22 @@ describe('Test the Social Messages', () => {
49
49
50
50
expect ( isFollowing ) . toBeDefined ( ) ;
51
51
} ) ;
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
+ } ) ;
52
70
} ) ;
You can’t perform that action at this time.
0 commit comments