my resources that I model should mimic the structure of the database? For example, there’s a property called “balance” for my users resource. However this property isn’t stored in the DB, but is generated every time from a combination of database data and data from other services. So is it totally fine to include this kind of a property that will come from a bunch of different places and will have a lot of calculation behind it?
If this is true, should I think of my dB models and rest resources completely separately? Should I just think of my database as one of the ways to get data for my rest model, but not limited to it?
Database = data you wish to persist
If you have data from multiple places, gather them from your backend with a cron job and save it to the database after processing.
Обсуждают сегодня