theopensystemslab / fairhold-dashboard

https://fairhold-dashboard.vercel.app
0 stars 0 forks source link

HouseHold calculated in the API #70

Closed gabrielegranello closed 1 month ago

gabrielegranello commented 2 months ago

What does this PR do?

It allows for the Farihold calculation to happen in the API. See #69

Before this PR

The API route.ts used to fetch the data and pass it to the frontend. Then, the Fairhold calculations used to happen in the frontend.

Now

The API route.ts also computes the Fairhold calculations, and it returns the results to the frontend.

Side issue/fix

I think that there was mismatch in how we were dealing with socialRentAdjustements. Specifically: 1) Data such as inflation are type of number in the database 2) socialRentAdjustmentsRepo.ts was converting the data into string || null 3) Later, this data was treated as numbers to perform the calculations

Within socialRentAdjustmentsRepo.ts I deleted the conversion to string and set up a clause guard to check for null.

Not sure if that's the best approach

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fairhold-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 26, 2024 9:28am