mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 13:03:02 +00:00
Restyle Add edit playlist modal (#26)
* Restyled by autopep8 * Restyled by black * Restyled by isort * Restyled by reorder-python-imports * Restyled by yapf Co-authored-by: Restyled.io <commits@restyled.io>
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
"""
|
||||
This file contains the Playlists class for interacting with the playlist documents in MongoDB.
|
||||
"""
|
||||
|
||||
from app import db, models
|
||||
from app import db
|
||||
from app import models
|
||||
from bson import ObjectId
|
||||
|
||||
convert_many = db.convert_many
|
||||
@@ -23,8 +23,12 @@ class Playlists(db.Mongo):
|
||||
Inserts a new playlist object into the database.
|
||||
"""
|
||||
return self.collection.update_one(
|
||||
{"name": playlist["name"]},
|
||||
{"$set": playlist},
|
||||
{
|
||||
"name": playlist["name"]
|
||||
},
|
||||
{
|
||||
"$set": playlist
|
||||
},
|
||||
upsert=True,
|
||||
).upserted_id
|
||||
|
||||
@@ -49,7 +53,9 @@ class Playlists(db.Mongo):
|
||||
|
||||
return self.collection.update_one(
|
||||
{"_id": ObjectId(playlistid)},
|
||||
{"$push": {"pre_tracks": track}},
|
||||
{"$push": {
|
||||
"pre_tracks": track
|
||||
}},
|
||||
)
|
||||
|
||||
def get_playlist_by_name(self, name: str) -> dict:
|
||||
@@ -66,4 +72,4 @@ class Playlists(db.Mongo):
|
||||
return self.collection.update_one(
|
||||
{"_id": ObjectId(playlistid)},
|
||||
{"$set": playlist},
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user