parent
91144d46ec
commit
e21a3fe0cd
@ -0,0 +1,15 @@
|
||||
import api from '../api';
|
||||
|
||||
export const SUGGESTIONS_FETCH_REQUEST = 'SUGGESTIONS_FETCH_REQUEST';
|
||||
export const SUGGESTIONS_FETCH_SUCCESS = 'SUGGESTIONS_FETCH_SUCCESS';
|
||||
export const SUGGESTIONS_FETCH_FAIL = 'SUGGESTIONS_FETCH_FAIL';
|
||||
|
||||
export function fetchSuggestions() {
|
||||
return (dispatch, getState) => {
|
||||
api(getState).get('/api/v1/accounts/suggestions').then(response => {
|
||||
console.log(response.data);
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
};
|
||||
};
|
@ -0,0 +1,7 @@
|
||||
class FollowSuggestion
|
||||
def self.get(for_account_id)
|
||||
neo = Neography::Rest.new
|
||||
account_ids = neo.execute_query('START a=node:account_index(Account={id}) MATCH (a)-[:follows]->(b)-[:follows]->(c) WHERE a <> c AND NOT (a)-[:follows]->(c) RETURN DISTINCT c.account_id', id: for_account_id)
|
||||
Account.where(id: account_ids['data'].first) unless account_ids.empty?
|
||||
end
|
||||
end
|
@ -0,0 +1,2 @@
|
||||
collection @accounts
|
||||
extends('api/v1/accounts/show')
|
@ -0,0 +1,5 @@
|
||||
Neography.configure do |config|
|
||||
config.protocol = "http"
|
||||
config.server = ENV['NEO4J_HOST'] || 'localhost'
|
||||
config.port = ENV['NEO4J_PORT'] || 7474
|
||||
end
|
Loading…
Reference in new issue