working with db, docker working, small error with personal data

This commit is contained in:
metacryst
2026-03-10 19:09:47 -05:00
parent 4d2c515b7d
commit 7cfcc01c99
25 changed files with 337 additions and 469 deletions

View File

@@ -1,39 +1,16 @@
import { z } from 'zod'
// server/db/model/edges/MEMBER_IN_NETWORK.js
import sql from '../../sql.js';
export default class MEMBER_IN_NETWORK {
prefix = "MEMBER_IN_NETWORK"
indices = null
async getByMember(memberId) {
return await sql`
SELECT * FROM member_network WHERE member_id = ${memberId}
`;
}
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
}
async getByNetwork(networkId) {
return await sql`
SELECT * FROM member_network WHERE network_id = ${networkId}
`;
}
}

View File

@@ -20,6 +20,7 @@ export default class POST_FROM_NETWORK {
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])
}