ucsb-cs148-w24 / project-pj11-songrater

MIT License
1 stars 0 forks source link

Flask endpoint to delete song from user list #59

Open akdas16 opened 8 months ago

akdas16 commented 8 months ago

Implement flask endpoint ('/api/delete_song') to delete a song from a particular User Lists table, given user id and song id, as well as the type of song that will be deleted (either good, ok, or bad which the frontend will specify to the backend)

Acceptance Criteria [X] Using 'psycopg2' module, able to make connection to the postgres database [X] Perform SELECT SQL query to determine the "index" (position) to delete the song from the list of current songs that correspond to the given user [X] Once appropriate position is found, perform SQL DELETE to delete the appropriate song. Note that upon deletion of a song whose rank is NOT in the last position, the ranks of songs that come BELOW the desired deleted song need to be updated as well, as they "bubble up" in rank to the top [X] Perform SQL UPDATE for songs whose ranks needs to be changed, then return to the frontend as a json with message "Successfully deleted song from user list"