Browse Source

Fix See Later artefacts

pull/11/head
astria 3 months ago
parent
commit
298d49aecb
  1. 9
      backend/app/controllers/playlist.controller.js
  2. 23
      backend/logs/access.log

9
backend/app/controllers/playlist.controller.js

@ -238,6 +238,7 @@ export async function getSeeLater(req, res) {
const client = await getClient();
const query = `
SELECT
COALESCE(
JSON_AGG(
json_build_object(
'video_id', videos.id,
@ -258,6 +259,8 @@ export async function getSeeLater(req, res) {
'description', channels.description
)
)
) FILTER (WHERE videos.id IS NOT NULL),
'[]'::json
) AS videos
FROM
public.playlists
@ -285,14 +288,14 @@ export async function getSeeLater(req, res) {
try {
const result = await client.query(query, [userId]);
if (result.rows.length === 0) {
logger.write("No 'See Later' playlist found for user with id " + userId, 404);
logger.write("No 'See Later' playlist found for user with id " + userId, 200);
client.release();
res.status(404).json({ error: "'See Later' playlist not found" });
res.status(200).json([]);
return;
}
logger.write("'See Later' playlist retrieved for user with id " + userId, 200);
client.release();
res.status(200).json(result.rows[0].videos);
res.status(200).json(result.rows[0].videos || []);
} catch (error) {
logger.write("Error retrieving 'See Later' playlist: " + error.message, 500);
client.release();

23
backend/logs/access.log

@ -11461,3 +11461,26 @@
[2025-08-31 10:29:58.869] [undefined] GET(/:id/stats): try to get stats
[2025-08-31 10:29:58.875] [undefined] GET(/:id): Successfully get channel with id 1 with status 200
[2025-08-31 10:29:58.885] [undefined] GET(/:id/stats): Successfully get stats with status 200
[2025-08-31 10:30:58.389] [undefined] GET(/see-later): 'See Later' playlist retrieved for user with id 1 with status 200
[2025-09-03 17:34:12.979] [undefined] GET(/see-later): 'See Later' playlist retrieved for user with id 1 with status 200
[2025-09-03 17:34:15.647] [undefined] GET(/:id): failed due to invalid values with status 400
[2025-09-03 17:34:15.660] [undefined] GET(/:id/similar): failed due to invalid values with status 400
[2025-09-03 17:34:15.671] [undefined] GET(/user/:id): Playlists retrieved for user with id 1 with status 200
[2025-09-03 17:34:15.736] [undefined] GET(/:id/views): failed due to invalid values with status 400
[2025-09-03 17:34:24.176] [undefined] GET(/see-later): 'See Later' playlist retrieved for user with id 1 with status 200
[2025-09-03 17:34:26.470] [undefined] GET(/:id): failed due to invalid values with status 400
[2025-09-03 17:34:26.478] [undefined] GET(/user/:id): Playlists retrieved for user with id 1 with status 200
[2025-09-03 17:34:26.485] [undefined] GET(/:id/similar): failed due to invalid values with status 400
[2025-09-03 17:34:26.494] [undefined] GET(/:id/views): failed due to invalid values with status 400
[2025-09-03 17:34:26.941] [undefined] GET(/see-later): 'See Later' playlist retrieved for user with id 1 with status 200
[2025-09-03 17:34:29.468] [undefined] GET(/:id/history): try to retrieve history of user 1
[2025-09-03 17:34:29.523] [undefined] GET(/:id/history): successfully retrieved history of user 1 with status 200
[2025-09-03 17:34:29.535] [undefined] GET(/:id/channel): try to retrieve channel of user 1
[2025-09-03 17:34:29.541] [undefined] GET(/:id/channel): successfully retrieved channel of user 1 with status 200
[2025-09-03 17:34:29.550] [undefined] GET(/user/:id): Playlists retrieved for user with id 1 with status 200
[2025-09-03 17:34:30.404] [undefined] GET(/:id): Playlist retrieved with id 1 with status 200
[2025-09-03 17:34:31.607] [undefined] DELETE(/:id/video/:videoId): Video deleted from playlist with id 1 with status 200
[2025-09-03 17:34:31.690] [undefined] GET(/:id): Playlist retrieved with id 1 with status 200
[2025-09-03 17:34:32.741] [undefined] GET(/see-later): 'See Later' playlist retrieved for user with id 1 with status 200
[2025-09-03 17:34:41.091] [undefined] GET(/see-later): 'See Later' playlist retrieved for user with id 1 with status 200
[2025-09-03 17:35:57.790] [undefined] GET(/see-later): 'See Later' playlist retrieved for user with id 1 with status 200

Loading…
Cancel
Save