fix: enrich-batch Endpoint in words-Router verschieben (war nach 404-Handler in index.js)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const router = require('express').Router();
|
||||
const { query } = require('../db');
|
||||
const { runEnrichTick, enrichWordsSync } = require('../lib/enrichWords');
|
||||
|
||||
const STATUSES = ['requested', 'translated', 'generated', 'blocked', 'published'];
|
||||
|
||||
@@ -9,6 +10,18 @@ const STATUS_TIMESTAMP = {
|
||||
blocked: 'blocked_at',
|
||||
};
|
||||
|
||||
// POST /api/words/enrich-batch — manueller Trigger für Wort-Anreicherung
|
||||
router.post('/enrich-batch', async (req, res, next) => {
|
||||
try {
|
||||
const sync = req.query.sync === 'true';
|
||||
if (sync) {
|
||||
const max = parseInt(req.query.max) || 500;
|
||||
return res.json(await enrichWordsSync({ max }));
|
||||
}
|
||||
res.json(await runEnrichTick());
|
||||
} catch (err) { next(err); }
|
||||
});
|
||||
|
||||
// GET /api/words
|
||||
router.get('/', async (req, res, next) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user