Commit 7598e699 authored by Radim Rychlík's avatar Radim Rychlík
Browse files

feat(rest): endpoint order change

parent 3a9ca819
Loading
Loading
Loading
Loading
+39 −39
Original line number Diff line number Diff line
@@ -112,6 +112,41 @@ export const clubsRouter = Router();
 */
clubsRouter.get('/', clubsController.getClubs);

/**
 * @swagger
 * /api/v1/clubs/search:
 *   get:
 *     summary: Search for a club by ID or name
 *     tags: [Clubs]
 *     parameters:
 *       - in: query
 *         name: id
 *         schema:
 *           type: string
 *           description: The ID of the club to search
 *         required: false
 *       - in: query
 *         name: name
 *         schema:
 *           type: string
 *           description: The name of the club to search
 *         required: false
 *     responses:
 *       200:
 *         description: The club was successfully found
 *         content:
 *           application/json:
 *             schema:
 *               $ref: '#/components/schemas/Club'
 *       400:
 *         description: Bad request, the provided data did not match the required schema
 *       404:
 *         description: Bad request, the provided ID or name did not match any existing club
 *       500:
 *         description: Some server error
 */
clubsRouter.get('/search', clubsController.getClub);

/**
 * @swagger
 * /api/v1/clubs:
@@ -202,42 +237,7 @@ clubsRouter.put('/:id', clubsController.updateClub);

/**
 * @swagger
 * /api/v1/clubs/search:
 *   get:
 *     summary: Search for a club by ID or name
 *     tags: [Clubs]
 *     parameters:
 *       - in: query
 *         name: id
 *         schema:
 *           type: string
 *           description: The ID of the club to search
 *         required: false
 *       - in: query
 *         name: name
 *         schema:
 *           type: string
 *           description: The name of the club to search
 *         required: false
 *     responses:
 *       200:
 *         description: The club was successfully found
 *         content:
 *           application/json:
 *             schema:
 *               $ref: '#/components/schemas/Club'
 *       400:
 *         description: Bad request, the provided data did not match the required schema
 *       404:
 *         description: Bad request, the provided ID or name did not match any existing club
 *       500:
 *         description: Some server error
 */
clubsRouter.get('/search', clubsController.getClub);

/**
 * @swagger
 * /api/v1/clubs/add_playlists/{id}:
 * /api/v1/clubs/{id}/add_playlists:
 *   put:
 *     summary: Add playlists to a club
 *     tags: [Clubs]
@@ -268,11 +268,11 @@ clubsRouter.get('/search', clubsController.getClub);
 *       500:
 *         description: Some server error
 */
clubsRouter.put('/add_playlists/:id', clubsController.addPlaylists);
clubsRouter.put('/:id/add_playlists', clubsController.addPlaylists);

/**
 * @swagger
 * /api/v1/clubs/remove_playlists/{id}:
 * /api/v1/clubs/{id}/remove_playlists:
 *   put:
 *     summary: Remove playlists from a club
 *     tags: [Clubs]
@@ -303,4 +303,4 @@ clubsRouter.put('/add_playlists/:id', clubsController.addPlaylists);
 *       500:
 *         description: Some server error
 */
clubsRouter.put('/remove_playlists/:id', clubsController.removePlaylists);
clubsRouter.put('/:id/remove_playlists', clubsController.removePlaylists);
+27 −27
Original line number Diff line number Diff line
@@ -84,6 +84,33 @@ export const moviesRouter = Router();
 */
moviesRouter.get('/', moviesController.getMovies);

/**
 * @swagger
 * /api/v1/movies/{id}:
 *   get:
 *     summary: Retrieve a movie from OUR database
 *     tags: [Movies]
 *     parameters:
 *       - in: path
 *         name: id
 *         schema:
 *           type: string
 *           description: The ID of the movie to retrieve
 *           required: true
 *     responses:
 *       200:
 *         description: The movie was successfully retrieved
 *         content:
 *           application/json:
 *             schema:
 *               $ref: '#/components/schemas/Movie'
 *       404:
 *         description: The provided ID did not match any existing movie
 *       500:
 *         description: Some server error
 */
moviesRouter.get('/:id', moviesController.getMovie);

/**
 * @swagger
 * /api/v1/movies/trending:
@@ -138,30 +165,3 @@ moviesRouter.get('/trending', moviesController.getTrendingMovies);
 *         description: Some server error
 */
