Commit 6894fd7e2bb9c51775e8307df74460af7cf725f0
1 parent
8ce8e66f3c
Exists in
master
added a new package
Showing
2 changed files
with
16 additions
and
0 deletions
Show diff stats
imports/collections/orgs/methods.js
1 | // import { } from '/imports/collections/orgs/methods'; | 1 | // import { } from '/imports/collections/orgs/methods'; |
2 | import _ from 'lodash'; | 2 | import _ from 'lodash'; |
3 | import { Meteor } from 'meteor/meteor'; | 3 | import { Meteor } from 'meteor/meteor'; |
4 | import { ValidatedMethod } from 'meteor/mdg:validated-method'; | 4 | import { ValidatedMethod } from 'meteor/mdg:validated-method'; |
5 | import { SimpleSchema } from 'meteor/aldeed:simple-schema'; | 5 | import { SimpleSchema } from 'meteor/aldeed:simple-schema'; |
6 | import { DDPRateLimiter } from 'meteor/ddp-rate-limiter'; | 6 | import { DDPRateLimiter } from 'meteor/ddp-rate-limiter'; |
7 | import { Bert } from 'meteor/themeteorchef:bert'; | 7 | import { Bert } from 'meteor/themeteorchef:bert'; |
8 | import { Users } from '/imports/collections/users/index'; | 8 | import { Users } from '/imports/collections/users/index'; |
9 | import { Orgs } from '/imports/collections/orgs/index'; | 9 | import { Orgs } from '/imports/collections/orgs/index'; |
10 | // import { sendNotificationAPN } from '/imports/server/push/methods'; | 10 | // import { sendNotificationAPN } from '/imports/server/push/methods'; |
11 | export const orgMethod = new ValidatedMethod({ | 11 | export const orgMethod = new ValidatedMethod({ |
12 | name: 'org.method', | 12 | name: 'org.method', |
13 | 13 | ||
14 | validate: new SimpleSchema({ | 14 | validate: new SimpleSchema({ |
15 | itemId: { type: String }, | 15 | itemId: { type: String }, |
16 | }).validator(), | 16 | }).validator(), |
17 | 17 | ||
18 | run({itemId}) { | 18 | run({itemId}) { |
19 | return {}; | 19 | return {}; |
20 | }, | 20 | }, |
21 | 21 | ||
22 | }); | 22 | }); |
23 | 23 | ||
24 | export const checkExistingOrg = new ValidatedMethod({ | 24 | export const checkExistingOrg = new ValidatedMethod({ |
25 | name: 'checkExistingOrg', | 25 | name: 'checkExistingOrg', |
26 | validate: new SimpleSchema({ | 26 | validate: new SimpleSchema({ |
27 | slug: { type: String }, | 27 | slug: { type: String }, |
28 | }).validator(), | 28 | }).validator(), |
29 | 29 | ||
30 | run({slug}) { | 30 | run({slug}) { |
31 | org = Orgs.findOne({slug:slug}); | 31 | org = Orgs.findOne({slug:slug}); |
32 | return org; | 32 | return org; |
33 | }, | 33 | }, |
34 | }); | 34 | }); |
35 | 35 | ||
36 | export const checkEmailInOrg = new ValidatedMethod({ | 36 | export const checkEmailInOrg = new ValidatedMethod({ |
37 | name: 'checkEmailInOrg', | 37 | name: 'checkEmailInOrg', |
38 | 38 | ||
39 | validate: new SimpleSchema({ | 39 | validate: new SimpleSchema({ |
40 | email: { type: String }, | 40 | email: { type: String }, |
41 | orgId: { type: String }, | 41 | orgId: { type: String }, |
42 | }).validator(), | 42 | }).validator(), |
43 | 43 | ||
44 | run({email, orgId}) { | 44 | run({email, orgId}) { |
45 | console.log(orgId); | 45 | console.log(orgId); |
46 | user = Users.findOne({"orgId":orgId, "emails.address":email}); | 46 | user = Users.findOne({"orgId":orgId, "emails.address":email}); |
47 | if(user){ | 47 | if(user){ |
48 | return {success:true} | 48 | return {success:true} |
49 | }else{ | 49 | }else{ |
50 | return {success:false} | 50 | return {success:false} |
51 | } | 51 | } |
52 | }, | 52 | }, |
53 | }); | ||
54 | |||
55 | export const studentCsvParse = new ValidatedMethod({ | ||
56 | name: 'org.studentCsvParse', | ||
57 | |||
58 | validate: new SimpleSchema({ | ||
59 | data: { type: [Object] }, | ||
60 | }).validator(), | ||
61 | |||
62 | run(data) { | ||
63 | console.log(data); | ||
64 | return { | ||
65 | |||
66 | }; | ||
67 | }, | ||
53 | 68 | ||
54 | }); | 69 | }); |
55 | 70 |
package.json
1 | { | 1 | { |
2 | "name": "application-name", | 2 | "name": "application-name", |
3 | "version": "1.0.0", | 3 | "version": "1.0.0", |
4 | "description": "Application description.", | 4 | "description": "Application description.", |
5 | "scripts": { | 5 | "scripts": { |
6 | "start": "meteor --settings settings-development.json", | 6 | "start": "meteor --settings settings-development.json", |
7 | "test": "meteor test --driver-package practicalmeteor:mocha --port 5000", | 7 | "test": "meteor test --driver-package practicalmeteor:mocha --port 5000", |
8 | "chimp-watch": "chimp --ddp=http://localhost:3000 --watch --mocha --path=tests", | 8 | "chimp-watch": "chimp --ddp=http://localhost:3000 --watch --mocha --path=tests", |
9 | "chimp-test": "chimp --ddp=http://localhost:3000 --mocha --path=tests", | 9 | "chimp-test": "chimp --ddp=http://localhost:3000 --mocha --path=tests", |
10 | "staging": "meteor deploy staging.meteor.com --settings settings-development.json", | 10 | "staging": "meteor deploy staging.meteor.com --settings settings-development.json", |
11 | "production": "meteor deploy production.meteor.com --settings settings-production.json" | 11 | "production": "meteor deploy production.meteor.com --settings settings-production.json" |
12 | }, | 12 | }, |
13 | "devDependencies": { | 13 | "devDependencies": { |
14 | "chimp": "^0.41.2", | 14 | "chimp": "^0.41.2", |
15 | "eslint": "^3.8.1", | 15 | "eslint": "^3.8.1", |
16 | "eslint-config-airbnb": "^12.0.0", | 16 | "eslint-config-airbnb": "^12.0.0", |
17 | "eslint-plugin-import": "^1.16.0", | 17 | "eslint-plugin-import": "^1.16.0", |
18 | "eslint-plugin-jsx-a11y": "^2.2.3", | 18 | "eslint-plugin-jsx-a11y": "^2.2.3", |
19 | "eslint-plugin-meteor": "^4.0.1", | 19 | "eslint-plugin-meteor": "^4.0.1", |
20 | "eslint-plugin-react": "^6.4.1" | 20 | "eslint-plugin-react": "^6.4.1" |
21 | }, | 21 | }, |
22 | "eslintConfig": { | 22 | "eslintConfig": { |
23 | "parserOptions": { | 23 | "parserOptions": { |
24 | "ecmaFeatures": { | 24 | "ecmaFeatures": { |
25 | "jsx": true | 25 | "jsx": true |
26 | } | 26 | } |
27 | }, | 27 | }, |
28 | "plugins": [ | 28 | "plugins": [ |
29 | "meteor", | 29 | "meteor", |
30 | "react" | 30 | "react" |
31 | ], | 31 | ], |
32 | "extends": [ | 32 | "extends": [ |
33 | "airbnb/base", | 33 | "airbnb/base", |
34 | "plugin:meteor/guide", | 34 | "plugin:meteor/guide", |
35 | "plugin:react/recommended" | 35 | "plugin:react/recommended" |
36 | ], | 36 | ], |
37 | "env": { | 37 | "env": { |
38 | "browser": true | 38 | "browser": true |
39 | }, | 39 | }, |
40 | "globals": { | 40 | "globals": { |
41 | "server": false, | 41 | "server": false, |
42 | "browser": false, | 42 | "browser": false, |
43 | "expect": false | 43 | "expect": false |
44 | }, | 44 | }, |
45 | "rules": { | 45 | "rules": { |
46 | "import/no-unresolved": 0, | 46 | "import/no-unresolved": 0, |
47 | "import/no-extraneous-dependencies": 0, | 47 | "import/no-extraneous-dependencies": 0, |
48 | "import/extensions": 0, | 48 | "import/extensions": 0, |
49 | "no-underscore-dangle": [ | 49 | "no-underscore-dangle": [ |
50 | "error", | 50 | "error", |
51 | { | 51 | { |
52 | "allow": [ | 52 | "allow": [ |
53 | "_id", | 53 | "_id", |
54 | "_ensureIndex", | 54 | "_ensureIndex", |
55 | "_verifyEmailToken", | 55 | "_verifyEmailToken", |
56 | "_resetPasswordToken", | 56 | "_resetPasswordToken", |
57 | "_name" | 57 | "_name" |
58 | ] | 58 | ] |
59 | } | 59 | } |
60 | ], | 60 | ], |
61 | "class-methods-use-this": 0 | 61 | "class-methods-use-this": 0 |
62 | } | 62 | } |
63 | }, | 63 | }, |
64 | "dependencies": { | 64 | "dependencies": { |
65 | "babel-runtime": "^6.18.0", | 65 | "babel-runtime": "^6.18.0", |
66 | "babyparse": "^0.4.6", | ||
66 | "bcrypt": "^0.8.7", | 67 | "bcrypt": "^0.8.7", |
67 | "bootstrap": "^4.0.0-alpha.6", | 68 | "bootstrap": "^4.0.0-alpha.6", |
68 | "jquery": "^2.2.4", | 69 | "jquery": "^2.2.4", |
69 | "jquery-validation": "^1.15.1", | 70 | "jquery-validation": "^1.15.1", |
70 | "material-fabmenu": "0.0.1", | 71 | "material-fabmenu": "0.0.1", |
71 | "material-ui": "^0.17.1", | 72 | "material-ui": "^0.17.1", |
72 | "moment": "^2.18.0", | 73 | "moment": "^2.18.0", |
73 | "react": "^15.4.2", | 74 | "react": "^15.4.2", |
74 | "react-addons-css-transition-group": "^15.4.2", | 75 | "react-addons-css-transition-group": "^15.4.2", |
75 | "react-addons-pure-render-mixin": "^15.3.2", | 76 | "react-addons-pure-render-mixin": "^15.3.2", |
76 | "react-addons-transition-group": "^15.4.2", | 77 | "react-addons-transition-group": "^15.4.2", |
77 | "react-bootstrap": "^0.30.8", | 78 | "react-bootstrap": "^0.30.8", |
78 | "react-bootstrap-date-picker": "^4.0.0", | 79 | "react-bootstrap-date-picker": "^4.0.0", |
79 | "react-dom": "^15.4.2", | 80 | "react-dom": "^15.4.2", |
80 | "react-fontawesome": "^1.5.0", | 81 | "react-fontawesome": "^1.5.0", |
81 | "react-komposer": "^1.13.1", | 82 | "react-komposer": "^1.13.1", |
82 | "react-router": "^2.6.1", | 83 | "react-router": "^2.6.1", |
83 | "react-router-bootstrap": "^0.23.1", | 84 | "react-router-bootstrap": "^0.23.1", |
84 | "react-svg": "^2.1.19", | 85 | "react-svg": "^2.1.19", |
85 | "react-tap-event-plugin": "^2.0.1", | 86 | "react-tap-event-plugin": "^2.0.1", |
86 | "reactstrap": "^4.3.0", | 87 | "reactstrap": "^4.3.0", |
87 | "velocity-animate": "^1.4.3", | 88 | "velocity-animate": "^1.4.3", |
88 | "velocity-react": "^1.2.1" | 89 | "velocity-react": "^1.2.1" |
89 | } | 90 | } |
90 | } | 91 | } |
91 | 92 |