From 5a79ecabbf06c710b2d8e6c746c96b007d0193f7 Mon Sep 17 00:00:00 2001 From: SrGooglo Date: Mon, 17 Apr 2023 21:50:22 +0000 Subject: [PATCH] remove unused method --- packages/app/src/models/playlists/index.js | 91 ++-------------------- 1 file changed, 5 insertions(+), 86 deletions(-) diff --git a/packages/app/src/models/playlists/index.js b/packages/app/src/models/playlists/index.js index 4a09c5ae..a55f1849 100755 --- a/packages/app/src/models/playlists/index.js +++ b/packages/app/src/models/playlists/index.js @@ -1,61 +1,12 @@ export default class PlaylistsModel { - static async uploadTrack(file, payload) { - // get the file from the payload - if (!file) { - throw new Error("File is required") + static async putPlaylist(payload) { + if (!payload) { + throw new Error("Payload is required") } - console.log(file) - - // create a new form data - const formData = new FormData() - - // append the file to the form data - formData.append("files", file) - - // send the request - const uploadRequest = await app.cores.api.customRequest({ - method: "POST", - url: "/upload", - data: formData, - }) - - console.log(uploadRequest.data) - - if (!uploadRequest.data.files[0]) { - throw new Error("Upload failed") - } - - // get the url - const source = uploadRequest.data.files[0].url - - // send the request for the track to be created - const trackRequest = await app.cores.api.customRequest({ - method: "POST", - url: "/tracks/publish", - data: { - ...payload, - source, - } - }) - - return trackRequest.data - } - - static async publishTrack(payload) { const { data } = await app.cores.api.customRequest({ - method: "POST", - url: "/tracks/publish", - data: payload, - }) - - return data - } - - static async publish(payload) { - const { data } = await app.cores.api.customRequest({ - method: "POST", - url: `/playlist/publish`, + method: "PUT", + url: `/playlist`, data: payload, }) @@ -80,38 +31,6 @@ export default class PlaylistsModel { return data } - static async updateTrack(payload) { - if (!payload) { - throw new Error("Payload is required") - } - - const { data } = await app.cores.api.customRequest({ - method: "PUT", - url: `/tracks/${payload._id}`, - data: { - payload - }, - }) - - return data - } - - static async updatePlaylist(payload) { - if (!payload) { - throw new Error("Payload is required") - } - - const { data } = await app.cores.api.customRequest({ - method: "PUT", - url: `/playlist/${payload._id}`, - data: { - payload - }, - }) - - return data - } - static async deletePlaylist(id) { if (!id) { throw new Error("ID is required")