The backend needs some rethinking for sustainability. In general, we've needed to refactor for a while, but priority on this is bumping up since we have the time (while other nonoverlapping projects are being prioritized). Also, this started to become relevant as we tried to fix auth middleware for https://github.com/Quran-Journey/backend/issues/166
Before this is done we should migrate to typescript somehow.
The models folder would only contain class-based models for every model in Postgres rather than database interactions which would only be kept in the services folder. In our case, this is mostly just renaming the models folder to services and then creating the models themselves. Surprisingly, the chatgpt link I shared above does a good job of explaining things.
The purpose of the model folder would be to only include business logic like sorting, filtering, etc. Services would be database access heavy.
Also, other cleanup tasks to consider:
[x] Separate scripts and json data from model files
The backend needs some rethinking for sustainability. In general, we've needed to refactor for a while, but priority on this is bumping up since we have the time (while other nonoverlapping projects are being prioritized). Also, this started to become relevant as we tried to fix auth middleware for https://github.com/Quran-Journey/backend/issues/166
Before this is done we should migrate to typescript somehow.
A summary of what the future structure might look like can be found here: https://chat.openai.com/share/b4ab526c-0037-4fcc-b96e-7919e3e6e579
The models folder would only contain class-based models for every model in Postgres rather than database interactions which would only be kept in the services folder. In our case, this is mostly just renaming the models folder to services and then creating the models themselves. Surprisingly, the chatgpt link I shared above does a good job of explaining things.
The purpose of the model folder would be to only include business logic like sorting, filtering, etc. Services would be database access heavy.
Also, other cleanup tasks to consider: