Advertisement
Guest User

Untitled

a guest
May 22nd, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. Schema = {};
  2. Schema.UserProfile = new SimpleSchema({
  3. //LOTS OF FIELDS WORKING FINE
  4. });
  5.  
  6. Schema.User = new SimpleSchema({
  7. username: {
  8. type: String,
  9. optional: true
  10. },
  11. emails: {
  12. type: Array,
  13. },
  14. "emails.$": {
  15. type: Object
  16. },
  17. "emails.$.address": {
  18. type: String,
  19. regEx: SimpleSchema.RegEx.Email
  20. },
  21. "emails.$.verified": {
  22. type: Boolean
  23. },
  24. createdAt: {
  25. type: Date
  26. },
  27. profile: {
  28. type: Schema.UserProfile,
  29. label: "Perfil",
  30. optional: false
  31. },
  32. services: {
  33. type: Object,
  34. blackbox: true
  35. },
  36. "services.$": {
  37. type: Object,
  38. blackbox: true
  39. },
  40. "services.$.password": { // IS IT RIGHT?
  41. type: String,
  42. label: "Senha",
  43. min: 8
  44. },
  45. roles: {
  46. type: String,
  47. optional: true
  48. }
  49. });
  50.  
  51. Meteor.users.attachSchema(Schema.User);
  52.  
  53. let company = {};
  54. company = {
  55. email: $('#email').val(),
  56. password: $('#password').val(),
  57. roles: 'company',
  58. profile: companyProfile
  59. }
  60.  
  61. Meteor.call('saveUser', company, function(error, result) {
  62. if ( error ) {
  63. console.log(error);
  64. }
  65. }
  66.  
  67. Meteor.methods({
  68. saveUser: function(data) {
  69. return Accounts.createUser(data);
  70. }
  71. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement