rocket2 icon indicating copy to clipboard operation
rocket2 copied to clipboard

Refactor business logic to accommodate HTTP API

Open rwblickhan opened this issue 7 years ago • 2 comments

Please give a one-sentence summary of the cleanup you would like done.

We should refactor the business logic of our commands so they are independent of Slack messaging.

Please give as many details as possible about the cleanup or refactoring.

Our business logic (as expressed in modules like UserCommand etc) is tied pretty intimately to Slack messaging. Thus, if we introduce an HTTP API, we will need to duplicate a fair amount of functionality. We should refactor so that the business logic is independent of Slack messaging. Then the HTTP API can access the business logic directly while UserCommand and so on can access the business logic and format it appropriately for messaging to Slack.

The work might look something like this:

  • [ ] Create factory methods for the database facade and all our interfaces in factory/__init__.py
  • [ ] Create a new module called api (or something similar), use the factory methods to instantiate all the interfaces, and port over all the command helper methods as their own functions here
  • [ ] Import these new functions from api in the command parsers to replace the usage of their current helper methods
  • [ ] Delete the old helper methods

Something similar might have to be done for the webhook handlers, so leave room in the design of the new api module for this.

Please list any additional context; in particular, list what areas of the code base this would affect.

app/controller/commands/ factory/

rwblickhan avatar Feb 13 '19 21:02 rwblickhan

IMG_3990

Here's our notes on implementing it.

rwblickhan avatar Mar 23 '19 22:03 rwblickhan

To Do:

  • [ ] UserCommands #419
  • [ ] TeamCommands #419
  • [ ] ProjectCommands
  • [ ] KarmaCommands

chuck-sys avatar Jan 25 '20 22:01 chuck-sys