rcos / observatory-server

A project tracking dashboard for Rensselaer Center for Open Source
https://rcos.io
MIT License
14 stars 51 forks source link

Abstract repeated code in SmallGroup and ClassYear controllers #723

Closed aeksco closed 6 years ago

aeksco commented 6 years ago

In both smallgroup.controller.js and classyear.controller.js the following four functions are identical:

We should abstract these four functions into a separate file and import them as needed.

Let's abstract them into a file called observatory-server/server/api/lib/helpers.js - use the following code as an example of how to import the functions into both controller files:

import { handleError, validationError, generateCode, uniqueDayCode } from '../lib/helpers'
aeksco commented 6 years ago

Resolved