Added migration for libraryTags

This commit is contained in:
Stefan Zermatten
2023-04-17 15:28:06 +02:00
parent 90235a5bc6
commit d643886a7f
9 changed files with 321 additions and 107 deletions

View File

@@ -59,7 +59,7 @@ let LibraryNodeSchema = new SimpleSchema({
},
libraryTags: {
type: Array,
defaultValue: [],
optional: true,
maxCount: STORAGE_LIMITS.tagCount,
},
'libraryTags.$': {
@@ -72,12 +72,14 @@ let LibraryNodeSchema = new SimpleSchema({
optional: true,
max: STORAGE_LIMITS.variableName,
},
/* TODO: Disabled for now until image upload is working
// Image to display when filling the slot
slotFillImage: {
type: String,
optional: true,
max: STORAGE_LIMITS.url,
},
*/
// Fill more than one quantity in a slot, like feats and ability score
// improvements, filtered out of UI if there isn't space in quantityExpected
slotQuantityFilled: {

View File

@@ -1,14 +1,19 @@
import SimpleSchema from 'simpl-schema';
import STORAGE_LIMITS from '/imports/constants/STORAGE_LIMITS.js';
import createPropertySchema from '/imports/api/properties/subSchemas/createPropertySchema.js';
// Folders organize a character sheet into a tree, particularly to group things
// like 'race' and 'background'
let FolderSchema = new createPropertySchema({
let FolderSchema = createPropertySchema({
name: {
type: String,
max: STORAGE_LIMITS.name,
optional: true,
},
description: {
type: 'inlineCalculationFieldToCompute',
optional: true,
},
groupStats: {
type: Boolean,
optional: true,
@@ -33,6 +38,19 @@ let FolderSchema = new createPropertySchema({
},
});
const ComputedOnlyFolderSchema = new createPropertySchema({});
const ComputedOnlyFolderSchema = createPropertySchema({
summary: {
type: 'computedOnlyInlineCalculationField',
optional: true,
},
description: {
type: 'computedOnlyInlineCalculationField',
optional: true,
},
});
export { FolderSchema, ComputedOnlyFolderSchema };
const ComputedFolderSchema = new SimpleSchema()
.extend(FolderSchema)
.extend(ComputedOnlyFolderSchema);
export { FolderSchema, ComputedFolderSchema, ComputedOnlyFolderSchema };

View File

@@ -13,7 +13,7 @@ import { ComputedDamageSchema } from '/imports/api/properties/Damages.js';
import { DamageMultiplierSchema } from '/imports/api/properties/DamageMultipliers.js';
import { ComputedEffectSchema } from '/imports/api/properties/Effects.js';
import { ComputedFeatureSchema } from '/imports/api/properties/Features.js';
import { FolderSchema } from '/imports/api/properties/Folders.js';
import { ComputedFolderSchema } from '/imports/api/properties/Folders.js';
import { ComputedItemSchema } from '/imports/api/properties/Items.js';
import { ComputedNoteSchema } from '/imports/api/properties/Notes.js';
import { ComputedPointBuySchema } from '/imports/api/properties/PointBuys.js';
@@ -43,7 +43,7 @@ const propertySchemasIndex = {
damageMultiplier: DamageMultiplierSchema,
effect: ComputedEffectSchema,
feature: ComputedFeatureSchema,
folder: FolderSchema,
folder: ComputedFolderSchema,
note: ComputedNoteSchema,
pointBuy: ComputedPointBuySchema,
proficiency: ProficiencySchema,