annotate src/edgecontrol.coffee @ 12:f190abf340ef

fixed some problems with facebook (caused by developers.facebook.com) removed fql :D
author Mathias Gebbe <mgebbe@intevation.de>
date Thu, 12 Jun 2014 10:23:05 +0200
parents 98a070c98982
children a52b5b244e51
rev   line source
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
1 # Copyright (C) 2014 by Intevation GmbH
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
2 # Author: Mathias Gebbe <mgebbe@intevation.de>
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
3 #
3
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
4 # This file is Free Software under the Apache License, Version 2.0;
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
5 # and comes with NO WARRANTY!
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
6 # See the documentation coming with pumpbridge for details.
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
7
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
8 async = require("async")
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
9 _ = require("underscore")
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
10 Edge = require("./edge")
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
11
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
12
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
13 removeEdges = (userid, network, callback) ->
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
14 delEdge = (edge, callback) ->
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
15 unless edge.to.indexOf(network) is -1
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
16 edge.del callback
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
17 return
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
18
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
19 async.parallel [
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
20 (callback) ->
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
21 return Edge.search(
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
22 from: userid
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
23 , (err, edges) ->
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
24 if err
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
25 callback err
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
26 else
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
27 async.each edges, delEdge, callback
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
28 return
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
29 )
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
30 (callback) ->
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
31 return Edge.search(
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
32 to: userid
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
33 , (err, edges) ->
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
34 if err
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
35 callback err
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
36 else
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
37 async.each edges, delEdge, callback
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
38 return
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
39 )
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
40 ], callback
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
41 return
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
42
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
43 addEdge = (from, to) ->
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
44 async.waterfall [(callback) ->
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
45 Edge.create
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
46 from: from
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
47 to: to
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
48 , callback
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
49 return
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
50
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
51 ], (err, result) ->
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
52 return
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
53
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
54 deleteEdge = (from, to) ->
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
55 async.waterfall [(callback) ->
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
56 bank = Edge.bank()
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
57 bank.del Edge.type, Edge.key(from, to), callback
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
58 return
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
59
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
60 ], (err, result) ->
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
61 return
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
62
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
63 exports.removeEdges = removeEdges
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
64 exports.deleteEdge = deleteEdge
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
65 exports.addEdge = addEdge
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)