moviesRouter.get('/search', moviesController.searchMovies);

/**
 * @swagger
 * /api/v1/movies/{id}:
 *   get:
 *     summary: Retrieve a movie from OUR database
 *     tags: [Movies]
 *     parameters:
 *       - in: path
 *         name: id
 *         schema:
 *           type: string
 *           description: The ID of the movie to retrieve
 *           required: true
 *     responses:
 *       200:
 *         description: The movie was successfully retrieved
 *         content:
 *           application/json:
 *             schema:
 *               $ref: '#/components/schemas/Movie'
 *       404:
 *         description: The provided ID did not match any existing movie
 *       500:
 *         description: Some server error
 */
moviesRouter.get('/:id', moviesController.getMovie);
+51 −51
Original line number Diff line number Diff line
@@ -103,6 +103,53 @@ export const playlistsRouter = Router();
 */
playlistsRouter.get('/', playlistsController.getPlaylists);

/**
 * @swagger
 * /api/v1/playlists/search:
 *   get:
 *     summary: Search for a playlist by ID, name, userId or clubId
 *     tags: [Playlists]
 *     parameters:
 *       - in: query
 *         name: id
 *         schema:
 *           type: string
 *           description: The ID of the playlist to search
 *         required: false
 *       - in: query
 *         name: name
 *         schema:
 *           type: string
 *           description: The name of the playlist to search
 *         required: false
 *       - in: query
 *         name: userId
 *         schema:
 *           type: string
 *           description: The userId associated with the playlist to search
 *         required: false
 *       - in: query
 *         name: clubId
 *         schema:
 *           type: string
 *           description: The clubId associated with the playlist to search
 *         required: false
 *     responses:
 *       200:
 *         description: The playlist was successfully found
 *         content:
 *           application/json:
 *             schema:
 *               $ref: '#/components/schemas/Playlist'
 *       400:
 *         description: Bad request, the provided data did not match the required schema
 *       404:
 *         description: Bad request, the provided ID, name, userId or clubId did not match any existing playlist
 *       500:
 *         description: Some server error
 */
playlistsRouter.get('/search', playlistsController.getPlaylist);

/**
 * @swagger
 * /api/v1/playlists:
@@ -193,54 +240,7 @@ playlistsRouter.put('/:id', playlistsController.updatePlaylist);

/**
 * @swagger
 * /api/v1/playlists/search:
 *   get:
 *     summary: Search for a playlist by ID, name, userId or clubId
 *     tags: [Playlists]
 *     parameters:
 *       - in: query
 *         name: id
 *         schema:
 *           type: string
 *           description: The ID of the playlist to search
 *         required: false
 *       - in: query
 *         name: name
 *         schema:
 *           type: string
 *           description: The name of the playlist to search
 *         required: false
 *       - in: query
 *         name: userId
 *         schema:
 *           type: string
 *           description: The userId associated with the playlist to search
 *         required: false
 *       - in: query
 *         name: clubId
 *         schema:
 *           type: string
 *           description: The clubId associated with the playlist to search
 *         required: false
 *     responses:
 *       200:
 *         description: The playlist was successfully found
 *         content:
 *           application/json:
 *             schema:
 *               $ref: '#/components/schemas/Playlist'
 *       400:
 *         description: Bad request, the provided data did not match the required schema
 *       404:
 *         description: Bad request, the provided ID, name, userId or clubId did not match any existing playlist
 *       500:
 *         description: Some server error
 */
playlistsRouter.get('/search', playlistsController.getPlaylist);

/**
 * @swagger
 * /api/v1/playlists/add_movies/{id}:
 * /api/v1/playlists/{id}/add_movies:
 *   put:
 *     summary: Add movies to a playlist
 *     tags: [Playlists]
@@ -271,11 +271,11 @@ playlistsRouter.get('/search', playlistsController.getPlaylist);
 *       500:
 *         description: Some server error
 */
playlistsRouter.put('/add_movies/:id', playlistsController.addMovies);
playlistsRouter.put('/:id/add_movies', playlistsController.addMovies);

/**
 * @swagger
 * /api/v1/playlists/remove_movies/{id}:
 * /api/v1/playlists/{id}/remove_movies:
 *   put:
 *     summary: Remove movies from a playlist
 *     tags: [Playlists]
@@ -306,4 +306,4 @@ playlistsRouter.put('/add_movies/:id', playlistsController.addMovies);
 *       500:
 *         description: Some server error
 */
