Projektarten: Zuordnen gibt Warnungen von assignProject weiter
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
36c7822783
commit
3e6f35f836
2 files changed
+51
-2
No files matched your search
@@ -50,6 +50,7 @@ export async function completeAssignment(
|
||||
const customer = !!forCustomer
|
||||
let createdTicketId = null
|
||||
let finalTicketId = null
|
||||
const warnings = []
|
||||
|
||||
if (customer) {
|
||||
if (!(await loadOrNull(config.collections.customers, customerId))) throw fail(400, 'Kunde nicht gefunden.')
|
||||
@@ -80,7 +81,9 @@ export async function completeAssignment(
|
||||
}
|
||||
|
||||
try {
|
||||
await assign(projectId, { customerId, ticketId: finalTicketId }, { now })
|
||||
const assigned = await assign(projectId, { customerId, ticketId: finalTicketId }, { now })
|
||||
// assignProject schluckt Umzug-/Nachtrage-Fehler und meldet sie als Warnungen.
|
||||
if (assigned?.warnings?.length) warnings.push(...assigned.warnings)
|
||||
} catch (err) {
|
||||
if (createdTicketId) await deleteTicket(createdTicketId).catch(() => {})
|
||||
throw err
|
||||
@@ -100,9 +103,10 @@ export async function completeAssignment(
|
||||
await updateProject(projectId, { subdomain: preview.subdomain, projectType: 'preview' })
|
||||
} catch (err) {
|
||||
// Art und Zuordnung sind gespeichert - die Preview laesst sich nachtraeglich einschalten.
|
||||
result.warnings = [`Die Preview konnte nicht eingeschaltet werden (${err.message}).`]
|
||||
warnings.push(`Die Preview konnte nicht eingeschaltet werden (${err.message}).`)
|
||||
}
|
||||
}
|
||||
if (warnings.length) result.warnings = warnings
|
||||
return result
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user