Schnittstellen für Import, Zuweisen, Nachtragen; Webhook wartet auf Umzug

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-09-30 10:21:34 +00:00
1 parent 5c39640224
commit a5da4849e5
4 files changed
+367 -49

No files matched your search

+37
View File
@@ -4,6 +4,7 @@ import {
updateWebsiteProject,
archiveRepo,
} from '../../services/giteaAdmin.js'
import { assignProject, reconcileProject } from '../../services/projectAssignment.js'
import { requireAppwriteStaff } from '../../middleware/appwriteStaff.js'
const router = Router()
@@ -67,4 +68,40 @@ router.post('/:id/unarchive', async (req, res) => {
}
})
// Projekt einem Kunden/Ticket zuweisen -> stoesst Umzug nach GITEA_ORG + Nachtragen an
router.post('/:id/assign', async (req, res) => {
const { customerId, ticketId } = req.body || {}
if (!customerId && !ticketId) {
return res.status(400).json({ error: 'customerId oder ticketId erforderlich' })
}
try {
const result = await assignProject(req.params.id, {
customerId: String(customerId || ''),
ticketId: String(ticketId || ''),
})
return res.json({ ok: true, ...result })
} catch (err) {
if (err.status === 404) {
return res.status(404).json({ error: 'Projekt nicht gefunden' })
}
const status = err.status || 500
return res.status(status).json({ error: err.message })
}
})
// Umzug + Pushes eines bereits zugewiesenen Projekts erneut nachtragen
router.post('/:id/pushes', async (req, res) => {
try {
const result = await reconcileProject(req.params.id)
return res.json({ ok: true, ...result })
} catch (err) {
if (err.status === 404) {
return res.status(404).json({ error: 'Projekt nicht gefunden' })
}
const status = err.status || 500
return res.status(status).json({ error: err.message })
}
})
export default router