Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// playerIds has changed since it was queried and the lobby might not
// have any available slots left, loop and retry.
}
} catch (error) {
console.error("Players.methods.ready", error);
}
}
});
export const updatePlayerData = new ValidatedMethod({
name: "Players.methods.updateData",
validate: new SimpleSchema({
playerId: {
type: String,
regEx: SimpleSchema.RegEx.Id
},
key: {
type: String
},
value: {
type: String
},
append: {
type: Boolean,
optional: true
},
noCallback: {
type: Boolean,
optional: true
}
}).validator(),
constructor() {
super('Opportunity', new SimpleSchema({
name: { type: String },
slugID: { type: String },
description: { type: String },
opportunityTypeID: { type: SimpleSchema.RegEx.Id },
sponsorID: { type: SimpleSchema.RegEx.Id },
interestIDs: [SimpleSchema.RegEx.Id],
semesterIDs: [SimpleSchema.RegEx.Id],
// Optional data
eventDate: { type: Date, optional: true },
ice: { type: Object, optional: true, blackbox: true },
retired: { type: Boolean, optional: true },
}));
}
const linkedinFirstName = Utils.getNestedProperty(user, 'services.linkedin.firstName');
if (profileName) return profileName;
if (twitterName) return twitterName;
if (linkedinFirstName) return `${linkedinFirstName} ${Utils.getNestedProperty(user, 'services.linkedin.lastName')}`;
if (user.username) return user.username;
return undefined;
},
searchable: true
},
/**
The user's email. Modifiable.
*/
email: {
type: String,
optional: true,
regEx: SimpleSchema.RegEx.Email,
mustComplete: true,
control: "text",
insertableBy: ['guests'],
editableBy: ['members'],
viewableBy: ownsOrIsAdmin,
order: 20,
onInsert: (user) => {
// look in a few places for the user email
const meteorEmails = Utils.getNestedProperty(user, 'services.meteor-developer.emails');
const facebookEmail = Utils.getNestedProperty(user, 'services.facebook.email');
const githubEmail = Utils.getNestedProperty(user, 'services.github.email');
const googleEmail = Utils.getNestedProperty(user, 'services.google.email');
const linkedinEmail = Utils.getNestedProperty(user, 'services.linkedin.emailAddress');
if (meteorEmails) return _.findWhere(meteorEmails, { primary: true }).address;
if (facebookEmail) return facebookEmail;
constructor() {
super('FavoriteCareerGoal', new SimpleSchema({
careerGoalID: SimpleSchema.RegEx.Id,
studentID: SimpleSchema.RegEx.Id,
retired: { type: Boolean, optional: true },
}));
this.publicationNames = {
scoreboard: `${this._collectionName}.scoreboard`,
};
}
constructor() {
super('AcademicPlan', new SimpleSchema({
name: String,
description: String,
slugID: SimpleSchema.RegEx.Id,
degreeID: SimpleSchema.RegEx.Id,
effectiveSemesterID: SimpleSchema.RegEx.Id,
semesterNumber: Number,
year: Number,
coursesPerSemester: { type: Array, minCount: 12, maxCount: 15 }, 'coursesPerSemester.$': Number,
courseList: [String],
retired: { type: Boolean, optional: true },
}));
if (Meteor.server) {
this._collection._ensureIndex({ _id: 1, degreeID: 1, effectiveSemesterID: 1 });
}
}
* @name Email
* @memberof Schemas
* @type {SimpleSchema}
* @property {String} provides optional
* @property {String} address required
* @property {Boolean} verified optional
*/
const Email = new SimpleSchema({
provides: {
type: String,
defaultValue: "default",
optional: true
},
address: {
type: String,
regEx: SimpleSchema.RegEx.Email
},
verified: {
type: Boolean,
defaultValue: false,
optional: true
}
});
/**
* @name Account
* @memberof Schemas
* @type {SimpleSchema}
* @property {String} userId required
* @property {String[]} sessions optional, Array of strings
* @property {String} shopId optional
* @property {String} name optional
import SimpleSchema from "simpl-schema";
import { registerSchema } from "@reactioncommerce/schemas";
import { PackageConfig } from "./registry";
/**
* @name SocialProvider
* @memberof Schemas
* @type {SimpleSchema}
* @property {String} profilePage optional, Profile Page
* @property {Boolean} enabled optional, default value: `false`
*/
export const SocialProvider = new SimpleSchema({
profilePage: {
type: String,
regEx: SimpleSchema.RegEx.Url,
label: "Profile Page",
optional: true
},
enabled: {
type: Boolean,
label: "Enabled",
defaultValue: false,
optional: true
}
});
registerSchema("SocialProvider", SocialProvider);
/**
* @name SocialPackageConfig
* @memberof Schemas
constructor() {
super('FavoriteAcademicPlan', new SimpleSchema({
academicPlanID: SimpleSchema.RegEx.Id,
studentID: SimpleSchema.RegEx.Id,
retired: { type: Boolean, optional: true },
}));
this.publicationNames = {
scoreboard: `${this._collectionName}.scoreboard`,
};
}
regEx: SimpleSchema.RegEx.Id,
optional: true,
autoValue() {
return Meteor.userId();
}
},
"user.isAnonymous": {
type: Boolean,
optional: true,
autoValue() {
return Roles.userIsInRole(Meteor.user(), "anonymous", getShopId());
}
},
"shopId": {
type: String,
regEx: SimpleSchema.RegEx.Id,
autoValue: shopIdAutoValue,
label: "AnalyticsEvents shopId"
},
"createdAt": {
type: Date,
autoValue: createdAtAutoValue
},
"data": {
type: Object,
blackbox: true,
optional: true
}
}, { check, tracker: Tracker });
registerSchema("AnalyticsEvents", AnalyticsEvents);
const buildChannelFormSchema = () => {
return new SimpleSchema({
name: {
type: String,
max: 50,
autoform: {
type: 'text',
label: I18n.t("channel_name")
}
},
email: {
type: String,
max: 50,
regEx: SimpleSchema.RegEx.Email,
autoform: {
type: 'emailInput',
label: "Email"
}
}
});
};