wger
wger copied to clipboard
Move (and use) as much logic to the backend
Currently some calculations are done on the clients (react app, flutter app), others are done on the backend (and even here there is probably also some differences or not all apps use these endpoints). While this means more requests, there will be only one place to test. Part of this issue is identify possible places that could be moved to the api
Some examples:
/api/v2/workout/abc/log_data/?id=xyz/api/v2/set/aaa/computed_settings/
here's a counterargument..
some duplicate logic may not be so bad, as it allows to iterate faster on changes. e.g. somebody working on the flutter app can do their changes, without getting stuck on python/backend stuff.
if the current code is duplicated, but already there and working, then perhaps no need to spend time refactoring it.
Towards the longer term future, i would actually suggest to explore that native apps do more locally, and reduce dependencies on a backend. IMHO the ideal design here is local-first apps, as much as possible async, and conflict free syncing. Not something to build right now, but something to consider and we can slowly build towards that. (e.g. by offloading the REST api)
of course you have a clearer perspective on the current state of the code.