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:
restyled-io[bot]
2022-04-08 06:55:00 +03:00
committed by GitHub
parent 6cd982c8ee
commit aa79214a50
6 changed files with 38 additions and 26 deletions
+12 -6
View File
@@ -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},
)
)