getting org members
This commit is contained in:
@@ -15,6 +15,5 @@ export default class Edge {
|
||||
// let
|
||||
}
|
||||
}
|
||||
console.log(fromID)
|
||||
}
|
||||
}
|
||||
@@ -17,10 +17,20 @@ export default class MEMBER_IN_NETWORK {
|
||||
})
|
||||
.strict()
|
||||
|
||||
getByFrom(fromID) {
|
||||
getByMember(stringID) {
|
||||
let result = []
|
||||
for(let i = this.indices[0]; i < this.indices[1]; i++) {
|
||||
if(global.db.edges[i].from === fromID) {
|
||||
if(global.db.edges[i].from === stringID) {
|
||||
result.push(global.db.edges[i])
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
getByNetwork(id) {
|
||||
let result = []
|
||||
for(let i = this.indices[0]; i < this.indices[1]; i++) {
|
||||
if(global.db.edges[i].to === `${global.db.networks.prefix}-${id}`) {
|
||||
result.push(global.db.edges[i])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,20 @@ export default class Member {
|
||||
}
|
||||
}
|
||||
|
||||
get(id) {
|
||||
return this.entries[this.ids[id]]
|
||||
getByNetwork(id) {
|
||||
let connections = db.MEMBER_IN_NETWORK.getByNetwork(id)
|
||||
let members = []
|
||||
connections.forEach((conn) => {
|
||||
members.push(this.getByID(conn.from))
|
||||
})
|
||||
return members
|
||||
}
|
||||
|
||||
getByID(id) {
|
||||
if(typeof id === 'string') {
|
||||
id = id.split("-")[1]
|
||||
}
|
||||
return global.db.nodes[this.indices[0] + id - 1]
|
||||
}
|
||||
|
||||
getByEmail(email) {
|
||||
@@ -51,15 +63,4 @@ export default class Member {
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
getIDFromEmail(email) {
|
||||
let index = 0
|
||||
for(let i=0; i<this.entries.length; i++) {
|
||||
if(this.entries[i].email === email) {
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
return Object.entries(this.ids)[index][0]
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@ export default class Network {
|
||||
get(stringID) {
|
||||
let id = stringID.split("-")[1]
|
||||
let index = this.indices[0] + (id - 1)
|
||||
console.log("networkget", index, id, global.db.nodes[index-1])
|
||||
return global.db.nodes[index]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user