const c = new Color({R: -3, G: 0, B: 255}); valid = c.validate();
@rlesniak, here’s what I’ve done.
User = Astro.Class({
name: 'User',
collection: Meteor.users,
fields: {
username: 'string',
password: 'string',
profile: 'object',
"profile.roleId": 'string',
services: 'object',
createdAt: {
type: 'date',
default: function() {
return new Date();
}
}
},
validators: {
username: [
Validators.required(null, "Please provide a username"),
Validators.string(),
Validators.minLength(5)
],
password: [
Validators.required(null, "Please provide a password"),
Validators.string(),
// Several other validators here
],
profile: Validators.required(),
"profile.roleId": [
Validators.required(null, "Please select the Role for the user"),
Validators.string()
],
createdAt: [
Validators.required(),
Validators.date()
]
},
methods: {
role: function() {
return Roles.findOne({_id: this.profile.roleId});
}
}
});
Let me know if you need more help.