Stripe integration flow
This commit is contained in:
@@ -14,14 +14,18 @@ export default class Network {
|
||||
apps: z.array(z.string()),
|
||||
logo: z.string(),
|
||||
abbreviation: z.string(),
|
||||
created: z.string()
|
||||
created: z.string(),
|
||||
stripeAccountId: z.string().nullable(),
|
||||
stripeAccessToken: z.string().nullable()
|
||||
})
|
||||
.strict()
|
||||
|
||||
get(stringID) {
|
||||
let id = stringID.split("-")[1]
|
||||
get(id) {
|
||||
if(typeof id === "string") {
|
||||
id = id.split("-")[1]
|
||||
}
|
||||
let index = this.indices[0] + (id - 1)
|
||||
return global.db.nodes[index]
|
||||
return structuredClone(global.db.nodes[index])
|
||||
}
|
||||
|
||||
getByAbbreviation(abbreviation) {
|
||||
@@ -33,6 +37,21 @@ export default class Network {
|
||||
return null
|
||||
}
|
||||
|
||||
update(id, data) {
|
||||
if(data.id || data.created) {
|
||||
throw new Error("Can't update node id or created time!")
|
||||
}
|
||||
let currentObject = this.get(id)
|
||||
let newObject = {...currentObject, ...data}
|
||||
|
||||
try {
|
||||
global.db.updateNode(this.prefix, newObject.id, newObject)
|
||||
} catch(e) {
|
||||
console.error(e)
|
||||
throw new global.ServerError(400, "Failed to add member!");
|
||||
}
|
||||
}
|
||||
|
||||
save(n) {
|
||||
let id = `${this.prefix}-${n.id}`
|
||||
let result = this.schema.safeParse(n)
|
||||
|
||||
Reference in New Issue
Block a user