-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
24 lines (20 loc) · 1.03 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const automaticModuleDefinitions = []
var Auth = require('./modules/auth')
var Startup = require('./modules/startup')
automaticModuleDefinitions.push(require('./modules/studyProgram'))
automaticModuleDefinitions.push(require('./modules/course'))
automaticModuleDefinitions.push(require('./modules/question'))
automaticModuleDefinitions.push(require('./modules/game'))
automaticModuleDefinitions.push(require('./modules/friendRequest'))
automaticModuleDefinitions.push(require('./modules/user'))
automaticModuleDefinitions.push(require('./modules/stats'))
Parse.Cloud.define('user_login', Auth.userLogin)
Parse.Cloud.beforeSave(Parse.User, Auth.setStudentRole)
Parse.Cloud.afterSave(Parse.User, Auth.addUserToStudentRole)
Parse.Cloud.afterSave(Parse.User, Auth.sendNotificationToAdmin)
Parse.Cloud.define('server_startup', Startup.serverStartup)
automaticModuleDefinitions.forEach(moduleDefiniton => {
for (var cloudFunction in moduleDefiniton) {
Parse.Cloud.define(moduleDefiniton[cloudFunction].name, moduleDefiniton[cloudFunction].handler)
}
})