getting org members

This commit is contained in:
metacryst
2026-01-13 14:27:44 -06:00
parent 134a6b8471
commit 237bbfedd4
7 changed files with 59 additions and 37 deletions

View File

@@ -15,6 +15,5 @@ export default class Edge {
// let
}
}
console.log(fromID)
}
}

View File

@@ -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])
}
}

View File

@@ -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]
}
}

View File

@@ -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]
}