Normalize to double quotes across all files with Prettier
This commit is contained in:
1 parent
73bff72cec
commit
a5659cf4c8
190 files changed
+9523
-8859
No files matched your search
@@ -2,9 +2,7 @@ const Episode = require("../models/Episode");
|
||||
const EpisodeSeen = require("../models/EpisodeSeen");
|
||||
const Season = require("../models/Season");
|
||||
|
||||
|
||||
class SeasonController {
|
||||
|
||||
constructor() {
|
||||
if (!SeasonController.instance) {
|
||||
SeasonController.instance = this;
|
||||
@@ -33,16 +31,18 @@ class SeasonController {
|
||||
async getSeaonById(req, res) {
|
||||
try {
|
||||
const season = await Season.findByPk(req.params.id, {
|
||||
include: [{
|
||||
model: Episode,
|
||||
as: 'episodes'
|
||||
}]
|
||||
include: [
|
||||
{
|
||||
model: Episode,
|
||||
as: "episodes",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
if (season) {
|
||||
res.send(season);
|
||||
} else {
|
||||
res.status(404).send('Season not found');
|
||||
res.status(404).send("Season not found");
|
||||
}
|
||||
} catch (error) {
|
||||
res.status(500).send(error.message);
|
||||
@@ -53,19 +53,19 @@ class SeasonController {
|
||||
try {
|
||||
const episodes = await Episode.findAll({
|
||||
where: {
|
||||
season_id: req.params.id
|
||||
season_id: req.params.id,
|
||||
},
|
||||
include: [{ model: EpisodeSeen }],
|
||||
order: [
|
||||
['episode_number', 'ASC'],
|
||||
[EpisodeSeen, 'date_seen', 'ASC'],
|
||||
["episode_number", "ASC"],
|
||||
[EpisodeSeen, "date_seen", "ASC"],
|
||||
],
|
||||
});
|
||||
|
||||
if (episodes) {
|
||||
res.send(episodes);
|
||||
} else {
|
||||
res.status(404).send('Episodes not found');
|
||||
res.status(404).send("Episodes not found");
|
||||
}
|
||||
} catch (error) {
|
||||
res.status(500).send(error.message);
|
||||
@@ -75,13 +75,13 @@ class SeasonController {
|
||||
async updateSeason(req, res) {
|
||||
try {
|
||||
const [updated] = await Season.update(req.body, {
|
||||
where: { id: req.params.id }
|
||||
where: { id: req.params.id },
|
||||
});
|
||||
if (updated) {
|
||||
const updatedSeason = await Season.findByPk(req.params.id);
|
||||
res.send(updatedSeason);
|
||||
} else {
|
||||
res.status(404).send('Season not found');
|
||||
res.status(404).send("Season not found");
|
||||
}
|
||||
} catch (error) {
|
||||
res.status(500).send(error.message);
|
||||
@@ -91,18 +91,17 @@ class SeasonController {
|
||||
async deleteSeason(req, res) {
|
||||
try {
|
||||
const deleted = await Season.destroy({
|
||||
where: { id: req.params.id }
|
||||
where: { id: req.params.id },
|
||||
});
|
||||
if (deleted) {
|
||||
res.status(204).send('Season deleted');
|
||||
res.status(204).send("Season deleted");
|
||||
} else {
|
||||
res.status(404).send('Season not found');
|
||||
res.status(404).send("Season not found");
|
||||
}
|
||||
} catch (error) {
|
||||
res.status(500).send(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = new SeasonController();
|
||||
Reference in new issue
Block a user