Added schema defaults to all schemas to prevent strings from being trimmed
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
|
||||
let Instances = new Mongo.Collection("instances");
|
||||
|
||||
let instanceSchema = new SimpleSchema({
|
||||
let instanceSchema = schema({
|
||||
//an instance is a single flow of time all parties in an instance are in-sync time wise
|
||||
});
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
|
||||
let Parties = new Mongo.Collection("parties");
|
||||
|
||||
let partySchema = new SimpleSchema({
|
||||
let partySchema = schema({
|
||||
name: {
|
||||
type: String,
|
||||
defaultValue: "New Party",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import deathSaveSchema from "/imports/api/creature/subSchemas/DeathSavesSchema.js"
|
||||
import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js";
|
||||
|
||||
@@ -9,7 +10,7 @@ import '/imports/api/creature/removeCreature.js';
|
||||
//set up the collection for creatures
|
||||
Creatures = new Mongo.Collection("creatures");
|
||||
|
||||
let creatureSchema = new SimpleSchema({
|
||||
let creatureSchema = schema({
|
||||
//strings
|
||||
name: {type: String, defaultValue: "", trim: false, optional: true},
|
||||
urlName: {type: String, trim: false, optional: true,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
import { ValidatedMethod } from 'meteor/mdg:validated-method';
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import { canEditCreature } from '/imports/api/creature/creaturePermission.js';
|
||||
import Creatures from "/imports/api/creature/Creatures.js";
|
||||
import Attributes from "/imports/api/creature/properties/Attributes.js";
|
||||
@@ -15,7 +16,7 @@ export const recomputeCreature = new ValidatedMethod({
|
||||
|
||||
name: "Creatures.methods.recomputeCreature",
|
||||
|
||||
validate: new SimpleSchema({
|
||||
validate: schema({
|
||||
charId: { type: String }
|
||||
}).validator(),
|
||||
|
||||
@@ -656,7 +657,7 @@ function evaluateCalculation(string, char){
|
||||
export const recomputeCreatureXP = new ValidatedMethod({
|
||||
name: "Creatures.methods.recomputeCreatureXP",
|
||||
|
||||
validate: new SimpleSchema({
|
||||
validate: schema({
|
||||
charId: { type: String }
|
||||
}).validator(),
|
||||
|
||||
@@ -686,7 +687,7 @@ export const recomputeCreatureXP = new ValidatedMethod({
|
||||
export const recomputeCreatureWeightCarried = new ValidatedMethod({
|
||||
name: "Creature.methods.recomputeCreatureWeightCarried",
|
||||
|
||||
validate: new SimpleSchema({
|
||||
validate: schema({
|
||||
charId: { type: String }
|
||||
}).validator(),
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import {makeChild} from "/imports/api/parenting.js";
|
||||
|
||||
let Actions = new Mongo.Collection("actions");
|
||||
@@ -6,7 +7,7 @@ let Actions = new Mongo.Collection("actions");
|
||||
/*
|
||||
* Actions are given to a character by items and features
|
||||
*/
|
||||
let actionSchema = new SimpleSchema({
|
||||
let actionSchema = schema({
|
||||
charId: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import {makeChild} from "/imports/api/parenting.js";
|
||||
|
||||
let Attacks = new Mongo.Collection("attacks");
|
||||
@@ -6,7 +7,7 @@ let Attacks = new Mongo.Collection("attacks");
|
||||
/*
|
||||
* Attacks are given to a character by items and features
|
||||
*/
|
||||
attackSchema = new SimpleSchema({
|
||||
attackSchema = schema({
|
||||
charId: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {makeChild} from "/imports/api/parenting.js";
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js";
|
||||
import { canEditCreature } from '/imports/api/creature/creaturePermission.js';
|
||||
import { recomputeCreatureById } from '/imports/api/creature/creatureComputation.js'
|
||||
@@ -10,7 +11,7 @@ let Attributes = new Mongo.Collection("attributes");
|
||||
/*
|
||||
* Attributes are numbered stats of a character
|
||||
*/
|
||||
attributeSchema = new SimpleSchema({
|
||||
attributeSchema = schema({
|
||||
charId: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
@@ -98,7 +99,7 @@ const updateAttribute = new ValidatedMethod({
|
||||
|
||||
name: "Attributes.methods.update",
|
||||
|
||||
validate: new SimpleSchema({
|
||||
validate: schema({
|
||||
_id: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
@@ -125,7 +126,7 @@ const adjustAttribute = new ValidatedMethod({
|
||||
|
||||
name: "Attributes.methods.adjust",
|
||||
|
||||
validate: new SimpleSchema({
|
||||
validate: schema({
|
||||
_id: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import {makeParent} from "/imports/api/parenting.js";
|
||||
import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js";
|
||||
|
||||
let Buffs = new Mongo.Collection("buffs");
|
||||
|
||||
let buffSchema = new SimpleSchema({
|
||||
let buffSchema = schema({
|
||||
charId: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
|
||||
@@ -1,27 +1,28 @@
|
||||
import SimpleSchema from "simpl-schema";
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
|
||||
let Bundles = new Mongo.Collection("bundle");
|
||||
|
||||
let attributeSchema = new SimpleSchema({
|
||||
let attributeSchema = schema({
|
||||
name: String,
|
||||
variableName: String,
|
||||
baseValue: String,
|
||||
type: String,
|
||||
});
|
||||
|
||||
let skillSchema = new SimpleSchema({
|
||||
let skillSchema = schema({
|
||||
name: String,
|
||||
variableName: String,
|
||||
ability: String,
|
||||
type: String,
|
||||
});
|
||||
|
||||
let damageMultiplierSchema = new SimpleSchema({
|
||||
let damageMultiplierSchema = schema({
|
||||
name: String,
|
||||
variableName: String,
|
||||
});
|
||||
|
||||
let effectSchema = new SimpleSchema({
|
||||
let effectSchema = schema({
|
||||
name: String,
|
||||
stat: String,
|
||||
operation: {type: String},
|
||||
@@ -29,7 +30,7 @@ let effectSchema = new SimpleSchema({
|
||||
value: {type: Number, optional: true}
|
||||
});
|
||||
|
||||
let itemSchema = new SimpleSchema({
|
||||
let itemSchema = schema({
|
||||
name: String,
|
||||
plural: {type: String, optional: true,},
|
||||
description: {type: String, optional: true,},
|
||||
@@ -41,7 +42,7 @@ let itemSchema = new SimpleSchema({
|
||||
"settings.showIncrement": {type: Boolean, optional: true},
|
||||
});
|
||||
|
||||
let containerSchema = new SimpleSchema({
|
||||
let containerSchema = schema({
|
||||
name: String,
|
||||
isCarried: Boolean,
|
||||
weight: {type: Number, min: 0},
|
||||
@@ -51,7 +52,7 @@ let containerSchema = new SimpleSchema({
|
||||
"items.$": itemSchema,
|
||||
});
|
||||
|
||||
let featureSchema = new SimpleSchema({
|
||||
let featureSchema = schema({
|
||||
name: String,
|
||||
description: {type: String, optional: true},
|
||||
uses: {type: String, optional: true},
|
||||
@@ -60,7 +61,7 @@ let featureSchema = new SimpleSchema({
|
||||
"effects.$": effectSchema,
|
||||
});
|
||||
|
||||
let bundleSchema = new SimpleSchema({
|
||||
let bundleSchema = schema({
|
||||
attributes: Array,
|
||||
"attributes.$": attributeSchema,
|
||||
skills: Array,
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import {makeParent} from "/imports/api/parenting.js";
|
||||
import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js";
|
||||
|
||||
let Classes = new Mongo.Collection("classes");
|
||||
|
||||
classSchema= new SimpleSchema({
|
||||
classSchema= schema({
|
||||
charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
|
||||
name: {type: String, optional: true, trim: false},
|
||||
level: {type: SimpleSchema.Integer},
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import {makeParent} from "/imports/api/parenting.js";
|
||||
import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js";
|
||||
|
||||
let Conditions = new Mongo.Collection("conditions");
|
||||
|
||||
conditionSchema = new SimpleSchema({
|
||||
conditionSchema = schema({
|
||||
charId: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import {makeParent, makeChild} from "/imports/api/parenting.js";
|
||||
|
||||
let CustomBuffs = new Mongo.Collection("customBuffs");
|
||||
|
||||
customBuffSchema = new SimpleSchema({
|
||||
customBuffSchema = schema({
|
||||
charId: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import {makeChild} from "/imports/api/parenting.js";
|
||||
|
||||
const DamageMultipliers = new Mongo.Collection("damageMultipliers");
|
||||
@@ -6,7 +7,7 @@ const DamageMultipliers = new Mongo.Collection("damageMultipliers");
|
||||
/*
|
||||
* DamageMultipliers are whole numbered stats of a character
|
||||
*/
|
||||
const damageMultiplierSchema = new SimpleSchema({
|
||||
const damageMultiplierSchema = schema({
|
||||
charId: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import {makeChild} from "/imports/api/parenting.js";
|
||||
|
||||
Effects = new Mongo.Collection("effects");
|
||||
@@ -7,7 +8,7 @@ Effects = new Mongo.Collection("effects");
|
||||
* Effects are reason-value attached to skills and abilities
|
||||
* that modify their final value or presentation in some way
|
||||
*/
|
||||
effectSchema = new SimpleSchema({
|
||||
effectSchema = schema({
|
||||
charId: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
|
||||
Experiences = new Mongo.Collection("experience");
|
||||
|
||||
let experienceSchema = new SimpleSchema({
|
||||
let experienceSchema = schema({
|
||||
charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
|
||||
name: {type: String, optional: true, trim: false, defaultValue: "New Experience"},
|
||||
description: {type: String, optional: true, trim: false},
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js";
|
||||
import {makeParent} from "/imports/api/parenting.js";
|
||||
|
||||
let Features = new Mongo.Collection("features");
|
||||
|
||||
let featureSchema = new SimpleSchema({
|
||||
let featureSchema = schema({
|
||||
charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
|
||||
name: {type: String, optional: true, trim: false},
|
||||
description: {type: String, optional: true, trim: false},
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js";
|
||||
|
||||
let Notes = new Mongo.Collection("notes");
|
||||
|
||||
noteSchema = new SimpleSchema({
|
||||
noteSchema = schema({
|
||||
charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
|
||||
name: {type: String, optional: true, trim: false},
|
||||
description: {type: String, optional: true, trim: false},
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import {makeChild} from "/imports/api/parenting.js";
|
||||
|
||||
Proficiencies = new Mongo.Collection("proficiencies");
|
||||
|
||||
proficiencySchema = new SimpleSchema({
|
||||
proficiencySchema = schema({
|
||||
charId: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import {makeChild} from "/imports/api/parenting.js";
|
||||
|
||||
let Skills = new Mongo.Collection("skills");
|
||||
@@ -7,7 +8,7 @@ let Skills = new Mongo.Collection("skills");
|
||||
* Skills are anything that results in a modifier to be added to a D20
|
||||
* Skills usually have an ability score modifier that they use as their basis
|
||||
*/
|
||||
let skillSchema = new SimpleSchema({
|
||||
let skillSchema = schema({
|
||||
charId: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import Attributes from "/imports/api/creature/properties/Attributes.js";
|
||||
import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js";
|
||||
import {makeParent} from "/imports/api/parenting.js";
|
||||
|
||||
let SpellLists = new Mongo.Collection("spellLists");
|
||||
|
||||
let spellListSchema = new SimpleSchema({
|
||||
let spellListSchema = schema({
|
||||
charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
|
||||
name: {type: String, optional: true, trim: false},
|
||||
description: {type: String, optional: true, trim: false},
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js";
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import {makeParent, makeChild} from "/imports/api/parenting.js";
|
||||
|
||||
const magicSchools = [
|
||||
@@ -15,7 +16,7 @@ const magicSchools = [
|
||||
|
||||
let Spells = new Mongo.Collection("spells");
|
||||
|
||||
let spellSchema = new SimpleSchema({
|
||||
let spellSchema = schema({
|
||||
charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
|
||||
prepared: {
|
||||
type: String,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
|
||||
const ColorSchema = ({optional = false} = {}) => ({
|
||||
type: String,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
|
||||
const DeathSavesSchema = new SimpleSchema({
|
||||
const DeathSavesSchema = schema({
|
||||
pass: {
|
||||
type: SimpleSchema.Integer,
|
||||
min: 0,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
|
||||
let Icons = new Mongo.Collection('icons');
|
||||
|
||||
iconsSchema = new SimpleSchema({
|
||||
iconsSchema = schema({
|
||||
name: {
|
||||
type: String,
|
||||
unique: true,
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import {makeParent} from "/imports/api/parenting.js";
|
||||
import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js";
|
||||
|
||||
//set up the collection for containers
|
||||
let Containers = new Mongo.Collection("containers");
|
||||
|
||||
let containerSchema = new SimpleSchema({
|
||||
let containerSchema = schema({
|
||||
name: {type: String, optional: true, trim: false},
|
||||
charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
|
||||
isCarried: {type: Boolean},
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import {makeParent, makeChild} from "/imports/api/parenting.js";
|
||||
import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js";
|
||||
|
||||
Items = new Mongo.Collection("items");
|
||||
|
||||
itemSchema = new SimpleSchema({
|
||||
itemSchema = schema({
|
||||
name: {type: String, optional: true, trim: false, defaultValue: "New Item"},
|
||||
plural: {type: String, optional: true, trim: false},
|
||||
description: {type: String, optional: true, trim: false},
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
|
||||
Libraries = new Mongo.Collection("library");
|
||||
|
||||
librarySchema = new SimpleSchema({
|
||||
librarySchema = schema({
|
||||
name: {type: String},
|
||||
owner: {type: String, regEx: SimpleSchema.RegEx.Id},
|
||||
readers: {type: Array, defaultValue: []},
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import libraryAttacksSchema from "/imports/api/library/";
|
||||
|
||||
LibraryItems = new Mongo.Collection("libraryItems");
|
||||
|
||||
libraryItemsSchema = new SimpleSchema({
|
||||
libraryItemsSchema = schema({
|
||||
libraryName:{type: String, optional: true, trim: false},
|
||||
name: {type: String, defaultValue: "New Item", trim: false},
|
||||
plural: {type: String, optional: true, trim: false},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
LibrarySpells = new Mongo.Collection("librarySpells");
|
||||
|
||||
Schemas.LibrarySpells = new SimpleSchema({
|
||||
Schemas.LibrarySpells = schema({
|
||||
name: {
|
||||
type: String,
|
||||
trim: false,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
|
||||
libraryAttacksSchema = new SimpleSchema({
|
||||
libraryAttacksSchema = schema({
|
||||
name: {
|
||||
type: String,
|
||||
defaultValue: "New Attack",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
|
||||
libraryEffectsSchema = new SimpleSchema({
|
||||
libraryEffectsSchema = schema({
|
||||
name: {
|
||||
type: String,
|
||||
optional: true, //TODO make necessary if there is no owner
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Blacklist = new Mongo.Collection("blacklist");
|
||||
|
||||
Schemas.Blacklist = new SimpleSchema({
|
||||
Schemas.Blacklist = schema({
|
||||
userId: {
|
||||
type: String,
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
ChangeLogs = new Mongo.Collection("changeLogs");
|
||||
|
||||
Schemas.ChangeLog = new SimpleSchema({
|
||||
Schemas.ChangeLog = schema({
|
||||
version: {
|
||||
type: String,
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Reports = new Mongo.Collection("reports");
|
||||
|
||||
Schemas.Report = new SimpleSchema({
|
||||
Schemas.Report = schema({
|
||||
owner: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import { ValidatedMethod } from 'meteor/mdg:validated-method';
|
||||
import { _ } from 'meteor/underscore';
|
||||
|
||||
let childSchema = new SimpleSchema({
|
||||
let childSchema = schema({
|
||||
parent: {type: Object},
|
||||
"parent.collection": {type: String},
|
||||
"parent.id": {type: String, regEx: SimpleSchema.RegEx.Id, index: 1},
|
||||
@@ -175,7 +176,7 @@ let checkRemovePermission = function(collectionName, id, self){
|
||||
const softRemoveNode = new ValidatedMethod({
|
||||
name: "parenting.methods.softRemoveNode",
|
||||
|
||||
validate: new SimpleSchema({
|
||||
validate: schema({
|
||||
collectionName: {type: String,},
|
||||
id: {
|
||||
type: String,
|
||||
|
||||
18
app/imports/api/schema.js
Normal file
18
app/imports/api/schema.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
|
||||
function getDefaultSchema(){
|
||||
return new SimpleSchema({}, {
|
||||
clean: {
|
||||
filter: true,
|
||||
autoConvert: true,
|
||||
removeEmptyStrings: true,
|
||||
trimStrings: false,
|
||||
getAutoValues: true,
|
||||
removeNullsFromArrays: true,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export default function schema(options){
|
||||
return getDefaultSchema().extend(options);
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
Schemas.UserProfile = new SimpleSchema({
|
||||
Schemas.UserProfile = schema({
|
||||
username: {
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
});
|
||||
|
||||
Schemas.User = new SimpleSchema({
|
||||
Schemas.User = schema({
|
||||
username: {
|
||||
type: String,
|
||||
optional: true,
|
||||
@@ -85,7 +85,7 @@ Meteor.users.gnerateApiKey = new ValidatedMethod({
|
||||
|
||||
Meteor.users.sendVerificationEmail = new ValidatedMethod({
|
||||
name: "Users.methods.sendVerificationEmail",
|
||||
validate: new SimpleSchema({
|
||||
validate: schema({
|
||||
userId:{
|
||||
type: String,
|
||||
optional: true,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
|
||||
if (Meteor.isDevelopment){
|
||||
SimpleSchema.debug = true
|
||||
|
||||
Reference in New Issue
Block a user