idk
This commit is contained in:
parent
1767ae6cfc
commit
8de536efc9
|
|
@ -2,6 +2,7 @@ import { Application } from "express";
|
||||||
import { dbDelete, dbRead, dbStore } from "../database.js";
|
import { dbDelete, dbRead, dbStore } from "../database.js";
|
||||||
import createHttpError from "http-errors";
|
import createHttpError from "http-errors";
|
||||||
import generateID from "../idgen.js";
|
import generateID from "../idgen.js";
|
||||||
|
import md5 from "md5";
|
||||||
|
|
||||||
export default function playlists(app: Application) {
|
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]();
|
if (!user.playlists.includes(req.params.id)) throw createHttpError[404]();
|
||||||
const playlist = dbRead('playlists', req.params.id);
|
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);
|
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]();
|
if (!user.playlists.includes(req.params.id)) throw createHttpError[404]();
|
||||||
const playlist = dbRead('playlists', req.params.id);
|
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);
|
dbStore('playlists', req.params.id, playlist);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue