feat: Enhance club payment claims and task automation
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 1m0s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 1m0s
- Added `paid_amount_cents` column to `club_payment_claims` for better tracking of payments. - Implemented compatibility checks for the new column in `clubPaymentClaimService` and `clubTaskAutomationService`. - Updated various views to handle read-only states when editing is not allowed. - Refactored forms in `ClubAccountsView`, `ClubInvoicesView`, `ClubTasksView`, and `ClubCommunicationView` to use factory functions for cleaner code. - Introduced a new migration script to add the `paid_amount_cents` column if it doesn't exist and initialize it for existing paid claims. - Created a detailed plan for enhancing club features and ensuring stability in existing modules.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
-- club_payment_claims: Feld wie backend/models/ClubPaymentClaim.js (paidAmountCents)
|
||||
-- Fehlt in der DB -> SequelizeDatabaseError ER_BAD_FIELD_ERROR in Club-Dashboard,
|
||||
-- Aufgaben-Automation, Konten und Zahlungsforderungen.
|
||||
--
|
||||
-- Diese Migration ist idempotent:
|
||||
-- - fuegt `paid_amount_cents` nur hinzu, wenn die Spalte noch fehlt
|
||||
-- - initialisiert bestehende Datensaetze mit Status `paid` auf `amount_cents`
|
||||
-- Hinweis:
|
||||
-- Bereits teilweise bezahlte Altfaelle koennen ohne historische Buchungsdaten
|
||||
-- nicht exakt rekonstruiert werden und bleiben daher initial bei 0.
|
||||
|
||||
SET @column_exists := (
|
||||
SELECT COUNT(*)
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'club_payment_claims'
|
||||
AND COLUMN_NAME = 'paid_amount_cents'
|
||||
);
|
||||
|
||||
SET @add_column_sql := IF(
|
||||
@column_exists = 0,
|
||||
'ALTER TABLE `club_payment_claims`
|
||||
ADD COLUMN `paid_amount_cents` BIGINT NOT NULL DEFAULT 0
|
||||
COMMENT ''Bereits bezahlter Anteil in Cent''
|
||||
AFTER `amount_cents`',
|
||||
'SELECT ''Column paid_amount_cents already exists'' AS message'
|
||||
);
|
||||
|
||||
PREPARE add_column_stmt FROM @add_column_sql;
|
||||
EXECUTE add_column_stmt;
|
||||
DEALLOCATE PREPARE add_column_stmt;
|
||||
|
||||
UPDATE `club_payment_claims`
|
||||
SET `paid_amount_cents` = `amount_cents`
|
||||
WHERE `status` = 'paid'
|
||||
AND COALESCE(`paid_amount_cents`, 0) = 0;
|
||||
Reference in New Issue
Block a user