shriyaMadan / Youtube-Dashboard

Helps in seeing your channel's stats
MIT License
12 stars 25 forks source link

Merge various controller's channel search #94

Closed Zircoz closed 2 years ago

Zircoz commented 3 years ago

✨ Proposal

Right now, the controllers are written separately while each one is doing pretty much the same (or similar operation). We can merge this functionality into one pure function. Read what are pure functions here: https://www.freecodecamp.org/news/functional-programming-principles-in-javascript-1b8fc6c3563f/

Have you read the Contributing Guidelines on Pull Requests?

Yeah yeah

Zircoz commented 3 years ago

@shriyaMadan may I get assigned to this ?

shriyaMadan commented 3 years ago

Yes, you may start working on this, it will avoid redundancy.

shriyaMadan commented 3 years ago

@Zircoz updates, please?

Zircoz commented 3 years ago

Sorry for the delay, didn't get time to do it. Hence, I am unassigning myself.

shriyaMadan commented 3 years ago

You could have told beforehand @Zircoz

Zircoz commented 3 years ago

You could have told beforehand @Zircoz

Will do from next time

Dhriti-Roy commented 3 years ago

I want to work on this

Dhriti-Roy commented 3 years ago

Cn you please explain what excatly you want ?

Zircoz commented 3 years ago
  1. There are many redundant operations in controller, for example: https://github.com/shriyaMadan/Youtube-Dashboard/blob/f4b694a4a54b769201acf4ba3b385d83ba2e3163/controllers/controls.js#L97 to https://github.com/shriyaMadan/Youtube-Dashboard/blob/f4b694a4a54b769201acf4ba3b385d83ba2e3163/controllers/controls.js#L108 can be replaced with with

    url ="https://www.googleapis.com/youtube/v3/channels?part=statistics,snippet&" + typeOfParam+ param + "&key=" + key

    this issue's solver is supposed to identify them and replace them with better code

  2. https://github.com/shriyaMadan/Youtube-Dashboard/blob/f4b694a4a54b769201acf4ba3b385d83ba2e3163/controllers/controls.js#L72 is checking if a url is entered or channel name, the type of url entered and is forming api request according to the link posted, make this identification of channel's link type a separate function to make re using the logic easier.

@Dhriti-Roy