mirror of
https://gitlab.com/foxixus/neomovies-api.git
synced 2025-10-28 18:08:51 +05:00
fix favourites issue
This commit is contained in:
@@ -92,6 +92,17 @@ router.get('/check/:mediaId', async (req, res) => {
|
|||||||
* schema:
|
* schema:
|
||||||
* type: string
|
* type: string
|
||||||
* enum: [movie, tv]
|
* enum: [movie, tv]
|
||||||
|
* requestBody:
|
||||||
|
* required: true
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* title:
|
||||||
|
* type: string
|
||||||
|
* posterPath:
|
||||||
|
* type: string
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: OK
|
* description: OK
|
||||||
@@ -100,6 +111,7 @@ router.post('/:mediaId', async (req, res) => {
|
|||||||
try {
|
try {
|
||||||
const { mediaId } = req.params;
|
const { mediaId } = req.params;
|
||||||
const { mediaType } = req.query;
|
const { mediaType } = req.query;
|
||||||
|
const { title, posterPath } = req.body;
|
||||||
if (!mediaType) return res.status(400).json({ error: 'mediaType required' });
|
if (!mediaType) return res.status(400).json({ error: 'mediaType required' });
|
||||||
|
|
||||||
const db = await getDb();
|
const db = await getDb();
|
||||||
@@ -107,6 +119,8 @@ router.post('/:mediaId', async (req, res) => {
|
|||||||
userId: req.user.email || req.user.id,
|
userId: req.user.email || req.user.id,
|
||||||
mediaId,
|
mediaId,
|
||||||
mediaType,
|
mediaType,
|
||||||
|
title: title || '',
|
||||||
|
posterPath: posterPath || '',
|
||||||
createdAt: new Date()
|
createdAt: new Date()
|
||||||
});
|
});
|
||||||
res.json({ success: true });
|
res.json({ success: true });
|
||||||
|
|||||||
Reference in New Issue
Block a user