database basically working

This commit is contained in:
metacryst
2026-01-11 03:47:36 -06:00
parent 463dd183f5
commit 13cdff7a5f
19 changed files with 389 additions and 210 deletions

36
server/db/model/edge.js Normal file
View File

@@ -0,0 +1,36 @@
import { z } from 'zod';
export default class Edge {
schema = z.object({
id: z.number(),
from: z.string(),
to: z.string(),
created: z.string()
})
.strict()
save(n, id) {
let result = this.schema.safeParse(n)
if(result.success) {
try {
super.add(id, n)
} catch(e) {
console.error(e)
throw e
}
} else {
console.error(result.error)
throw new global.ServerError(400, "Invalid Member Data!");
}
}
getByFrom(fromID) {
let result = []
for(let i = 0; i < this.entries.length; i++) {
if(entries[i].from === fromID) {
// let
}
}
console.log(fromID)
}
}