mirror of
https://github.com/20kaushik02/spotify-manager.git
synced 2026-01-25 06:04:05 +00:00
minor: refined scopes, some more graphing, ocd
This commit is contained in:
@@ -73,7 +73,7 @@ const updateUser = async (req, res) => {
|
||||
}
|
||||
|
||||
let oldPlaylists = await Playlists.findAll({
|
||||
attributes: ["playlistID", "playlistName"],
|
||||
attributes: ["playlistID"],
|
||||
raw: true,
|
||||
where: {
|
||||
userID: userURI.id
|
||||
@@ -97,6 +97,7 @@ const updateUser = async (req, res) => {
|
||||
let removedLinks = 0;
|
||||
|
||||
if (toRemove.length) {
|
||||
// clean up any links dependent on the playlists
|
||||
removedLinks = await Links.destroy({
|
||||
where: {
|
||||
[Op.and]: [
|
||||
@@ -110,6 +111,8 @@ const updateUser = async (req, res) => {
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
// only then remove
|
||||
const cleanedUser = await Playlists.destroy({
|
||||
where: { playlistID: toRemoveIDs }
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ const logger = require("../utils/logger")(module);
|
||||
|
||||
const typedefs = require("../typedefs");
|
||||
const { axiosInstance } = require('../utils/axios');
|
||||
const { parseSpotifyUri, parseSpotifyLink } = require("../utils/spotifyUriTransformer");
|
||||
const { parseSpotifyURI, parseSpotifyLink } = require("../utils/spotifyURITransformer");
|
||||
|
||||
/**
|
||||
* Retrieve list of all of user's playlists
|
||||
@@ -15,7 +15,7 @@ const getUserPlaylists = async (req, res) => {
|
||||
|
||||
// get first 50
|
||||
const response = await axiosInstance.get(
|
||||
`/users/${parseSpotifyUri(req.session.user.uri).id}/playlists`,
|
||||
`/users/${parseSpotifyURI(req.session.user.uri).id}/playlists`,
|
||||
{
|
||||
params: {
|
||||
offset: 0,
|
||||
@@ -89,7 +89,7 @@ const getPlaylistDetails = async (req, res) => {
|
||||
try {
|
||||
/** @type {typedefs.Playlist} */
|
||||
let playlist = {};
|
||||
/** @type {typedefs.UriObject} */
|
||||
/** @type {typedefs.URIObject} */
|
||||
let uri;
|
||||
let initialFields = ["collaborative", "description", "images", "name", "owner(uri,display_name)", "public",
|
||||
"snapshot_id", "tracks(next,total,items(is_local,track(name,uri)))"];
|
||||
|
||||
Reference in New Issue
Block a user