Skip to content

Instantly share code, notes, and snippets.

@rezuankassim
Created May 26, 2021 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rezuankassim/d5524fe718620285748587a1e27521f6 to your computer and use it in GitHub Desktop.
Save rezuankassim/d5524fe718620285748587a1e27521f6 to your computer and use it in GitHub Desktop.
G2G
In ERD shown that the table is for storing currencies when then currencies is not available in the database
To minimize the call for the currencies, I have just call `USD_MYR` and `USD_EURO` because and I can get the inverse of
the currency rate by ` 1 / currency_rate `. Therefore I would get the inverse by just using one free API from the
currency API.
When I have check the database do not have the currency that I need, I will call the API and store the rates with the inverse
of the rates into the database. Whenever user click calculate, I will check whether the database got the rates, if not will
call the API.
I would make a cronjob to clear the rate everyday to make sure that the rates is always updated everyday.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment