Ejemplo n.º 1
0
import {Meteor} from 'meteor/meteor';
import {checkEmailToken} from './check';
import {Students} from 'lib/collections';

Meteor.methods({
  updateProfile({email, token}, {name, link}) {
    const userId = this.userId;
    const student = checkEmailToken({email, token, userId});
    const obj = {};
    if (name !== undefined) { obj.name = name; }
    if (link !== undefined) { obj.link = link; }
    return Students.update(
      {_id: student._id},
      {$set: obj},
      { trimStrings: false }
    );
  }
});
Ejemplo n.º 2
0
import {Submissions, Students} from 'lib/collections';

Submissions._ensureIndex({
  users: 1,
  target_name: 1,
  submission_time: 1,
  performance: 1,
  score: 1
});

Students._ensureIndex({email: 1});