Fix issue #61: Fix tests
All checks were successful
Test / test (push) Successful in 2s

This commit is contained in:
Gitea OpenCode Agent
2026-10-15 14:20:26 +00:00
parent 20128d195b
commit d8900cfb7f
5 changed files with 58 additions and 18 deletions

View File

@@ -85,6 +85,9 @@ function loadMapRoutes({ ownsCampaign = true, maps = [], notes = [] } = {}) {
},
// The pins do not ask after actors, only the token routes below do.
"../models/Actor": { findOne: () => mongooseQuery(null) },
// The map list's own folder tree: `/list` reads it and `/update` checks a move
// against it, so the pins need the model to answer, never what it answers.
"../models/Folder": { find: () => mongooseQuery([]), belongsToSection: async () => true },
});
}
@@ -181,7 +184,12 @@ function loadNoteRoutes({ ownsCampaign = true, notes = [], folders = [], deleted
findById: (id) => mongooseQuery(notes.find((note) => note._id === id) ?? null),
deleteOne: () => mongooseQuery({ deletedCount }),
},
"../models/Folder": { find: () => mongooseQuery(folders) },
"../models/Folder": {
find: () => mongooseQuery(folders),
// models/Folder.js: the note tree is every folder that is not one of the other
// campaign lists, whose rows carry no target at all.
filterForTarget: (target) => (target === "note" ? { target: { $nin: ["actor", "item", "map"] } } : { target }),
},
"../models/Map": {
// The driver drops the pins of the note from every map holding one; what is worth
// keeping here is the filter it is asked to do that with.