grassrootsgrocery / admin-portal

GNU Affero General Public License v3.0
11 stars 6 forks source link

DRY up messaging.ts for better readability #74

Closed jasoncavanaugh closed 1 year ago

jasoncavanaugh commented 1 year ago

In messaging.ts, there is a lot of duplicate boilerplate code. Normally, I tend to think overly strict adherence to DRY results in bad abstractions and code that is harder to understand for those who didn't write it. However, messaging.ts has very similar endpoints for all of the messaging functionality in the app. With four different Make automations for text messaging, each with a GET and POST endpoint, we have 8 functions in messaging.ts that all look quite similar to each other. I think trying to abstract some of the common functionality between the eight endpoints might result in a file that is easier to read. I would be curious to hear other's thoughts on the matter @mattsahn @zuechai.

zuechai commented 1 year ago

Yeah, I'm all for abstracting it into a utility file.

Just FYI, it's going to be a month or so before I'll have time to make any meaningful contributions again.