import { z } from 'zod' export default class POST_BY_MEMBER { prefix = "POST_BY_MEMBER" 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() getAuthorId(postId) { for (let i = this.indices[0]; i < this.indices[1]; i++) { if (global.db.edges[i].from === postId) { return Number(global.db.edges[i].to.split("-")[1]); } } } 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 } }