CRUD operations for Posts
- added all CRUD operations for Post model - add() also creates POST_BY_MEMBER and POST_FROM_NETWORK edges - delete() also deletes associated edges - delete() currently does not reallocate node/edge indices after deleting - will write the data to the db.json file and global.db.nodes
This commit is contained in:
@@ -24,6 +24,15 @@ export default class Network {
|
||||
return global.db.nodes[index]
|
||||
}
|
||||
|
||||
getByAbbreviation(abbreviation) {
|
||||
for(let i=this.indices[0]; i<this.indices[1]; i++) {
|
||||
if(global.db.nodes[i].abbreviation === abbreviation) {
|
||||
return global.db.nodes[i]
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
save(n) {
|
||||
let id = `${this.prefix}-${n.id}`
|
||||
let result = this.schema.safeParse(n)
|
||||
|
||||
Reference in New Issue
Block a user