fixthestatusquo / proca-server

Proca server, SDKs and services
https://proca.app
5 stars 3 forks source link

Check if config field is used anywhere in the code #249

Open destag opened 5 months ago

destag commented 5 months ago

We use :config field in Org, ActionPage and Campaign schemas. It is data used by widgets, stored in jsonb format. It appears to be unused by the application but can cause some issues like #229

If possible we should change type of these fields from :map to :string

@tttp Please comment if anything is incorrect or require more details

tttp commented 5 months ago

Just to clarify: it is unused by the server, but it is used by the front end widget builder:

https://github.com/fixthestatusquo/proca

for instance to define if the phone number field is displayed or not, but many many options

however, the general architecture is that the server should work, no matter if the widget collects a phone number or not, and shouldn't care about what's in the config, just store the phone number if it's sent to the api when submitting an action

In general, any setting that has an impact on the server (eg. if the action needs to be confirmed before being processed further or if there is a thank you email to send) is stored in separate attributes (column, status, new record...) instead of being put into a config json blob

we store the data into jsonb but we should only use it for statistics or search (eg find all the widgets that have a donation state) but shouldn't be used to change the behaviour of the server

Does it make sense?

if any value stored in the config is used in the elixir server, I'd consider it as a bug and it should be moved to a specific storage, not into the json

X+