Adds publish/subscribe pattern to allow plugins and projects to hook into events (#55)

Also adds CLI to ease development.
This commit is contained in:
Sebastian Rindom
2020-05-07 13:47:27 +02:00
committed by GitHub
parent 6a78df1ecd
commit 4c2aec2838
39 changed files with 6974 additions and 444 deletions
+4 -3
View File
@@ -8,7 +8,7 @@ import mongoose from "mongoose"
class BaseModel {
constructor() {
/** @const the underlying mongoose model used for queries */
this.mongooseModel_ = this.createMongooseModel_(this.schema)
this.mongooseModel_ = this.createMongooseModel_()
}
/**
@@ -72,8 +72,9 @@ class BaseModel {
* @param options {?object=} mongoose options
* @return {object} mongoose result
*/
updateOne(query, update, options) {
return this.mongooseModel_.updateOne(query, update, options)
updateOne(query, update, options = {}) {
options.new = true
return this.mongooseModel_.findOneAndUpdate(query, update, options)
}
/**