From 36de183a5af4571de60e224bc12e208fe910cb36 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Wed, 17 Aug 2022 23:38:55 +0100 Subject: [PATCH] patch(server): stub out targets/rivals --- .../router/api/v1/games/_game/_playtype/router.ts | 7 ++++++- .../v1/users/_userID/games/_game/_playtype/router.ts | 11 +++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/server/src/server/router/api/v1/games/_game/_playtype/router.ts b/server/src/server/router/api/v1/games/_game/_playtype/router.ts index 6587784e4..d2e9380a0 100644 --- a/server/src/server/router/api/v1/games/_game/_playtype/router.ts +++ b/server/src/server/router/api/v1/games/_game/_playtype/router.ts @@ -9,6 +9,7 @@ import { Router } from "express"; import db from "external/mongo/db"; import { ONE_HOUR } from "lib/constants/time"; import { SearchUsersRegExp } from "lib/search/search"; +import { Environment } from "lib/setup/config"; import NodeCache from "node-cache"; import p from "prudence"; import prValidate from "server/middleware/prudence-validate"; @@ -340,6 +341,10 @@ router.use("/songs/:songID", songIDRouter); router.use("/folders", foldersRouter); router.use("/tables", tablesRouter); router.use("/scores", scoresRouter); -router.use("/targets", targetsRouter); + +// stubbed for tests only, not ready for release. +if (Environment.nodeEnv === "test") { + router.use("/targets", targetsRouter); +} export default router; diff --git a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.ts b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.ts index 8fba0ae64..07062d941 100644 --- a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.ts +++ b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.ts @@ -10,6 +10,7 @@ import tablesRouter from "./tables/router"; import targetsRouter from "./targets/router"; import { Router } from "express"; import db from "external/mongo/db"; +import { Environment } from "lib/setup/config"; import { GetGamePTConfig } from "tachi-common"; import { IsString } from "utils/misc"; import { GetTachiData, GetUGPT } from "utils/req-tachi-data"; @@ -298,7 +299,13 @@ router.use("/tables", tablesRouter); router.use("/showcase", showcaseRouter); router.use("/settings", settingsRouter); router.use("/folders", foldersRouter); -router.use("/targets", targetsRouter); -router.use("/rivals", rivalsRouter); + +// these are stubbed out in release, as they aren't ready for full release yet +// but we desperately need a 2.1 update. +// they are, however, available in tests because otherwise tests would fail. +if (Environment.nodeEnv === "test") { + router.use("/targets", targetsRouter); + router.use("/rivals", rivalsRouter); +} export default router;