Image support!
Some checks failed
Test / test (push) Failing after 5s
Build and Deploy Nuxt / build (push) Successful in 1m46s

This commit is contained in:
2026-11-20 19:10:28 +01:00
parent d61659cfdd
commit fe662bb351
11 changed files with 119 additions and 21 deletions

View File

@@ -21,6 +21,26 @@ async function noteFolderFor(folderId, campaignId) {
return Folder.belongsToSection(folderId, campaignId, 'note');
}
// Every media row of a campaign, so a note can link to an upload by name (`[[harbour.png]]`) or
// display it (`![[harbour.png]]`).
router.get('/list', async (req, res) => {
try {
const { campaign } = req.query;
if (!campaign) return res.json({ status: 'error', msg: 'errors.missing-data' });
if (!(await userOwnsCampaign(campaign, req.user.id))) return res.json({ status: 'error', msg: 'unauthorized' });
const media = await Media.find({ campaign })
.select('_id name file mimeType date')
.sort({ name: 1 })
.lean();
res.json({ status: 'ok', media });
} catch (err) {
console.error(err);
res.json({ status: 'error', msg: 'errors.internal' });
}
});
router.post('/upload', upload.single('file'), async (req, res) => {
try {
const { campaign, folder } = req.body;