mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
first recommendation draft
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
from app.models.mix import Mix
|
||||
from app.store.tracks import TrackStore
|
||||
from app.utils.auth import get_current_userid
|
||||
|
||||
|
||||
class HomepageStore:
|
||||
entries = {
|
||||
"artist_mixes": {},
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def set_artist_mixes(cls, mixes: list[Mix], userid: int = 1):
|
||||
idmap = {mix.id: mix for mix in mixes}
|
||||
cls.entries["artist_mixes"][userid] = idmap
|
||||
|
||||
@classmethod
|
||||
def get_artist_mixes(cls):
|
||||
return [
|
||||
{
|
||||
"type": "mix",
|
||||
"item": mix.to_dict(),
|
||||
}
|
||||
for mix in cls.entries["artist_mixes"]
|
||||
.get(get_current_userid(), {})
|
||||
.values()
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def get_mix(cls, mixtype: str, mixid: str):
|
||||
return cls.entries[mixtype].get(get_current_userid(), {}).get(mixid).to_full_dict()
|
||||
Reference in New Issue
Block a user