Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!this.value || this.value.length === 0) {
return 'required'
}
},
autoValue: function () {
if (!this.field('when.multipleDays').value) {
return null
}
if (this.value) {
return this.value.map(d => !d ? false : d) // remove empty slots
}
}
},
'when.days.$': {
type: SimpleSchema.oneOf(DaySchema, Boolean),
required: false
},
'when.repeat': {
type: Boolean,
defaultValue: false
},
'when.recurring': { // used with repeat
type: Object,
optional: true,
autoValue: function () {
if (!this.field('when.repeat').value) {
return null
}
}
},
'when.recurring.type': {
});
const StoredRollModifierSchema = new SimpleSchema({
_id: {
type: String,
regEx: SimpleSchema.RegEx.Id,
autoValue(){
if (!this.isSet) return Random.id();
}
},
}).extend(RollModifierSchema);
const ComputedRollModifierSchema = new SimpleSchema({
// The computed result of the effect
result: {
type: SimpleSchema.oneOf(Number, String),
optional: true,
},
}).extend(RollModifierSchema);
export { RollModifierSchema, StoredRollModifierSchema, ComputedRollModifierSchema };
if (this.isInsert && (!this.isFromTrustedCode || !this.isSet)) {
return this.userId;
}
return undefined;
},
index: 1,
denyUpdate: true,
},
conversationId: {
type: String,
regEx: SimpleSchema.RegEx.Id,
index: 1,
denyUpdate: true,
},
body: {
type: SimpleSchema.oneOf(String, Object),
},
createdAt: {
type: Date,
autoValue() {
if (this.isInsert) {
return ServerTime.date();
}
return undefined;
},
index: -1,
denyUpdate: true,
},
// Latest update date
updatedAt: {
type: Date,
optional: true,
if (!this.value || this.value.length === 0) {
return 'required'
}
},
autoValue: function () {
if (!this.field('when.multipleDays').value) {
return null
}
if (this.value) {
return this.value.map(d => !d ? false : d) // remove empty slots
}
}
},
'when.days.$': {
type: SimpleSchema.oneOf(DaySchema, Boolean),
required: false
},
'when.repeat': {
type: Boolean,
defaultValue: false
},
'when.recurring': { // used with repeat
type: Object,
optional: true,
autoValue: function () {
if (!this.field('when.repeat').value) {
return null
}
}
},
'when.recurring.type': {
geometry: {
type: Object
},
"geometry.type": {
type: String,
allowedValues: ["LineString", "Polygon", "Point"]
},
"geometry.coordinates": {
type: Array,
maxCount: 200
},
"geometry.coordinates.$": {
type: SimpleSchema.oneOf(Number, { type: Array, maxCount: 200 })
},
"geometry.coordinates.$.$": {
type: SimpleSchema.oneOf(Number, { type: Array, maxCount: 2 })
},
"geometry.coordinates.$.$.$": {
type: Number
},
createdAt: {
type: Date,
autoValue() {
if (this.isInsert) {
return new Date();
} else if (this.isUpsert) {
return { $setOnInsert: new Date() };
} else {
return this.unset();
}
}
}
export function runAfterUpdateHooks(context, updates, shopId) {
Object.keys(updates).forEach((field) => {
const config = shopId ? shopSettingsConfig[field] : globalSettingsSchema[field];
if (!config || !config.afterUpdate) return;
config.afterUpdate(context, { shopId, value: updates[field] });
});
}
const configSchema = new SimpleSchema({
"afterUpdate": {
type: Function,
optional: true
},
"defaultValue": {
type: SimpleSchema.oneOf(String, Number, Date, Boolean),
optional: true
},
"rolesThatCanEdit": {
type: Array,
optional: true
},
"rolesThatCanEdit.$": String,
"simpleSchema": {
type: Object,
blackbox: true
}
});
/**
* @summary Reads and merges `appSettingsConfig` from all plugin registration.
* @returns {undefined}
type: String,
optional: true
}
})
const editCoinFormSchema = new SimpleSchema({
coin_id: {
type: Id
},
coinName: {
type: String,
min: 3,
max: 20
},
changed: editCoinChangedFieldSchema,
old: SimpleSchema.oneOf({
type: String
}, {
type: Number
}),
changedDate: {
type: Number
},
createdBy: {
type: String
},
score: {
type: Number
},
status: {
type: String
},
export function runAfterUpdateHooks(context, updates, shopId) {
Object.keys(updates).forEach((field) => {
const config = shopId ? shopSettingsConfig[field] : globalSettingsSchema[field];
if (!config || !config.afterUpdate) return;
config.afterUpdate(context, { shopId, value: updates[field] });
});
}
const configSchema = new SimpleSchema({
"afterUpdate": {
type: Function,
optional: true
},
"defaultValue": {
type: SimpleSchema.oneOf(String, Number, Date, Boolean),
optional: true
},
"rolesThatCanEdit": {
type: Array,
optional: true
},
"rolesThatCanEdit.$": String,
"simpleSchema": {
type: Object,
blackbox: true
}
});
/**
* @summary Reads and merges `appSettingsConfig` from all plugin registration.
* @returns {undefined}
import { foreignKeyField } from '../../modules/utils/schemaUtils'
import SimpleSchema from 'simpl-schema'
export const ContentType = new SimpleSchema({
type: String,
data: SimpleSchema.oneOf(
String,
{
type: Object,
blackbox: true
}
)
})
SimpleSchema.extendOptions([ 'inputType' ]);
const schema = {
_id: {
type: String,
viewableBy: ['guests'],
},
documentId: {