methods now use correct mixins
This commit is contained in:
@@ -9,6 +9,8 @@ import creaturePermissionMixin from '/imports/api/mixins/creaturePermissionMixin
|
||||
import { setDocToLastMixin } from '/imports/api/mixins/setDocToLastMixin.js';
|
||||
import { setDocAncestryMixin, ensureAncestryContainsCharIdMixin } from '/imports/api/parenting/parenting.js';
|
||||
import simpleSchemaMixin from '/imports/api/mixins/simpleSchemaMixin.js';
|
||||
import propagateInheritanceUpdateMixin from '/imports/api/mixins/propagateInheritanceUpdateMixin.js';
|
||||
import updateSchemaMixin from '/imports/api/mixins/updateSchemaMixin.js';
|
||||
|
||||
const magicSchools = [
|
||||
'Abjuration',
|
||||
@@ -28,11 +30,18 @@ let SpellSchema = schema({
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
prepared: {
|
||||
type: String,
|
||||
defaultValue: 'prepared',
|
||||
allowedValues: ['prepared', 'unprepared', 'always'],
|
||||
// If it's always prepared, it doesn't count against the number of spells
|
||||
// prepared in a spell list, and enabled should be true
|
||||
alwaysPrepared: {
|
||||
type: Boolean,
|
||||
defaultValue: false,
|
||||
},
|
||||
// Spells are enabled when they are prepared, so that unprepared spells don't
|
||||
// show their actions
|
||||
enabled: {
|
||||
type: Boolean,
|
||||
defaultValue: true,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
@@ -108,18 +117,13 @@ const insertSpell = new ValidatedMethod({
|
||||
const updateSpell = new ValidatedMethod({
|
||||
name: 'Spells.methods.update',
|
||||
mixins: [
|
||||
propagateInheritanceUpdateMixin,
|
||||
updateSchemaMixin,
|
||||
creaturePermissionMixin,
|
||||
simpleSchemaMixin,
|
||||
],
|
||||
collection: Spells,
|
||||
permission: 'edit',
|
||||
schema: new SimpleSchema({
|
||||
_id: SimpleSchema.RegEx.Id,
|
||||
update: SpellSchema.omit('name'),
|
||||
}),
|
||||
run({_id, update}) {
|
||||
return Spells.update(_id, {$set: update});
|
||||
},
|
||||
schema: SpellSchema,
|
||||
});
|
||||
|
||||
export default Spells;
|
||||
|
||||
Reference in New Issue
Block a user