MLH-Fellowship / FellowshipWrapup

A showcase of all your work done during the MLH Fellowship
MIT License
6 stars 0 forks source link

Remove code duplication on server.go #34

Closed gmelodie closed 4 years ago

gmelodie commented 4 years ago

There's a lot of duplicated code on server.go, we should remove that and make a function that receives a query and just does it. Also, if such a function is implemented, it would make sense to move it to the queries package.

IamCathal commented 4 years ago

Some of the logic such as the line below would either require a switch statement (3 times per function at the moment) or some clever trick that I don't know of. Manly because you can can't have a variable struct name really without a string variable for it and then using a switch statement to deduce the actual struct type in it's own case

https://github.com/MLH-Fellowship/FellowshipWrapup/blob/7d2f7c4daa41956c86b7c81b822c33d651c53cf2/backend/server/server.go#L91

IamCathal commented 4 years ago

Fixed in https://github.com/MLH-Fellowship/FellowshipWrapup/pull/38