This commit is contained in:
@@ -12,8 +12,20 @@ const FolderSchema = new Schema({
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'Folder'
|
||||
},
|
||||
// Which campaign list a folder belongs to. Note folders are what this model has
|
||||
// always held, and their rows carry no target at all, so everything reading the
|
||||
// note tree asks for `{ target: { $ne: 'item' } }` and keeps finding them.
|
||||
target: { type: String, enum: ['note', 'item'], default: 'note' },
|
||||
// The Foundry item folder this row mirrors, set by the item sync only
|
||||
// (see routes/foundry-link.js).
|
||||
foundryFolderId: { type: String },
|
||||
color: { type: String },
|
||||
date: { type: Date, default: Date.now }
|
||||
});
|
||||
|
||||
FolderSchema.index(
|
||||
{ campaign: 1, foundryFolderId: 1 },
|
||||
{ unique: true, partialFilterExpression: { foundryFolderId: { $type: 'string' } } }
|
||||
);
|
||||
|
||||
module.exports = mongoose.model('Folder', FolderSchema);
|
||||
|
||||
@@ -28,6 +28,13 @@ const ItemSchema = new Schema({
|
||||
ref: 'Campaign',
|
||||
required: true
|
||||
},
|
||||
// The folder this item stands in: a Folder of the same campaign whose target is
|
||||
// 'item' (null = the root of the item list).
|
||||
folder: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'Folder',
|
||||
default: null
|
||||
},
|
||||
foundryItemId: { type: String },
|
||||
// Names Foundry uses for this item. Dragonroll may rename it, and the copies
|
||||
// Foundry keeps sending still have to fold into this row instead of
|
||||
|
||||
Reference in New Issue
Block a user