-
Notifications
You must be signed in to change notification settings - Fork 4
Manual Input Saving Process
Milan Gruner edited this page Oct 15, 2024
·
4 revisions
- Save button is pressed in form, data is serialized and sent to
ActivityValue
POST or PUT route (to create or update respectively) -
ActivityValue
route checks validity of data according to validation (done with Zod) - Access control is performed with
InventoryService
(is user allowed to modify inventory => part of city or admin?) -
ActivityService
is called to create the activity -
ManualInputValidationService
is called to validate the data and rules (e.g. exclusive dropdown values) DataSource
is created (deprecated, will be removed soon)-
InventoryValue
is either queried or created by usingGPCService
to look up the correct sector/ sub-sector/ sub-category [sic!, to be renamed in future release] IDs for the given GPC reference number -
ActivityValue
entry is created - Total gas amounts and total CO2eq are calculated in
CalculationService
-
CalculationService
selects the right formula function from formulas.ts to execute depending on the methodology selected by the user - Totals for each gas are calculated and total CO2eq is determined using their GWPs (global warming potentials) from the
GasToCO2Eq
database table -
InventoryValue
andActivityValue
are updated with the new totals - Up to 3
GasValue
entries are created with the total amounts for each gas and the respective emission factor references