AB-Kern: Admin-Routen zum Senden, Erinnern, für neue Fassungen, zum Stornieren und zum Zuordnen eines Projekts
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7d3114d7a3
commit
e680ea3266
2 files changed
+130
No files matched your search
@@ -94,4 +94,52 @@ router.get('/:id/pdf', async (req, res) => {
|
||||
}
|
||||
})
|
||||
|
||||
/** Antwort der Aktionen, die eine Mail auslösen: { auftrag, mailFehler }. */
|
||||
const mitMail = ({ auftrag, mailFehler }) => ({ auftrag: auftragFuerTeam(auftrag), mailFehler })
|
||||
|
||||
router.post('/:id/senden', async (req, res) => {
|
||||
try {
|
||||
await ladeMitSchalter(req.params.id)
|
||||
return res.json(mitMail(await sendeAuftrag(req.params.id, { von: vonAdmin(req) })))
|
||||
} catch (err) {
|
||||
return sendeFehler(res, 'Auftragsbestätigung senden', err)
|
||||
}
|
||||
})
|
||||
|
||||
router.post('/:id/erinnern', async (req, res) => {
|
||||
try {
|
||||
await ladeMitSchalter(req.params.id)
|
||||
return res.json(mitMail(await erinnereAuftrag(req.params.id)))
|
||||
} catch (err) {
|
||||
return sendeFehler(res, 'Auftragsbestätigung erinnern', err)
|
||||
}
|
||||
})
|
||||
|
||||
router.post('/:id/neue-fassung', async (req, res) => {
|
||||
try {
|
||||
await ladeMitSchalter(req.params.id)
|
||||
return res.json({ auftrag: auftragFuerTeam(await neueFassung(req.params.id, { von: vonAdmin(req) })) })
|
||||
} catch (err) {
|
||||
return sendeFehler(res, 'Neue Fassung anlegen', err)
|
||||
}
|
||||
})
|
||||
|
||||
router.post('/:id/stornieren', async (req, res) => {
|
||||
try {
|
||||
await ladeMitSchalter(req.params.id)
|
||||
return res.json({ auftrag: auftragFuerTeam(await storniereAuftrag(req.params.id)) })
|
||||
} catch (err) {
|
||||
return sendeFehler(res, 'Auftragsbestätigung stornieren', err)
|
||||
}
|
||||
})
|
||||
|
||||
router.post('/:id/projekt', async (req, res) => {
|
||||
try {
|
||||
await ladeMitSchalter(req.params.id)
|
||||
return res.json({ auftrag: auftragFuerTeam(await ordneProjektZu(req.params.id, req.body?.projektId)) })
|
||||
} catch (err) {
|
||||
return sendeFehler(res, 'Projekt zuordnen', err)
|
||||
}
|
||||
})
|
||||
|
||||
export default router
|
||||
Reference in new issue
Block a user