From 8de536efc9fecf2398f91f27b3c3dda1d5f983da Mon Sep 17 00:00:00 2001 From: OfficialDakari Date: Fri, 18 Oct 2024 21:55:59 +0500 Subject: [PATCH] idk --- routes/playlists.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/routes/playlists.ts b/routes/playlists.ts index 26f2557..a2be245 100644 --- a/routes/playlists.ts +++ b/routes/playlists.ts @@ -2,6 +2,7 @@ import { Application } from "express"; import { dbDelete, dbRead, dbStore } from "../database.js"; import createHttpError from "http-errors"; import generateID from "../idgen.js"; +import md5 from "md5"; export default function playlists(app: Application) { @@ -70,7 +71,7 @@ export default function playlists(app: Application) { if (!user.playlists.includes(req.params.id)) throw createHttpError[404](); const playlist = dbRead('playlists', req.params.id); - playlist.songs.push(req.body.songId); + playlist.songs.push(dbRead('cache', req.body.songId)); dbStore('playlists', req.params.id, playlist); @@ -86,7 +87,7 @@ export default function playlists(app: Application) { if (!user.playlists.includes(req.params.id)) throw createHttpError[404](); const playlist = dbRead('playlists', req.params.id); - playlist.songs = playlist.songs.filter((x: string) => x !== req.params.songId); + playlist.songs = playlist.songs.filter((x: any) => x.videoId !== req.params.songId); dbStore('playlists', req.params.id, playlist);