mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-11 03:24:16 +00:00
remove unused method
This commit is contained in:
parent
df462d842f
commit
5a79ecabbf
@ -1,61 +1,12 @@
|
|||||||
export default class PlaylistsModel {
|
export default class PlaylistsModel {
|
||||||
static async uploadTrack(file, payload) {
|
static async putPlaylist(payload) {
|
||||||
// get the file from the payload
|
if (!payload) {
|
||||||
if (!file) {
|
throw new Error("Payload is required")
|
||||||
throw new Error("File 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({
|
const { data } = await app.cores.api.customRequest({
|
||||||
method: "POST",
|
method: "PUT",
|
||||||
url: "/tracks/publish",
|
url: `/playlist`,
|
||||||
data: payload,
|
|
||||||
})
|
|
||||||
|
|
||||||
return data
|
|
||||||
}
|
|
||||||
|
|
||||||
static async publish(payload) {
|
|
||||||
const { data } = await app.cores.api.customRequest({
|
|
||||||
method: "POST",
|
|
||||||
url: `/playlist/publish`,
|
|
||||||
data: payload,
|
data: payload,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -80,38 +31,6 @@ export default class PlaylistsModel {
|
|||||||
return data
|
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) {
|
static async deletePlaylist(id) {
|
||||||
if (!id) {
|
if (!id) {
|
||||||
throw new Error("ID is required")
|
throw new Error("ID is required")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user