Finanzen: Einstellungen und Fixkostenliste
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6e43d54fe8
commit
34ff97e924
6 files changed
+923
-30
No files matched your search
@@ -1,10 +1,9 @@
|
||||
import { config } from '../../config.js'
|
||||
import { getDocument } from '../appwriteAdmin.js'
|
||||
import { withLocks } from '../keyedLock.js'
|
||||
import { getStripe } from '../stripeBilling.js'
|
||||
import { getTransaction, listTransactions, updateTransaction } from './bankStore.js'
|
||||
import { euroDe } from './format.js'
|
||||
import { suggestMatches } from './matching.js'
|
||||
import { getFixedCost } from './settings.js'
|
||||
import { invalidateFinanceCache, listInvoices, listPayouts } from './stripeFinance.js'
|
||||
|
||||
/**
|
||||
@@ -156,14 +155,8 @@ async function resolvePayout(tx, payoutId) {
|
||||
|
||||
async function resolveFixedCost(tx, fixedCostId) {
|
||||
if (!isOutgoing(tx)) throw new AssignError(400, 'Fixkosten lassen sich nur Ausgängen zuordnen.')
|
||||
const missing = new AssignError(400, 'Diese Fixkosten-Position gibt es nicht.')
|
||||
if (!DOCUMENT_ID.test(fixedCostId)) throw missing
|
||||
try {
|
||||
await getDocument(config.collections.financeFixedCosts, fixedCostId)
|
||||
} catch (err) {
|
||||
if (err?.status === 404 || err?.status === 400) throw missing
|
||||
throw err
|
||||
}
|
||||
// getFixedCost kennt keine unmoeglichen IDs und liefert null, wenn es die Position nicht gibt
|
||||
if (!(await getFixedCost(fixedCostId))) throw new AssignError(400, 'Diese Fixkosten-Position gibt es nicht.')
|
||||
return { category: 'fixkosten', fixedCostId }
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user