MCPcopy Create free account
hub / github.com/parse-community/parse-server / saveHook

Method saveHook

src/Controllers/HooksController.js:88–102  ·  view source on GitHub ↗
(hook)

Source from the content-addressed store, hash-verified

86 }
87
88 saveHook(hook) {
89 var query;
90 if (hook.functionName && hook.url) {
91 query = { functionName: hook.functionName };
92 } else if (hook.triggerName && hook.className && hook.url) {
93 query = { className: hook.className, triggerName: hook.triggerName };
94 } else {
95 throw new Parse.Error(143, 'invalid hook declaration');
96 }
97 return this.database
98 .update(DefaultHooksCollectionName, query, hook, { upsert: true })
99 .then(() => {
100 return Promise.resolve(hook);
101 });
102 }
103
104 addHookToTriggers(hook) {
105 var wrappedFunction = wrapToHTTPRequest(hook, this._webhookKey);

Callers 1

addHookMethod · 0.95

Calls 1

updateMethod · 0.80

Tested by

no test coverage detected