Skip to content

feat(#2849): replace hardcoded view strings with constants#10615

Open
witash wants to merge 42 commits intomasterfrom
2849-view-reorganization-1
Open

feat(#2849): replace hardcoded view strings with constants#10615
witash wants to merge 42 commits intomasterfrom
2849-view-reorganization-1

Conversation

@witash
Copy link
Copy Markdown
Contributor

@witash witash commented Feb 4, 2026

subset of #2849
Replace hardcoded view strings wtih constants to allow changing which views are in which ddocs more easily in future.

@witash witash force-pushed the 2849-view-reorganization-1 branch from 561391f to ca39be0 Compare February 11, 2026 07:44
@witash witash closed this Feb 20, 2026
@witash witash reopened this Feb 20, 2026
@witash witash marked this pull request as ready for review February 20, 2026 12:34
@witash
Copy link
Copy Markdown
Contributor Author

witash commented Mar 26, 2026

@jkuester this is ready for review.

Mostly the changes are just find and replace the view paths with constants, mostly VIEWS.VIEW_NAME, which has the ddocs and view name combine e.g medic/contacts_by_depth.
In some cases the view name or design doc name is needed by itself, so there are helper function for that.

In some cases design ddocs are referred to by name; these are still replaced with constants e.g. DDOC_IDS.MEDIC_CLIENT; I have left these even though to actually change these references it would not be enough to just change the constant values, you would need to figure out what the relevant code is actually doing and replace it with its new equivalent. Most of these are in tests where it is checking the ddoc that should be replicated to offline clients.

although the diff is very large, the only files which changed beyond find/replace are:

@witash witash changed the title feat(#2849): split ddocs feat(#2849): replace hardcoded view strings wtih constants Mar 26, 2026
@witash witash requested a review from jkuester March 26, 2026 06:00
@witash witash changed the title feat(#2849): replace hardcoded view strings wtih constants feat(#2849): replace hardcoded view strings with constants Mar 26, 2026
@witash witash changed the title feat(#2849): replace hardcoded view strings with constants feat(#2849): Replace hardcoded view strings with constants Mar 26, 2026
@witash witash changed the title feat(#2849): Replace hardcoded view strings with constants feat(#2849): replace hardcoded view strings with constants Mar 26, 2026
@jkuester
Copy link
Copy Markdown
Contributor

FYI, unfortunately I could not get to this PR this week. But, it is still on my TODO list, and I will review it next week! 👍

Copy link
Copy Markdown
Contributor

@jkuester jkuester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent uplift @witash! I particularly appreciate your care for keeping the diff clean and only containing the necessary changes!

I have gone through everything line by line and have just a few suggestions/questions. Otherwise, LGTM!

Comment thread shared-libs/constants/src/index.js Outdated
Comment on lines +121 to +125
'medic-user': {
'medic-user': [
'read',
],
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be here? I am not seeing the existing ddoc that this maps to... 🤔

Comment thread shared-libs/cht-datasource/src/medic-constants.d.ts Outdated
Comment thread shared-libs/cht-datasource/src/libs/constants.ts Outdated
Comment thread api/src/routing.js Outdated
Comment thread api/tests/mocha/services/authorization.spec.js
Comment thread api/tests/mocha/services/monitoring.spec.js Outdated
Comment thread api/tests/mocha/services/monitoring.spec.js Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants