user can join

This commit is contained in:
metacryst
2026-01-13 11:22:37 -06:00
parent 604ba9f01c
commit 6efc5b6f97
8 changed files with 64 additions and 82 deletions

View File

@@ -1,27 +1,11 @@
import { z } from 'zod';
export default class Edge {
schema = z.object({
id: z.number(),
from: z.string(),
to: z.string(),
created: z.string()
})
.strict()
add(n) {
let toPrefix = n.to.split("-")[0]
let fromPrefix = n.from.split("-")[0]
let type = n.type
let prefix = `${fromPrefix}_${type}_${toPrefix}`
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!");
}
global.db.addEdge(prefix, n)
}
getByFrom(fromID) {