MCPcopy Index your code
hub / github.com/parse-community/parse-server / createHook

Method createHook

src/Controllers/HooksController.js:143–165  ·  view source on GitHub ↗
(aHook)

Source from the content-addressed store, hash-verified

141 }
142
143 createHook(aHook) {
144 if (aHook.functionName) {
145 return this.getFunction(aHook.functionName).then(result => {
146 if (result) {
147 throw new Parse.Error(143, `function name: ${aHook.functionName} already exists`);
148 } else {
149 return this.createOrUpdateHook(aHook);
150 }
151 });
152 } else if (aHook.className && aHook.triggerName) {
153 return this.getTrigger(aHook.className, aHook.triggerName).then(result => {
154 if (result) {
155 throw new Parse.Error(
156 143,
157 `class ${aHook.className} already has trigger ${aHook.triggerName}`
158 );
159 }
160 return this.createOrUpdateHook(aHook);
161 });
162 }
163
164 throw new Parse.Error(143, 'invalid hook declaration');
165 }
166
167 updateHook(aHook) {
168 if (aHook.functionName) {

Callers

nothing calls this directly

Calls 3

getFunctionMethod · 0.95
createOrUpdateHookMethod · 0.95
getTriggerMethod · 0.95

Tested by

no test coverage detected