Uploaded image for project: 'mod-finance-storage'
  1. mod-finance-storage
  2. MODFISTO-96

Add logic upon budget deletion

    XMLWordPrintable

Details

    • ACQ Sprint 85
    • 3
    • Thunderjet

    Description

      Overview

      At the moment, validation of transaction existence does not occur before budget deletion.
      According with new requirements : The user should only be able to delete a budget that has 0 transactions. It does not matter if it is for the current fiscal year, past year or upcoming year.
      Additionally, the link between the group_fund_fiscal_year and the budget tables must be removed before deleting, to be able to delete the budget.

      Approach:

      Upon budget deletion:

      • find all transactions : query = ((transaction.toFundId=budget.fundId or transaction.fromFundId=budget.fundId) and transaction.fiscalYearId=budget.fiscalYearID) and get number of returned transactions. If the number is greater than 0, then deleting the budget is prohibited.
      • find all groupFundFiscalYear by budget.fundId and budget.fiscalYearId and clear groupFundFiscalYear.budgetId field

      Notes

      Logic should be implemented in storage module to minimize data inconsistency in case below:
      Deleting a budget is not an atomic operation, since we must first check for transactions and only then delete the budget.
      There is a a slight chance, that between these two operations the transaction will be created by someone else and it will remain tied to a nonexistent budget.

      Acceptance criteria:

      The business logic described above has been added
      Unit tests are updated
      API tests are updated (mod-finance)

      TestRail: Results

        Attachments

          Issue Links

            Activity

              People

                Andrei_Makaranka Andrei Makaranka
                Andrei_Makaranka Andrei Makaranka
                Andrei Makaranka Andrei Makaranka
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases