push whatever

This commit is contained in:
zkldi
2021-04-22 21:38:50 +01:00
parent 7cde3293b0
commit d583b902ca
3 changed files with 40 additions and 5 deletions
+3 -3
View File
@@ -61,7 +61,7 @@ dependencies:
express-async-errors: 3.1.1_express@4.17.1
express-session: 1.17.1
fast-json-stable-hash: 1.0.1
kamaitachi-common: github.com/zkldi/Kamaitachi-common/7fc1dc8955ead256bc8d84c602095cf4c8e2e509
kamaitachi-common: github.com/zkldi/Kamaitachi-common/cc4d90ae418e552459ac8c501f8fc75222639148
mongodb: 3.6.6
monk: 7.3.4
multer: 1.4.2
@@ -4601,8 +4601,8 @@ packages:
'@types/yoga-layout': 1.9.2
dev: true
github.com/zkldi/Kamaitachi-common/7fc1dc8955ead256bc8d84c602095cf4c8e2e509:
resolution: {tarball: https://codeload.github.com/zkldi/Kamaitachi-common/tar.gz/7fc1dc8955ead256bc8d84c602095cf4c8e2e509}
github.com/zkldi/Kamaitachi-common/cc4d90ae418e552459ac8c501f8fc75222639148:
resolution: {tarball: https://codeload.github.com/zkldi/Kamaitachi-common/tar.gz/cc4d90ae418e552459ac8c501f8fc75222639148}
name: kamaitachi-common
version: 0.1.0
dependencies:
+33
View File
@@ -374,6 +374,38 @@ export const PRUDENCE_CHART_SCHEMAS: Record<Game, PrudenceSchema> = {
}),
};
const PRUDENCE_SONG_BASE: PrudenceSchema = {
id: p.isPositiveInteger,
title: "string",
artist: "string",
isRemoved: "boolean",
"search-titles": [p.and("string", (self, parent) => self !== parent.title)],
"alt-titles": [p.and("string", (self, parent) => self !== parent.title)],
version: ["string"],
};
function CreatePrSong(data: PrudenceSchema) {
return deepmerge(PRUDENCE_SONG_BASE, {
data,
});
}
const PRUDENCE_SONG_WITH_GENRE = CreatePrSong({ genre: "string" });
export const PRUDENCE_SONG_SCHEMAS: Record<Game, PrudenceSchema> = {
iidx: PRUDENCE_SONG_WITH_GENRE,
bms: PRUDENCE_SONG_WITH_GENRE,
chunithm: PRUDENCE_SONG_WITH_GENRE,
ddr: CreatePrSong({}),
gitadora: CreatePrSong({}),
jubeat: CreatePrSong({}),
maimai: CreatePrSong({ titleJP: "string", artistJP: "string", genre: "string" }),
museca: CreatePrSong({ titleJP: "string", artistJP: "string" }),
popn: PRUDENCE_SONG_WITH_GENRE,
sdvx: CreatePrSong({ uscEquiv: p.isPositiveInteger }),
usc: CreatePrSong({ sdvxEquiv: p.isPositiveInteger }),
};
/**
* Schemas that are "static", i.e. the content of the document
* does not depend on fields in the document (such as score docs)
@@ -384,4 +416,5 @@ export const STATIC_SCHEMAS = {
"iidx-bpi-data": PRUDENCE_IIDX_BPI_DATA,
counters: PRUDENCE_COUNTER,
charts: PRUDENCE_CHART_SCHEMAS,
songs: PRUDENCE_SONG_SCHEMAS,
};
@@ -10,8 +10,10 @@ function ConvertFn(c: any): SongDocument<"iidx"> {
artist: c.artist,
id: c.id,
isRemoved: false, // NOT REALLY
"alt-titles": c["alt-titles"],
"search-titles": c["search-titles"],
"alt-titles": c["alt-titles"].filter((e: string) => e !== c.title),
"search-titles": c["search-titles"]
.map((e: string) => e.toString())
.filter((e: string) => e !== c.title),
version: [], // sentinel
data: {
genre: c.genre,