Removed all separate property collections to be replaced with a single "creature property" collection

This commit is contained in:
Stefan Zermatten
2019-07-30 15:13:39 +02:00
parent 31bc3663a7
commit 2385b69720
23 changed files with 169 additions and 969 deletions

View File

@@ -2,18 +2,6 @@ import SimpleSchema from 'simpl-schema';
import schema from '/imports/api/schema.js';
import AdjustmentSchema from '/imports/api/creature/subSchemas/AdjustmentSchema.js';
import StoredBuffSchema from '/imports/api/properties/Buffs.js';
import { PropertySchema } from '/imports/api/properties/Properties.js'
import ColorSchema from '/imports/api/creature/subSchemas/ColorSchema.js';
// Mixins
import creaturePermissionMixin from '/imports/api/creature/mixins/creaturePermissionMixin.js';
import { setDocToLastMixin } from '/imports/api/creature/mixins/setDocToLastMixin.js';
import { setDocAncestryMixin, ensureAncestryContainsCharIdMixin } from '/imports/api/parenting/parenting.js';
import simpleSchemaMixin from '/imports/api/creature/mixins/simpleSchemaMixin.js';
import propagateInheritanceUpdateMixin from '/imports/api/creature/mixins/propagateInheritanceUpdateMixin.js';
import updateSchemaMixin from '/imports/api/creature/mixins/updateSchemaMixin.js';
let Actions = new Mongo.Collection('actions');
/*
* Actions are things a character can do
@@ -21,7 +9,7 @@ let Actions = new Mongo.Collection('actions');
* Any actions that are children of this action will be considered alternatives
* to this action
*/
let ActionSchema = schema({
let ActionSchema = new SimpleSchema({
name: {
type: String,
optional: true,
@@ -93,39 +81,4 @@ let ActionSchema = schema({
},
});
ActionSchema.extend(ColorSchema);
Actions.attachSchema(ActionSchema);
Actions.attachSchema(PropertySchema);
const insertAction = new ValidatedMethod({
name: 'Actions.methods.insert',
mixins: [
creaturePermissionMixin,
setDocAncestryMixin,
ensureAncestryContainsCharIdMixin,
setDocToLastMixin,
simpleSchemaMixin,
],
collection: Actions,
permission: 'edit',
schema: ActionSchema,
run(action) {
return Actions.insert(action);
},
});
const updateAction = new ValidatedMethod({
name: 'Actions.methods.update',
mixins: [
propagateInheritanceUpdateMixin,
updateSchemaMixin,
creaturePermissionMixin,
],
collection: Actions,
permission: 'edit',
schema: ActionSchema,
});
export default Actions;
export { ActionSchema, insertAction, updateAction };
export default { ActionSchema };