u
This commit is contained in:
@@ -270,4 +270,4 @@ router.delete('/buchungsschluessel/:id', authenticateToken, async (req, res) =>
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
module.exports = router;
|
||||
|
||||
@@ -143,8 +143,8 @@ router.get('/assignable-kreditors', authenticateToken, async (req, res) => {
|
||||
|
||||
const query = `
|
||||
SELECT id, name, kreditorId
|
||||
FROM fibdash.Kreditor
|
||||
WHERE is_banking = 0
|
||||
FROM fibdash.Kreditor
|
||||
WHERE (is_banking = 0 OR is_banking IS NULL)
|
||||
ORDER BY name
|
||||
`;
|
||||
|
||||
|
||||
@@ -58,8 +58,9 @@ router.post('/kreditors', authenticateToken, async (req, res) => {
|
||||
return res.status(400).json({ error: 'Name and kreditorId are required' });
|
||||
}
|
||||
|
||||
if (!isBanking && (!iban || iban.trim() === '')) {
|
||||
return res.status(400).json({ error: 'IBAN is required (except for banking accounts)' });
|
||||
// Business rule: IBAN is required for banking kreditors (proxies), not required for real kreditors
|
||||
if (isBanking && (!iban || iban.trim() === '')) {
|
||||
return res.status(400).json({ error: 'IBAN is required for banking kreditors' });
|
||||
}
|
||||
|
||||
if (iban && iban.trim() !== '') {
|
||||
@@ -108,8 +109,9 @@ router.put('/kreditors/:id', authenticateToken, async (req, res) => {
|
||||
return res.status(400).json({ error: 'Name and kreditorId are required' });
|
||||
}
|
||||
|
||||
if (!isBanking && (!iban || iban.trim() === '')) {
|
||||
return res.status(400).json({ error: 'IBAN is required (except for banking accounts)' });
|
||||
// Business rule: IBAN is required for banking kreditors (proxies), not required for real kreditors
|
||||
if (isBanking && (!iban || iban.trim() === '')) {
|
||||
return res.status(400).json({ error: 'IBAN is required for banking kreditors' });
|
||||
}
|
||||
|
||||
const checkQuery = `SELECT id FROM fibdash.Kreditor WHERE id = @id`;
|
||||
|
||||
Reference in New Issue
Block a user