Refactor / cleanup backend code
Our code needs some refactoring / some functions need to be rewritten / simplified.
Rewriting function expressions as declarations
Mainly found in utils/files.ts in the lib
We have some function expressions still (mainly in the lib) that we should replace with function declarations to be consistent with the rest of our code base.
Place utility code at the bottom
-
Utility code called in main functions should be placed at the bottom. Example, the generation.ts code is not in the proper order, we should have the main code on top.
Simplify some code
-
Get rid of database.json - this is a memento from db-migrate and we can integrate this in config.yml (#746 (closed)) -
Rework apppath detection (#747 (closed)) -
Use proxy instead of monkeypatching query code (#742 (closed)) -
Some files are too big. We should avoid having more than 300 lines of code per file if possible. We can perhaps split things -
kara.ts code is both for kara management and kara queries -
user.ts might be difficult to split (maybe split between online user systems and offline ones -
player.ts is big but would be hard to split. the infamous PlayerEnding function is the main culprit there -
download.ts has many features: download queue management both in DB and in better-queue, update/sync mechanisms, download blacklist code, etc. -
[ ] playlist.ts is the Shami of our code.won't be splitted
-
-
Passport? I prefer an identity card. (Passport is useless with our setup?)
Rework some functions
-
[ ] Try to rework addKaraToPlaylist with less junk and more small functions insideUseless since no code in there is applicable elsewhere. -
Look for other big-ass functions which could be split into smaller chunks.
Edited by Leon