mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-03 04:18:16 +03:00
Organise Imports
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import p from "prudence";
|
||||
import { Lamps, integer } from "tachi-common";
|
||||
import { integer, Lamps } from "tachi-common";
|
||||
import { FormatPrError } from "utils/prudence";
|
||||
import { FindIIDXChartOnInGameIDVersion } from "utils/queries/charts";
|
||||
import { FindSongOnID } from "utils/queries/songs";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import deepmerge from "deepmerge";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { Game, BatchManualScore } from "tachi-common";
|
||||
import { BatchManualScore, Game } from "tachi-common";
|
||||
import t from "tap";
|
||||
import ResetDBState from "test-utils/resets";
|
||||
import { GetKTDataJSON, Testing511Song, Testing511SPA } from "test-utils/test-data";
|
||||
|
||||
@@ -3,10 +3,10 @@ import { KtLogger } from "lib/logger/logger";
|
||||
import {
|
||||
BatchManualScore,
|
||||
ChartDocument,
|
||||
ImportTypes,
|
||||
SongDocument,
|
||||
Grades,
|
||||
IDStrings,
|
||||
ImportTypes,
|
||||
SongDocument,
|
||||
} from "tachi-common";
|
||||
import {
|
||||
FindBMSChartOnHash,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import deepmerge from "deepmerge";
|
||||
import { IIDXDans } from "lib/constants/classes";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { BatchManual } from "tachi-common";
|
||||
import t from "tap";
|
||||
import { EscapeStringRegexp } from "utils/misc";
|
||||
import { IIDXDans } from "lib/constants/classes";
|
||||
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
|
||||
import { ParseBatchManualFromObject as ParserFn } from "./parser";
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import deepmerge from "deepmerge";
|
||||
import { IIDXDans, SDVXDans, WACCA_STAGEUPS } from "lib/constants/classes";
|
||||
import { KtLogger } from "lib/logger/logger";
|
||||
import { TachiConfig } from "lib/setup/config";
|
||||
import p, { PrudenceSchema, ValidSchemaValue } from "prudence";
|
||||
@@ -12,7 +13,6 @@ import {
|
||||
Playtypes,
|
||||
} from "tachi-common";
|
||||
import { FormatPrError } from "utils/prudence";
|
||||
import { IIDXDans, SDVXDans, WACCA_STAGEUPS } from "lib/constants/classes";
|
||||
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
|
||||
import { ParserFunctionReturns } from "../types";
|
||||
import { BatchManualContext } from "./types";
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { RequestHandler } from "express";
|
||||
import db from "external/mongo/db";
|
||||
import { SYMBOL_TachiAPIAuth } from "lib/constants/tachi";
|
||||
import { SplitAuthorizationHeader } from "utils/misc";
|
||||
import { APITokenDocument, APIPermissions, UserAuthLevels } from "tachi-common";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { TachiConfig } from "lib/setup/config";
|
||||
import { APIPermissions, APITokenDocument, UserAuthLevels } from "tachi-common";
|
||||
import { SplitAuthorizationHeader } from "utils/misc";
|
||||
|
||||
const logger = CreateLogCtx(__filename);
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// @todo #118
|
||||
|
||||
import { RequestHandler } from "express";
|
||||
import multer, { MulterError } from "multer";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { integer } from "tachi-common";
|
||||
import { SIXTEEN_MEGABTYES } from "lib/constants/filesize";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import multer, { MulterError } from "multer";
|
||||
import { integer } from "tachi-common";
|
||||
|
||||
const defaultLogger = CreateLogCtx(__filename);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import t from "tap";
|
||||
import expMiddlewareMock from "express-request-mock";
|
||||
import prValidate from "./prudence-validate";
|
||||
import Prudence from "prudence";
|
||||
import t from "tap";
|
||||
import prValidate from "./prudence-validate";
|
||||
|
||||
t.test("#PrudenceMiddleware", (t) => {
|
||||
const mw = prValidate({ foo: Prudence.regex(/^baz$/u) }, { foo: "example error message" });
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import Prudence, {
|
||||
MiddlewareErrorHandler,
|
||||
PrudenceSchema,
|
||||
ErrorMessages,
|
||||
PrudenceOptions,
|
||||
} from "prudence";
|
||||
import { RequestHandler } from "express-serve-static-core";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import Prudence, {
|
||||
ErrorMessages,
|
||||
MiddlewareErrorHandler,
|
||||
PrudenceOptions,
|
||||
PrudenceSchema,
|
||||
} from "prudence";
|
||||
|
||||
const logger = CreateLogCtx(__filename);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { RequestHandler, Response } from "express-serve-static-core";
|
||||
import { SYMBOL_TachiAPIAuth } from "lib/constants/tachi";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { TachiConfig } from "lib/setup/config";
|
||||
|
||||
const logger = CreateLogCtx(__filename);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SanitiseQString from "./sanitise-qstring";
|
||||
import t from "tap";
|
||||
import expMiddlewareMock from "express-request-mock";
|
||||
import t from "tap";
|
||||
import SanitiseQString from "./sanitise-qstring";
|
||||
|
||||
t.test("#SanitiseQString", (t) => {
|
||||
t.test("Should allow GET requests with valid data.", async (t) => {
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import bcrypt from "bcryptjs";
|
||||
import db from "external/mongo/db";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { Environment, ServerConfig } from "lib/setup/config";
|
||||
import {
|
||||
integer,
|
||||
PrivateUserInfoDocument,
|
||||
@@ -6,13 +9,10 @@ import {
|
||||
UserAuthLevels,
|
||||
UserSettings,
|
||||
} from "tachi-common";
|
||||
import db from "external/mongo/db";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { FormatUserDoc } from "utils/user";
|
||||
import nodeFetch from "utils/fetch";
|
||||
import { Random20Hex } from "utils/misc";
|
||||
import { Environment, ServerConfig } from "lib/setup/config";
|
||||
import { CreateURLWithParams } from "utils/url";
|
||||
import { FormatUserDoc } from "utils/user";
|
||||
|
||||
const logger = CreateLogCtx(__filename);
|
||||
|
||||
|
||||
+5
-9
@@ -13,8 +13,7 @@ const router: Router = Router({ mergeParams: true });
|
||||
* @name GET /api/v1/users/:userID/games/:game/:playtype/sessions
|
||||
*/
|
||||
router.get("/", async (req, res) => {
|
||||
const { user, game, playtype } = GetUGPT(req);
|
||||
|
||||
const { user, game, playtype } = GetUGPT(req);
|
||||
|
||||
if (typeof req.query.search !== "string") {
|
||||
return res.status(400).json({
|
||||
@@ -40,7 +39,7 @@ router.get("/", async (req, res) => {
|
||||
* @name GET /api/v1/users/:userID/games/:game/:playtype/sessions/best
|
||||
*/
|
||||
router.get("/best", async (req, res) => {
|
||||
const { user, game, playtype } = GetUGPT(req);
|
||||
const { user, game, playtype } = GetUGPT(req);
|
||||
|
||||
const gptConfig = GetGamePTConfig(game, playtype);
|
||||
|
||||
@@ -87,8 +86,7 @@ router.get("/best", async (req, res) => {
|
||||
* @name GET /api/v1/users/:userID/games/:game/:playtype/sessions/highlighted
|
||||
*/
|
||||
router.get("/highlighted", async (req, res) => {
|
||||
const { user, game, playtype } = GetUGPT(req);
|
||||
|
||||
const { user, game, playtype } = GetUGPT(req);
|
||||
|
||||
const sessions = await db.sessions.find(
|
||||
{ userID: user.id, game, playtype, highlight: true },
|
||||
@@ -108,8 +106,7 @@ router.get("/highlighted", async (req, res) => {
|
||||
* @name GET /api/v1/users/:userID/games/:game/:playtype/sessions/recent
|
||||
*/
|
||||
router.get("/recent", async (req, res) => {
|
||||
const { user, game, playtype } = GetUGPT(req);
|
||||
|
||||
const { user, game, playtype } = GetUGPT(req);
|
||||
|
||||
const sessions = await db.sessions.find(
|
||||
{ userID: user.id, game, playtype },
|
||||
@@ -129,8 +126,7 @@ router.get("/recent", async (req, res) => {
|
||||
* @name GET /api/v1/users/:userID/games/:game/:playtype/sessions/last
|
||||
*/
|
||||
router.get("/last", async (req, res) => {
|
||||
const { user, game, playtype } = GetUGPT(req);
|
||||
|
||||
const { user, game, playtype } = GetUGPT(req);
|
||||
|
||||
const session = await db.sessions.findOne(
|
||||
{ userID: user.id, game, playtype },
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Router } from "express";
|
||||
import db from "external/mongo/db";
|
||||
import { SYMBOL_TachiData } from "lib/constants/tachi";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import p from "prudence";
|
||||
import { RequirePermissions } from "server/middleware/auth";
|
||||
|
||||
+1
-1
@@ -1,6 +1,5 @@
|
||||
import { Router } from "express";
|
||||
import db from "external/mongo/db";
|
||||
import { SYMBOL_TachiData } from "lib/constants/tachi";
|
||||
import { GetUGPT } from "utils/req-tachi-data";
|
||||
import goalsRouter from "./goals/router";
|
||||
import milestonesRouter from "./milestones/router";
|
||||
@@ -133,5 +132,6 @@ router.get("/recently-interacted", async (req, res) => {
|
||||
});
|
||||
|
||||
router.use("/goals", goalsRouter);
|
||||
router.use("/milestones", milestonesRouter);
|
||||
|
||||
export default router;
|
||||
|
||||
@@ -11,8 +11,8 @@ import beatorajaIR from "./beatoraja/router";
|
||||
import directManualIR from "./direct-manual/router";
|
||||
import fervidexIR from "./fervidex/router";
|
||||
import ksHookIR from "./kshook/router";
|
||||
import uscIR from "./usc/router";
|
||||
import lr2hookIR from "./lr2hook/router";
|
||||
import uscIR from "./usc/router";
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import supertest from "supertest";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import supertest from "supertest";
|
||||
import server from "../server/server";
|
||||
|
||||
const logger = CreateLogCtx(__filename);
|
||||
|
||||
import server from "../server/server";
|
||||
|
||||
logger.verbose("Creating Mock Server Connection...");
|
||||
const connection = server.listen();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import server from "../server/server";
|
||||
import supertest from "supertest";
|
||||
import server from "../server/server";
|
||||
|
||||
const mockServer = supertest(server);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user