Began making generic tree re-arranging methods, still buggy
This commit is contained in:
@@ -8,7 +8,7 @@ import getModifierFields from '/imports/api/getModifierFields.js';
|
||||
let LibraryNodes = new Mongo.Collection('libraryNodes');
|
||||
|
||||
let LibraryNodeSchema = new SimpleSchema({
|
||||
libraryNodeType: {
|
||||
type: {
|
||||
type: String,
|
||||
allowedValues: Object.keys(librarySchemas),
|
||||
},
|
||||
@@ -20,7 +20,7 @@ for (let key in librarySchemas){
|
||||
schema.extend(LibraryNodeSchema);
|
||||
schema.extend(ChildSchema);
|
||||
LibraryNodes.attachSchema(schema, {
|
||||
selector: {libraryNodeType: key}
|
||||
selector: {type: key}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ const updateNode = new ValidatedMethod({
|
||||
validate({_id, update}){
|
||||
let fields = getModifierFields(update);
|
||||
return !fields.hasAny([
|
||||
'libraryNodeType',
|
||||
'type',
|
||||
'order',
|
||||
'parent',
|
||||
'ancestors',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CreatureSchema } from '/imports/api/creature/Creatures.js';
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import { ActionSchema } from '/imports/api/properties/Actions.js';
|
||||
import { AttributeSchema } from '/imports/api/properties/Attributes.js';
|
||||
import { StoredBuffSchema } from '/imports/api/properties/Buffs.js';
|
||||
@@ -20,7 +20,6 @@ import { ItemSchema } from '/imports/api/properties/Items.js';
|
||||
|
||||
|
||||
const librarySchemas = {
|
||||
creature: CreatureSchema,
|
||||
action: ActionSchema,
|
||||
attribute: AttributeSchema,
|
||||
buff: StoredBuffSchema,
|
||||
@@ -39,6 +38,7 @@ const librarySchemas = {
|
||||
spell: SpellSchema,
|
||||
container: ContainerSchema,
|
||||
item: ItemSchema,
|
||||
any: new SimpleSchema({}),
|
||||
};
|
||||
|
||||
export default librarySchemas;
|
||||
|
||||
Reference in New Issue
Block a user