added dark mode and jacket art

This commit is contained in:
polaris
2024-07-01 14:19:20 -04:00
parent 076be97aab
commit fce22cda7c
9 changed files with 88 additions and 8 deletions

View File

@ -13,7 +13,6 @@ type LinkSharingToken = {
export async function getSongsWithTitles(userId: number) {
try {
const songs: ChuniScorePlaylog[] = await artemis.chuni_score_playlog.findMany({
where: {
user: userId,
@ -63,7 +62,6 @@ export async function getSongsWithTitles(userId: number) {
},
});
// Extract unique musicIds from the fetched songs
const chuniScorePlaylogMusicId = songs
.map((song) => song.musicId)
.filter((id): id is number => id !== null);
@ -82,6 +80,7 @@ export async function getSongsWithTitles(userId: number) {
level: true,
genre: true,
worldsEndTag: true,
jacketPath: true, // Add jacketPath to the selection
},
});
@ -98,7 +97,6 @@ export async function getSongsWithTitles(userId: number) {
},
});
// Create a map of musicId to play count
const playCountMap = playCounts.reduce((map, item) => {
if (item.musicId !== null) {
map[item.musicId] = item._count.musicId;
@ -121,6 +119,7 @@ export async function getSongsWithTitles(userId: number) {
level: staticInfo?.level || "Unknown Level",
chartlevel: song.level || "Unknown Level",
playCount: song.musicId !== null ? playCountMap[song.musicId] || 0 : 0,
jacketPath: staticInfo?.jacketPath || "",
};
});
@ -131,6 +130,8 @@ export async function getSongsWithTitles(userId: number) {
}
}
export async function generatePlaylogId(playlogid: number) {
try {
const tokens = (await daphnis.linkSharingToken.findMany({