Files
frm.so/server/db/model/edges/MEMBER_IN_NETWORK.js
2026-01-13 14:27:44 -06:00

39 lines
925 B
JavaScript

import { z } from 'zod'
export default class MEMBER_IN_NETWORK {
prefix = "MEMBER_IN_NETWORK"
indices = null
constructor(indices) {
this.indices = indices
}
schema = z.object({
id: z.number(),
type: z.string(),
from: z.string(),
to: z.string(),
created: z.string()
})
.strict()
getByMember(stringID) {
let result = []
for(let i = this.indices[0]; i < this.indices[1]; i++) {
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])
}
}
return result
}
}