medic / cht-core

The CHT Core Framework makes it faster to build responsive, offline-first digital health apps that equip health workers to provide better care in their communities. It is a central resource of the Community Health Toolkit.
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
468 stars 217 forks source link

Add a @medic/constants shared library #9621

Open dianabarsan opened 1 week ago

dianabarsan commented 1 week ago

Describe the issue We have a bunch of magic strings spread throughout the app. One of the prominent ones being mm-online: https://github.com/search?q=repo%3Amedic%2Fcht-core+mm-online&type=code This is not the only example.

Describe the improvement you'd like Collect all reused magic strings and add them to a shared library.

garethbowen commented 1 week ago

Examples I can think of...

dianabarsan commented 1 week ago

Thanks for adding to the list. I agree with all these suggestions. We also have X-Medic-Service header that we pass to haproxy in both api and sentinel. For doc ids, we can also make it return translation doc names like (code) => messages-${code}. Same applies to form names, other docs that have prefixes (org.couchdb.user:).

I think we're going to end up with a sizeable list.