Blame view
imports/collections/orgs/methods.js
1.76 KB
6be49625f
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
// import { } from '/imports/collections/orgs/methods'; import _ from 'lodash'; import { Meteor } from 'meteor/meteor'; import { ValidatedMethod } from 'meteor/mdg:validated-method'; import { SimpleSchema } from 'meteor/aldeed:simple-schema'; import { DDPRateLimiter } from 'meteor/ddp-rate-limiter'; import { Bert } from 'meteor/themeteorchef:bert'; import { Users } from '/imports/collections/users/index'; import { Orgs } from '/imports/collections/orgs/index'; // import { sendNotificationAPN } from '/imports/server/push/methods'; export const orgMethod = new ValidatedMethod({ name: 'org.method', validate: new SimpleSchema({ itemId: { type: String }, }).validator(), run({itemId}) { return {}; }, }); export const checkExistingOrg = new ValidatedMethod({ name: 'checkExistingOrg', validate: new SimpleSchema({ slug: { type: String }, }).validator(), run({slug}) { |
cc8fd8a94
|
31 |
org = Orgs.findOne({slug:slug}); |
6be49625f
|
32 33 |
return org; }, |
b7054c9b2
|
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
}); export const checkEmailInOrg = new ValidatedMethod({ name: 'checkEmailInOrg', validate: new SimpleSchema({ email: { type: String }, orgId: { type: String }, }).validator(), run({email, orgId}) { console.log(orgId); user = Users.findOne({"orgId":orgId, "emails.address":email}); if(user){ return {success:true} }else{ return {success:false} } }, |
6894fd7e2
|
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
}); export const studentCsvParse = new ValidatedMethod({ name: 'org.studentCsvParse', validate: new SimpleSchema({ data: { type: [Object] }, }).validator(), run(data) { console.log(data); return { }; }, |
6be49625f
|
68 69 |
}); |