tattle-made / Uli

Software and Resources for Mitigating Online Gender Based Violence in India
https://uli.tattle.co.in
GNU General Public License v3.0
40 stars 29 forks source link

Fixes #559 : Refactor API endpoints into individual files #560

Closed hardik-pratap-singh closed 6 months ago

hardik-pratap-singh commented 6 months ago

name: Fix for Issue #559 about: Refactored APIs into MVC architecture labels: priority:medium, enhancement, backend


Describe the PR

Earlier, all the APIs were present in single file called index.js which was really difficult to maintain for the maintainers. Now this PR has divided those endpoints into files and these files contains similar types of endpoints. Also, this PR has separated the names of endpoints along with their implementations in separate folders called routes and controllers respectively.

Steps to test the PR

Modified File : browser-extension/api-server/index.js New Directory : browser-extension/api-server/routes New Directory : browser-extension/api-server/controllers

Expected behavior

browser-extension/api-server/routes image

browser-extension/api-server/controllers image

Now, browser-extension/api-server/index.js looks something like this : image

dennyabrain commented 6 months ago

@hardik-pratap-singh This looks great! Since its a big change and we don't have automated tests (something we need to fix) it will take us a while to review this. Give us time till next week to get back to you on this.

aatmanvaidya commented 6 months ago

I have reviewed this PR, things look good to me

Its read to merge

These are the following things I tested on Chrome, Brave and Firefox

  1. Slur Replacement
  2. Slur Crowdsource feature (CRUD)
  3. Right Click and add slur (CRUD)
  4. Preferences Tab
    • Manually add a word to the slur list and upon saving, slur replacement should work for that word
    • The enable/disable slur replacement checkbox
    • Adding email
    • changing language
  5. Reset Account
  6. Data in the Resources tab is also shown correctly!

@dennyabrain things look good to me, can you take a final look and merge the PR