refactor chartdocument db collections

This commit is contained in:
zkldi
2021-04-16 14:53:52 +01:00
parent a1a79bf5e7
commit 23869302a8
2 changed files with 38 additions and 3 deletions
+1 -1
View File
@@ -3623,7 +3623,7 @@
}
},
"kamaitachi-common": {
"version": "git+https://github.com/zkldi/Kamaitachi-common.git#ed14a981f924c137198e9c53826ddefe2c46c338",
"version": "git+https://github.com/zkldi/Kamaitachi-common.git#e6305e07ea09fdf9d773a50ac78336b210a0226c",
"from": "git+https://github.com/zkldi/Kamaitachi-common.git",
"requires": {
"monk": "^7.3.3"
+37 -2
View File
@@ -11,6 +11,7 @@ import {
InviteCodeDocument,
MilestoneDocument,
NotificationDocument,
Playtypes,
PrivateUserDocument,
PublicAPIKeyDocument,
ScoreDocument,
@@ -84,12 +85,46 @@ interface GameCollectionFull {
let GameCollectionPartial: GCPartial = {
songs: {},
charts: {},
// i have to handwrite this out for TS... :(
charts: {
bms: monkDB.get<ChartDocument<"bms", Playtypes["bms"], `bms:${Playtypes["bms"]}`>>(
`charts-bms`
),
chunithm: monkDB.get<
ChartDocument<"chunithm", Playtypes["chunithm"], `chunithm:${Playtypes["chunithm"]}`>
>(`charts-chunithm`),
ddr: monkDB.get<ChartDocument<"ddr", Playtypes["ddr"], `ddr:${Playtypes["ddr"]}`>>(
`charts-ddr`
),
gitadora: monkDB.get<
ChartDocument<"gitadora", Playtypes["gitadora"], `gitadora:${Playtypes["gitadora"]}`>
>(`charts-gitadora`),
iidx: monkDB.get<ChartDocument<"iidx", Playtypes["iidx"], `iidx:${Playtypes["iidx"]}`>>(
`charts-iidx`
),
jubeat: monkDB.get<
ChartDocument<"jubeat", Playtypes["jubeat"], `jubeat:${Playtypes["jubeat"]}`>
>(`charts-jubeat`),
maimai: monkDB.get<
ChartDocument<"maimai", Playtypes["maimai"], `maimai:${Playtypes["maimai"]}`>
>(`charts-maimai`),
museca: monkDB.get<
ChartDocument<"museca", Playtypes["museca"], `museca:${Playtypes["museca"]}`>
>(`charts-museca`),
popn: monkDB.get<ChartDocument<"popn", Playtypes["popn"], `popn:${Playtypes["popn"]}`>>(
`charts-popn`
),
sdvx: monkDB.get<ChartDocument<"sdvx", Playtypes["sdvx"], `sdvx:${Playtypes["sdvx"]}`>>(
`charts-sdvx`
),
usc: monkDB.get<ChartDocument<"usc", Playtypes["usc"], `usc:${Playtypes["usc"]}`>>(
`charts-usc`
),
},
};
for (const game of config.supportedGames) {
GameCollectionPartial.songs[game] = monkDB.get<SongDocument>(`songs-${game}`);
GameCollectionPartial.charts[game] = monkDB.get<ChartDocument>(`charts-${game}`);
}
// a typescript-friendly interface for the database.