Major Backend SI Update part 2: added controllers
This commit is contained in:
1 parent
a51e207707
commit
dbb00fdb61
38 files changed
+2129
-1231
No files matched your search
@@ -0,0 +1,26 @@
|
||||
const episodeService = require("../services/episodeService");
|
||||
|
||||
const _episodeService = episodeService;
|
||||
|
||||
class EpisodeController {
|
||||
|
||||
constructor() {
|
||||
if (!EpisodeController.instance) {
|
||||
EpisodeController.instance = this;
|
||||
}
|
||||
return EpisodeController.instance;
|
||||
}
|
||||
|
||||
async getEpisodesBetweenDates(req, res) {
|
||||
const { startDate, endDate } = req.params;
|
||||
try {
|
||||
const episodes = await _episodeService.getEpisodesBetweenDates(startDate, endDate)
|
||||
res.status(200).json(episodes);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = new EpisodeController();
|
||||
Reference in new issue
Block a user