Fix issue #44: Sync item folders
Some checks failed
Test / test (push) Failing after 2s

This commit is contained in:
Gitea OpenCode Agent
2026-10-14 23:39:26 +00:00
parent c7d20dd1f7
commit 1f9ab330b9
14 changed files with 981 additions and 23 deletions

View File

@@ -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);