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);
|
||||
|
||||
Reference in New Issue
Block a user