Removed all separate property collections to be replaced with a single "creature property" collection
This commit is contained in:
@@ -1,19 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import { PropertySchema } from '/imports/api/properties/Properties.js'
|
||||
|
||||
// Mixins
|
||||
import recomputeCreatureMixin from '/imports/api/creature/mixins/recomputeCreatureMixin.js';
|
||||
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 Proficiencies = new Mongo.Collection("proficiencies");
|
||||
|
||||
let ProficiencySchema = schema({
|
||||
let ProficiencySchema = new SimpleSchema({
|
||||
// The variableName of the skill to apply this to
|
||||
skill: {
|
||||
type: String,
|
||||
@@ -27,46 +14,4 @@ let ProficiencySchema = schema({
|
||||
},
|
||||
});
|
||||
|
||||
Proficiencies.attachSchema(ProficiencySchema);
|
||||
Proficiencies.attachSchema(PropertySchema);
|
||||
|
||||
const insertProficiency = new ValidatedMethod({
|
||||
name: 'Proficiencies.methods.insert',
|
||||
mixins: [
|
||||
creaturePermissionMixin,
|
||||
setDocToLastMixin,
|
||||
setDocAncestryMixin,
|
||||
ensureAncestryContainsCharIdMixin,
|
||||
recomputeCreatureMixin,
|
||||
simpleSchemaMixin,
|
||||
],
|
||||
collection: Proficiencies,
|
||||
permission: 'edit',
|
||||
schema: ProficiencySchema,
|
||||
run(prof) {
|
||||
return Proficiencies.insert(prof);
|
||||
},
|
||||
});
|
||||
|
||||
const updateProficiency = new ValidatedMethod({
|
||||
name: 'Proficiencies.methods.update',
|
||||
mixins: [
|
||||
recomputeCreatureMixin,
|
||||
propagateInheritanceUpdateMixin,
|
||||
updateSchemaMixin,
|
||||
creaturePermissionMixin,
|
||||
],
|
||||
collection: Proficiencies,
|
||||
permission: 'edit',
|
||||
schema: ProficiencySchema,
|
||||
skipRecompute({update}){
|
||||
let fields = getModifierFields(update);
|
||||
return !fields.hasAny([
|
||||
'value',
|
||||
'skill',
|
||||
]);
|
||||
},
|
||||
});
|
||||
|
||||
export default Proficiencies;
|
||||
export { ProficiencySchema, insertProficiency, updateProficiency };
|
||||
export { ProficiencySchema };
|
||||
|
||||
Reference in New Issue
Block a user