add colors to album page header

- add colors attribute to the album class
- render color gradient in the album page
This commit is contained in:
geoffrey45
2022-06-30 14:01:48 +03:00
committed by Mungai Geoffrey
parent f919ce35df
commit a23b6200eb
7 changed files with 70 additions and 42 deletions
+10
View File
@@ -2,6 +2,7 @@
This file contains the Album class for interacting with
album documents in MongoDB.
"""
from typing import List
from app.db.mongodb import convert_many
from app.db.mongodb import convert_one
from app.db.mongodb import MongoAlbums
@@ -59,3 +60,12 @@ class Albums(MongoAlbums):
"""
album = self.collection.find_one({"hash": hash})
return convert_one(album)
def set_album_colors(self, colors: List[str], album_id: str) -> None:
"""
Sets the colors for an album.
"""
self.collection.update_one(
{"_id": ObjectId(album_id)},
{"$set": {"colors": colors}},
)