playlistsRouter.put('/remove_movies/:id', playlistsController.removeMovies);
playlistsRouter.put('/:id/remove_movies', playlistsController.removeMovies);
+26 −26
Original line number Diff line number Diff line
@@ -82,32 +82,6 @@ export const postsRouter = Router();
 */
postsRouter.get('/', postsController.getPosts);

/**
 * @swagger
 * /api/v1/posts:
 *   post:
 *     summary: Create a new post
 *     tags: [Posts]
 *     requestBody:
 *       required: true
 *       content:
 *         application/json:
 *           schema:
 *             $ref: '#/components/schemas/CreatePostRequest'
 *     responses:
 *       201:
 *         description: The post was successfully created
 *         content:
 *           application/json:
 *             schema:
 *               $ref: '#/components/schemas/Post'
 *       400:
 *         description: Bad request, the provided data did not match the required schema
 *       500:
 *         description: Some server error
 */
postsRouter.post('/', postsController.createPost);

/**
 * @swagger
 * /api/v1/posts/search:
@@ -160,3 +134,29 @@ postsRouter.post('/', postsController.createPost);
 *         description: Some server error
 */
postsRouter.get('/search', postsController.getPost);

/**
 * @swagger
 * /api/v1/posts:
 *   post:
 *     summary: Create a new post
 *     tags: [Posts]
 *     requestBody:
 *       required: true
 *       content:
 *         application/json:
 *           schema:
 *             $ref: '#/components/schemas/CreatePostRequest'
 *     responses:
 *       201:
 *         description: The post was successfully created
 *         content:
 *           application/json:
 *             schema:
 *               $ref: '#/components/schemas/Post'
 *       400:
 *         description: Bad request, the provided data did not match the required schema
 *       500:
 *         description: Some server error
 */
postsRouter.post('/', postsController.createPost);
+41 −41
Original line number Diff line number Diff line
@@ -104,6 +104,47 @@ export const reviewsRouter = Router();
 */
reviewsRouter.get('/', reviewsController.getReviews);

/**
 * @swagger
 * /api/v1/reviews/search:
 *   get:
 *     summary: Search for a review by ID, user ID, or movie ID
 *     tags: [Reviews]
 *     parameters:
 *       - in: query
 *         name: id
 *         schema:
 *           type: string
 *           description: The ID of the review to search
 *         required: false
 *       - in: query
 *         name: userId
 *         schema:
 *           type: string
 *           description: The user ID of the review to search
 *         required: false
 *       - in: query
 *         name: movieId
 *         schema:
 *           type: string
 *           description: The movie ID of the review to search
 *         required: false
 *     responses:
 *       200:
 *         description: The review was successfully found
 *         content:
 *           application/json:
 *             schema:
 *               $ref: '#/components/schemas/Review'
 *       400:
 *         description: Bad request, the provided data did not match the required schema
 *       404:
 *         description: Bad request, the provided ID, user ID, or movie ID did not match any existing review
 *       500:
 *         description: Some server error
 */
reviewsRouter.get('/search', reviewsController.getReview);

/**
 * @swagger
 * /api/v1/reviews:
@@ -191,44 +232,3 @@ reviewsRouter.delete('/:id', reviewsController.deleteReview);
 *         description: Some server error
 */
reviewsRouter.put('/:id', reviewsController.updateReview);

/**
 * @swagger
 * /api/v1/reviews/search:
 *   get:
 *     summary: Search for a review by ID, user ID, or movie ID
 *     tags: [Reviews]
 *     parameters:
 *       - in: query
 *         name: id
 *         schema:
 *           type: string
 *           description: The ID of the review to search
 *         required: false
 *       - in: query
 *         name: userId
 *         schema:
 *           type: string
 *           description: The user ID of the review to search
 *         required: false
 *       - in: query
 *         name: movieId
 *         schema:
 *           type: string
 *           description: The movie ID of the review to search
 *         required: false
 *     responses:
 *       200:
 *         description: The review was successfully found
 *         content:
 *           application/json:
 *             schema:
 *               $ref: '#/components/schemas/Review'
 *       400:
 *         description: Bad request, the provided data did not match the required schema
 *       404:
 *         description: Bad request, the provided ID, user ID, or movie ID did not match any existing review
 *       500:
 *         description: Some server error
 */
reviewsRouter.get('/search', reviewsController.getReview);
Loading