Fix healthchecks: install curl in backend and frontend images

This commit is contained in:
Agent Zero
2026-05-24 21:54:58 +00:00
commit cdf350c618
52 changed files with 7885 additions and 0 deletions
+59
View File
@@ -0,0 +1,59 @@
const express = require('express');
const authenticate = require('../middleware/auth');
const Block = require('../models/Block');
const router = express.Router();
// Public blocks (no auth for listing)
router.get('/', async (req, res) => {
try {
const blocks = await Block.findAll({
where: { is_public: true },
attributes: ['id', 'name', 'svg_data', 'category'],
});
res.json(blocks);
} catch (err) {
console.error(err);
res.status(500).json({ error: 'Failed to list blocks' });
}
});
// Protected: create a new block (requires auth)
router.post('/', authenticate, async (req, res) => {
try {
const { name, svg_data, category, is_public } = req.body;
if (!name || !svg_data) {
return res.status(400).json({ error: 'Name and svg_data required' });
}
const block = await Block.create({
name,
svg_data,
category: category || 'Allgemein',
is_public: is_public !== undefined ? is_public : true,
userId: req.user.id,
});
res.status(201).json(block);
} catch (err) {
console.error(err);
res.status(500).json({ error: 'Failed to create block' });
}
});
// Protected: delete block (only owner)
router.delete('/:id', authenticate, async (req, res) => {
try {
const block = await Block.findOne({
where: { id: req.params.id, userId: req.user.id },
});
if (!block) {
return res.status(404).json({ error: 'Block not found or not authorized' });
}
await block.destroy();
res.json({ message: 'Block deleted' });
} catch (err) {
console.error(err);
res.status(500).json({ error: 'Failed to delete block' });
}
});
module.exports = router;