Add specific episode-seen

This commit is contained in:
X4Lo committed 2024-05-19 17:03:38 +01:00
1 parent 728dae4e59
commit 29d6e3f503
13 files changed
+323 -22

No files matched your search

+6 -5
View File
@@ -4,7 +4,7 @@ const Episode = require('../models/Episode');
const seasonRouter = express.Router();
// ! /seasons
// POST /seasons - Create a new season
// * POST - Create a new season
seasonRouter.post('/', async (req, res) => {
try {
const season = await Season.create(req.body);
@@ -14,7 +14,7 @@ seasonRouter.post('/', async (req, res) => {
}
});
// GET /seasons - Retrieve all seasons
// * GET - Retrieve all seasons
seasonRouter.get('/', async (req, res) => {
try {
const seasons = await Season.findAll();
@@ -24,7 +24,7 @@ seasonRouter.get('/', async (req, res) => {
}
});
// GET /seasons/:id - Retrieve a specific season by id
// * GET - Retrieve a specific season by id
seasonRouter.get('/:id', async (req, res) => {
try {
const season = await Season.findByPk(req.params.id, {
@@ -44,6 +44,7 @@ seasonRouter.get('/:id', async (req, res) => {
}
});
// * GET - Retrieve episodes of a season
seasonRouter.get('/:id/episodes', async (req, res) => {
try {
const episodes = await Episode.findAll({
@@ -62,7 +63,7 @@ seasonRouter.get('/:id/episodes', async (req, res) => {
}
});
// PUT /seasons/:id - Update a season
// * PUT - Update a season
seasonRouter.put('/:id', async (req, res) => {
try {
const [updated] = await Season.update(req.body, {
@@ -79,7 +80,7 @@ seasonRouter.put('/:id', async (req, res) => {
}
});
// DELETE /seasons/:id - Delete a season
// * DELETE - Delete a season
seasonRouter.delete('/:id', async (req, res) => {
try {
const deleted = await Season.destroy({