30 lines
742 B
JavaScript
30 lines
742 B
JavaScript
import { z } from 'zod'
|
|
|
|
export default class POST_FROM_NETWORK {
|
|
prefix = "POST_FROM_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()
|
|
|
|
getByNetwork(id) {
|
|
let result = []
|
|
for(let i = this.indices[0]; i < this.indices[1]; i++) {
|
|
console.warn("POST_FROM_NETWORK.js 23: This call to global.db needs to be awaited")
|
|
if(global.db.edges[i].to === `${global.db.networks.prefix}-${id}`) {
|
|
result.push(global.db.edges[i])
|
|
}
|
|
}
|
|
return result
|
|
}
|
|
} |