From bbbeccf10fc686f5dc95abf5ed5b7cff254978ef Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Tue, 16 Nov 2021 16:31:11 +0000 Subject: [PATCH] Everytime I run this import cleaner it does different things I swear. --- server/src/external/mongo/db.test.ts | 1 - server/src/external/mongo/indexes.ts | 8 ++-- server/src/external/mongo/schemas.ts | 12 +++--- server/src/external/redis/redis-IPC.ts | 4 +- server/src/lib/invites/invites.ts | 2 +- server/src/lib/orphan-queue/orphan-queue.ts | 14 +++---- .../api/arc-iidx/class-handler.test.ts | 7 ++-- .../api/arc-iidx/class-handler.ts | 6 +-- .../api/arc-iidx/converter.test.ts | 5 +-- .../import-types/api/arc-iidx/converter.ts | 16 ++++---- .../import-types/api/arc-iidx/parser.test.ts | 5 +-- .../import-types/api/arc-iidx/parser.ts | 8 ++-- .../import-types/api/arc-sdvx/converter.ts | 17 ++++----- .../common/batch-manual/converter.ts | 22 +++++------ .../common/batch-manual/parser.ts | 20 +++++----- .../common/eamusement-iidx-csv/converter.ts | 6 +-- .../common/eamusement-iidx-csv/parser.test.ts | 6 +-- .../score-import/import-types/common/types.ts | 34 ++++++++--------- .../import-types/ir/barbatos/converter.ts | 6 +-- .../import-types/ir/barbatos/parser.test.ts | 3 +- .../import-types/ir/beatoraja/parser.ts | 8 ++-- .../import-types/ir/fervidex/converter.ts | 10 ++--- .../import-types/ir/fervidex/parser.ts | 12 +++--- server/src/server/middleware/rate-limiter.ts | 6 +-- server/src/server/middleware/type-require.ts | 2 +- .../src/server/router/api/v1/auth/router.ts | 38 +++++++++---------- .../router/api/v1/clients/middleware.test.ts | 6 +-- .../router/api/v1/clients/router.test.ts | 4 +- .../server/router/api/v1/clients/router.ts | 16 ++++---- .../server/router/api/v1/games/router.test.ts | 4 +- .../folders/_folderID/router.test.ts | 9 ++--- .../_playtype/folders/_folderID/router.ts | 4 +- .../games/_game/_playtype/pbs/router.test.ts | 11 +++--- .../games/_game/_playtype/pbs/router.ts | 4 +- .../games/_game/_playtype/router.test.ts | 13 +++---- .../_userID/games/_game/_playtype/router.ts | 34 ++++++++--------- .../_game/_playtype/scores/router.test.ts | 7 ++-- .../_game/_playtype/sessions/router.test.ts | 5 +-- .../games/_game/_playtype/settings/router.ts | 10 ++--- .../_game/_playtype/tables/router.test.ts | 7 ++-- .../src/server/router/ir/fervidex/router.ts | 3 -- .../server/router/ir/kshook/sv3c/router.ts | 4 +- server/src/utils/class.ts | 6 +-- server/src/utils/db.ts | 2 +- server/src/utils/milestone.ts | 2 +- server/src/utils/session.test.ts | 4 +- server/src/utils/session.ts | 4 +- server/src/utils/string-checks.ts | 2 +- server/src/utils/user.ts | 15 ++------ 49 files changed, 215 insertions(+), 239 deletions(-) diff --git a/server/src/external/mongo/db.test.ts b/server/src/external/mongo/db.test.ts index ab4ab9463..13a8e5e19 100644 --- a/server/src/external/mongo/db.test.ts +++ b/server/src/external/mongo/db.test.ts @@ -1,5 +1,4 @@ import t from "tap"; - import ResetDBState from "test-utils/resets"; import db from "./db"; diff --git a/server/src/external/mongo/indexes.ts b/server/src/external/mongo/indexes.ts index 475b0678a..61eff41ea 100644 --- a/server/src/external/mongo/indexes.ts +++ b/server/src/external/mongo/indexes.ts @@ -1,11 +1,11 @@ /* eslint-disable no-await-in-loop */ -import monk, { IMonkManager } from "monk"; -import { IndexOptions } from "mongodb"; +import { ONE_DAY } from "lib/constants/time"; import CreateLogCtx from "lib/logger/logger"; import { TachiConfig } from "lib/setup/config"; -import { ONE_DAY } from "lib/constants/time"; -import db, { Databases, monkDB } from "./db"; +import { IndexOptions } from "mongodb"; +import monk, { IMonkManager } from "monk"; import { Random20Hex } from "utils/misc"; +import db, { Databases, monkDB } from "./db"; const logger = CreateLogCtx(__filename); diff --git a/server/src/external/mongo/schemas.ts b/server/src/external/mongo/schemas.ts index ab993596a..4ba3dac4f 100644 --- a/server/src/external/mongo/schemas.ts +++ b/server/src/external/mongo/schemas.ts @@ -1,18 +1,18 @@ +import { TachiConfig } from "lib/setup/config"; +import p, { PrudenceSchema } from "prudence"; +import { AllPermissions } from "server/middleware/auth"; import { Game, + GamePTConfig, + GetGameConfig, GetGamePTConfig, Playtypes, UserAuthLevels, - GamePTConfig, - GetGameConfig, } from "tachi-common"; import { allIDStrings, allImportTypes } from "tachi-common/js/config/static-config"; -import p, { PrudenceSchema } from "prudence"; -import { Databases } from "./db"; -import { AllPermissions } from "server/middleware/auth"; -import { TachiConfig } from "lib/setup/config"; import { IsValidGame, IsValidPlaytype } from "utils/misc"; import { optNull } from "utils/prudence"; +import { Databases } from "./db"; // The idea of this file is to export a function for every database // that will validate that collection. diff --git a/server/src/external/redis/redis-IPC.ts b/server/src/external/redis/redis-IPC.ts index d74cbeb46..d048dd2e9 100644 --- a/server/src/external/redis/redis-IPC.ts +++ b/server/src/external/redis/redis-IPC.ts @@ -1,6 +1,6 @@ -import redis from "redis"; import CreateLogCtx from "lib/logger/logger"; -import { ServerConfig, TachiConfig } from "lib/setup/config"; +import { TachiConfig } from "lib/setup/config"; +import redis from "redis"; /** * This code has been stubbed out! It doesn't really have a use at the moment. diff --git a/server/src/lib/invites/invites.ts b/server/src/lib/invites/invites.ts index 89b77387f..06e7c0b75 100644 --- a/server/src/lib/invites/invites.ts +++ b/server/src/lib/invites/invites.ts @@ -1,5 +1,5 @@ import { ONE_MONTH } from "lib/constants/time"; -import CreateLogCtx, { rootLogger } from "lib/logger/logger"; +import CreateLogCtx from "lib/logger/logger"; import { ServerConfig } from "lib/setup/config"; import { PublicUserDocument } from "tachi-common"; diff --git a/server/src/lib/orphan-queue/orphan-queue.ts b/server/src/lib/orphan-queue/orphan-queue.ts index 4a44eb7a4..843ff8796 100644 --- a/server/src/lib/orphan-queue/orphan-queue.ts +++ b/server/src/lib/orphan-queue/orphan-queue.ts @@ -1,15 +1,15 @@ import db from "external/mongo/db"; import CreateLogCtx from "lib/logger/logger"; +import { FilterQuery } from "mongodb"; import { - ChartDocument, - IDStrings, - IDStringToGame, - integer, - OrphanChart, - SongDocument, + ChartDocument, + IDStrings, + IDStringToGame, + integer, + OrphanChart, + SongDocument } from "tachi-common"; import { GetNextCounterValue } from "utils/db"; -import { FilterQuery } from "mongodb"; const logger = CreateLogCtx(__filename); diff --git a/server/src/lib/score-import/import-types/api/arc-iidx/class-handler.test.ts b/server/src/lib/score-import/import-types/api/arc-iidx/class-handler.test.ts index fa013fd9f..bed0daf66 100644 --- a/server/src/lib/score-import/import-types/api/arc-iidx/class-handler.test.ts +++ b/server/src/lib/score-import/import-types/api/arc-iidx/class-handler.test.ts @@ -1,9 +1,8 @@ -import t from "tap"; - -import { MockJSONFetch } from "test-utils/mock-fetch"; -import ResetDBState from "test-utils/resets"; import { IIDXDans } from "lib/constants/classes"; import CreateLogCtx from "lib/logger/logger"; +import t from "tap"; +import { MockJSONFetch } from "test-utils/mock-fetch"; +import ResetDBState from "test-utils/resets"; import { CreateArcIIDXClassHandler } from "./class-handler"; const logger = CreateLogCtx(__filename); diff --git a/server/src/lib/score-import/import-types/api/arc-iidx/class-handler.ts b/server/src/lib/score-import/import-types/api/arc-iidx/class-handler.ts index 533c194dc..49d4bb93c 100644 --- a/server/src/lib/score-import/import-types/api/arc-iidx/class-handler.ts +++ b/server/src/lib/score-import/import-types/api/arc-iidx/class-handler.ts @@ -1,9 +1,9 @@ +import { IIDXDans } from "lib/constants/classes"; +import { ServerConfig } from "lib/setup/config"; import nodeFetch from "utils/fetch"; import { HasOwnProperty } from "utils/misc"; -import { IIDXDans } from "lib/constants/classes"; -import { ClassHandler } from "../../../framework/user-game-stats/types"; -import { ServerConfig } from "lib/setup/config"; import { CreateURLWithParams } from "utils/url"; +import { ClassHandler } from "../../../framework/user-game-stats/types"; export async function CreateArcIIDXClassHandler( profileID: string, diff --git a/server/src/lib/score-import/import-types/api/arc-iidx/converter.test.ts b/server/src/lib/score-import/import-types/api/arc-iidx/converter.test.ts index facb432d5..9bd19e86b 100644 --- a/server/src/lib/score-import/import-types/api/arc-iidx/converter.test.ts +++ b/server/src/lib/score-import/import-types/api/arc-iidx/converter.test.ts @@ -1,11 +1,10 @@ +import deepmerge from "deepmerge"; +import CreateLogCtx from "lib/logger/logger"; import t from "tap"; - import ResetDBState from "test-utils/resets"; import { GetKTDataJSON, Testing511Song, Testing511SPA } from "test-utils/test-data"; -import CreateLogCtx from "lib/logger/logger"; import { ConvertAPIArcIIDX, ResolveARCIIDXLamp } from "./converter"; import { ARCIIDXScore } from "./types"; -import deepmerge from "deepmerge"; const logger = CreateLogCtx(__filename); diff --git a/server/src/lib/score-import/import-types/api/arc-iidx/converter.ts b/server/src/lib/score-import/import-types/api/arc-iidx/converter.ts index f8853ee74..01f7a0862 100644 --- a/server/src/lib/score-import/import-types/api/arc-iidx/converter.ts +++ b/server/src/lib/score-import/import-types/api/arc-iidx/converter.ts @@ -1,21 +1,21 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { EmptyObject } from "utils/types"; -import { ConverterFunction } from "../../common/types"; import p, { PrudenceSchema } from "prudence"; +import { Lamps } from "tachi-common"; +import { FormatPrError } from "utils/prudence"; +import { FindChartOnARCID } from "utils/queries/charts"; +import { FindSongOnIDGuaranteed } from "utils/queries/songs"; +import { EmptyObject } from "utils/types"; import { InvalidScoreFailure, KTDataNotFoundFailure, } from "../../../framework/common/converter-failures"; -import { FormatPrError } from "utils/prudence"; -import { ARCIIDXScore } from "./types"; -import { FindChartOnARCID } from "utils/queries/charts"; -import { FindSongOnIDGuaranteed } from "utils/queries/songs"; -import { DryScore } from "../../../framework/common/types"; import { GenericGetGradeAndPercent, ParseDateFromString, } from "../../../framework/common/score-utils"; -import { Lamps } from "tachi-common"; +import { DryScore } from "../../../framework/common/types"; +import { ConverterFunction } from "../../common/types"; +import { ARCIIDXScore } from "./types"; // There's a bunch of other useless fields but we don't care const PR_ArcIIDXScore: PrudenceSchema = { diff --git a/server/src/lib/score-import/import-types/api/arc-iidx/parser.test.ts b/server/src/lib/score-import/import-types/api/arc-iidx/parser.test.ts index 3467ea15a..11bf755c6 100644 --- a/server/src/lib/score-import/import-types/api/arc-iidx/parser.test.ts +++ b/server/src/lib/score-import/import-types/api/arc-iidx/parser.test.ts @@ -1,11 +1,10 @@ +import db from "external/mongo/db"; +import CreateLogCtx from "lib/logger/logger"; import t from "tap"; - import { agta } from "test-utils/misc"; import { MockJSONFetch } from "test-utils/mock-fetch"; import ResetDBState from "test-utils/resets"; -import CreateLogCtx from "lib/logger/logger"; import { ParseArcIIDX } from "./parser"; -import db from "external/mongo/db"; const logger = CreateLogCtx(__filename); diff --git a/server/src/lib/score-import/import-types/api/arc-iidx/parser.ts b/server/src/lib/score-import/import-types/api/arc-iidx/parser.ts index 836aef32d..26dc96448 100644 --- a/server/src/lib/score-import/import-types/api/arc-iidx/parser.ts +++ b/server/src/lib/score-import/import-types/api/arc-iidx/parser.ts @@ -1,12 +1,12 @@ import { KtLogger } from "lib/logger/logger"; +import { ServerConfig } from "lib/setup/config"; +import { integer } from "tachi-common"; import nodeFetch from "utils/fetch"; +import { GetArcAuthGuaranteed } from "utils/queries/auth"; +import { EmptyObject } from "utils/types"; import { TraverseKaiAPI } from "../../common/api-kai/traverse-api"; import { ParserFunctionReturns } from "../../common/types"; -import { EmptyObject } from "utils/types"; -import { ServerConfig } from "lib/setup/config"; import { CreateArcIIDXClassHandler } from "./class-handler"; -import { GetArcAuthGuaranteed } from "utils/queries/auth"; -import { integer } from "tachi-common"; export async function ParseArcIIDX( userID: integer, diff --git a/server/src/lib/score-import/import-types/api/arc-sdvx/converter.ts b/server/src/lib/score-import/import-types/api/arc-sdvx/converter.ts index 68bb43cf9..ce554c2af 100644 --- a/server/src/lib/score-import/import-types/api/arc-sdvx/converter.ts +++ b/server/src/lib/score-import/import-types/api/arc-sdvx/converter.ts @@ -1,20 +1,20 @@ -import { EmptyObject } from "utils/types"; -import { ConverterFunction } from "../../common/types"; import p, { PrudenceSchema } from "prudence"; +import { Lamps } from "tachi-common"; +import { FormatPrError } from "utils/prudence"; +import { FindChartOnARCID } from "utils/queries/charts"; +import { FindSongOnIDGuaranteed } from "utils/queries/songs"; +import { EmptyObject } from "utils/types"; import { InvalidScoreFailure, KTDataNotFoundFailure, } from "../../../framework/common/converter-failures"; -import { FormatPrError } from "utils/prudence"; -import { ARCSDVXScore } from "./types"; -import { FindChartOnARCID } from "utils/queries/charts"; -import { FindSongOnIDGuaranteed } from "utils/queries/songs"; -import { DryScore } from "../../../framework/common/types"; import { GenericGetGradeAndPercent, ParseDateFromString, } from "../../../framework/common/score-utils"; -import { Lamps } from "tachi-common"; +import { DryScore } from "../../../framework/common/types"; +import { ConverterFunction } from "../../common/types"; +import { ARCSDVXScore } from "./types"; // There's a bunch of other useless fields but we don't care const PR_ArcSDVXScore: PrudenceSchema = { @@ -108,5 +108,4 @@ export function ResolveARCSDVXLamp(lamp: ARCSDVXScore["lamp"]): Lamps["sdvx:Sing return "PERFECT ULTIMATE CHAIN"; } - throw new InvalidScoreFailure(`Invalid lamp ${lamp} - Could not convert.`); } diff --git a/server/src/lib/score-import/import-types/common/batch-manual/converter.ts b/server/src/lib/score-import/import-types/common/batch-manual/converter.ts index 7f40371d3..2daf58cfe 100644 --- a/server/src/lib/score-import/import-types/common/batch-manual/converter.ts +++ b/server/src/lib/score-import/import-types/common/batch-manual/converter.ts @@ -1,26 +1,26 @@ -import { BatchManualContext } from "./types"; -import { ChartDocument, SongDocument, ImportTypes, BatchManualScore } from "tachi-common"; -import { - InternalFailure, - InvalidScoreFailure, - KTDataNotFoundFailure, -} from "../../../framework/common/converter-failures"; -import { FindSongOnID, FindSongOnTitleInsensitive } from "utils/queries/songs"; +import db from "external/mongo/db"; +import { KtLogger } from "lib/logger/logger"; +import { BatchManualScore, ChartDocument, ImportTypes, SongDocument } from "tachi-common"; import { FindBMSChartOnHash, FindChartWithPTDF, FindChartWithPTDFVersion, FindDDRChartOnSongHash, } from "utils/queries/charts"; +import { FindSongOnID, FindSongOnTitleInsensitive } from "utils/queries/songs"; +import { + InternalFailure, + InvalidScoreFailure, + KTDataNotFoundFailure, +} from "../../../framework/common/converter-failures"; +import { GenericGetGradeAndPercent } from "../../../framework/common/score-utils"; import { AssertStrAsDifficulty, AssertStrAsPositiveInt, } from "../../../framework/common/string-asserts"; -import { GenericGetGradeAndPercent } from "../../../framework/common/score-utils"; -import { KtLogger } from "lib/logger/logger"; import { DryScore } from "../../../framework/common/types"; import { ConverterFunction } from "../types"; -import db from "external/mongo/db"; +import { BatchManualContext } from "./types"; /** * Creates a ConverterFn for the BatchManualScore format. This curries diff --git a/server/src/lib/score-import/import-types/common/batch-manual/parser.ts b/server/src/lib/score-import/import-types/common/batch-manual/parser.ts index c6000d704..1a5976e9f 100644 --- a/server/src/lib/score-import/import-types/common/batch-manual/parser.ts +++ b/server/src/lib/score-import/import-types/common/batch-manual/parser.ts @@ -1,20 +1,20 @@ +import deepmerge from "deepmerge"; import { KtLogger } from "lib/logger/logger"; -import ScoreImportFatalError from "../../../framework/score-importing/score-import-error"; -import { BatchManualContext } from "./types"; +import { TachiConfig } from "lib/setup/config"; import p, { PrudenceSchema, ValidSchemaValue } from "prudence"; import { - Game, - ImportTypes, - GetGamePTConfig, - Playtypes, - GetGameConfig, - BatchManualScore, BatchManual, + BatchManualScore, + Game, + GetGameConfig, + GetGamePTConfig, + ImportTypes, + Playtypes, } from "tachi-common"; -import deepmerge from "deepmerge"; import { FormatPrError } from "utils/prudence"; +import ScoreImportFatalError from "../../../framework/score-importing/score-import-error"; import { ParserFunctionReturns } from "../types"; -import { TachiConfig } from "lib/setup/config"; +import { BatchManualContext } from "./types"; const optNull = (v: ValidSchemaValue) => p.optional(p.nullable(v)); diff --git a/server/src/lib/score-import/import-types/common/eamusement-iidx-csv/converter.ts b/server/src/lib/score-import/import-types/common/eamusement-iidx-csv/converter.ts index 204cc77a3..b1ba20b1c 100644 --- a/server/src/lib/score-import/import-types/common/eamusement-iidx-csv/converter.ts +++ b/server/src/lib/score-import/import-types/common/eamusement-iidx-csv/converter.ts @@ -1,9 +1,9 @@ -import { Lamps, ChartDocument } from "tachi-common"; +import { ChartDocument, Lamps } from "tachi-common"; import { FindChartWithPTDFVersion } from "utils/queries/charts"; import { FindSongOnTitle } from "utils/queries/songs"; import { - KTDataNotFoundFailure, InvalidScoreFailure, + KTDataNotFoundFailure, SkipScoreFailure, } from "../../../framework/common/converter-failures"; import { @@ -11,9 +11,9 @@ import { ParseDateFromString, } from "../../../framework/common/score-utils"; import { AssertStrAsPositiveInt } from "../../../framework/common/string-asserts"; -import { IIDXEamusementCSVContext, IIDXEamusementCSVData } from "./types"; import { DryScore } from "../../../framework/common/types"; import { ConverterFunction } from "../types"; +import { IIDXEamusementCSVContext, IIDXEamusementCSVData } from "./types"; const EAMUSEMENT_LAMP_RESOLVER: Map = new Map([ ["NO PLAY", "NO PLAY"], diff --git a/server/src/lib/score-import/import-types/common/eamusement-iidx-csv/parser.test.ts b/server/src/lib/score-import/import-types/common/eamusement-iidx-csv/parser.test.ts index 7cba65917..e027ba27c 100644 --- a/server/src/lib/score-import/import-types/common/eamusement-iidx-csv/parser.test.ts +++ b/server/src/lib/score-import/import-types/common/eamusement-iidx-csv/parser.test.ts @@ -1,9 +1,9 @@ -import t from "tap"; import CreateLogCtx from "lib/logger/logger"; +import t from "tap"; +import { MockMulterFile } from "test-utils/mock-multer"; +import { TestingIIDXEamusementCSV26, TestingIIDXEamusementCSV27 } from "test-utils/test-data"; import ScoreImportFatalError from "../../../framework/score-importing/score-import-error"; import GenericParseEamIIDXCSV, { NaiveCSVParse, ResolveHeaders } from "./parser"; -import { TestingIIDXEamusementCSV26, TestingIIDXEamusementCSV27 } from "test-utils/test-data"; -import { MockMulterFile } from "test-utils/mock-multer"; const logger = CreateLogCtx(__filename); diff --git a/server/src/lib/score-import/import-types/common/types.ts b/server/src/lib/score-import/import-types/common/types.ts index dcb178c7b..82ea2a607 100644 --- a/server/src/lib/score-import/import-types/common/types.ts +++ b/server/src/lib/score-import/import-types/common/types.ts @@ -1,29 +1,29 @@ -import { EmptyObject } from "utils/types"; import { KtLogger } from "lib/logger/logger"; +import { USCClientScore } from "server/router/ir/usc/_playtype/types"; +import { + BatchManualScore, + ChartDocument, + Game, + ImportTypes, + integer, + MongoDBDocument, + SongDocument, +} from "tachi-common"; +import { EmptyObject } from "utils/types"; +import { ConverterFailure } from "../../framework/common/converter-failures"; +import { DryScore } from "../../framework/common/types"; +import { ClassHandler } from "../../framework/user-game-stats/types"; import { MerScore } from "../file/mer-iidx/types"; import { S3Score } from "../file/solid-state-squad/types"; import { BarbatosScore } from "../ir/barbatos/types"; +import { BeatorajaContext, BeatorajaScore } from "../ir/beatoraja/types"; import { FervidexStaticContext, FervidexStaticScore } from "../ir/fervidex-static/types"; import { FervidexContext, FervidexScore } from "../ir/fervidex/types"; +import { KsHookSV3CScore } from "../ir/kshook-sv3c/types"; +import { IRUSCContext } from "../ir/usc/types"; import { KaiContext } from "./api-kai/types"; import { BatchManualContext } from "./batch-manual/types"; import { IIDXEamusementCSVContext, IIDXEamusementCSVData } from "./eamusement-iidx-csv/types"; -import { - ImportTypes, - Game, - ChartDocument, - SongDocument, - integer, - MongoDBDocument, - BatchManualScore, -} from "tachi-common"; -import { ConverterFailure } from "../../framework/common/converter-failures"; -import { DryScore } from "../../framework/common/types"; -import { BeatorajaContext, BeatorajaScore } from "../ir/beatoraja/types"; -import { IRUSCContext } from "../ir/usc/types"; -import { ClassHandler } from "../../framework/user-game-stats/types"; -import { KsHookSV3CScore } from "../ir/kshook-sv3c/types"; -import { USCClientScore } from "server/router/ir/usc/_playtype/types"; export interface ImportTypeDataMap { "file/eamusement-iidx-csv": IIDXEamusementCSVData; diff --git a/server/src/lib/score-import/import-types/ir/barbatos/converter.ts b/server/src/lib/score-import/import-types/ir/barbatos/converter.ts index fe8bcc0ec..64f1d0e6b 100644 --- a/server/src/lib/score-import/import-types/ir/barbatos/converter.ts +++ b/server/src/lib/score-import/import-types/ir/barbatos/converter.ts @@ -1,15 +1,15 @@ +import { Lamps } from "tachi-common"; import { FindSDVXChartOnInGameID } from "utils/queries/charts"; import { FindSongOnID } from "utils/queries/songs"; import { EmptyObject } from "utils/types"; -import { GenericGetGradeAndPercent } from "../../../framework/common/score-utils"; import { InternalFailure, KTDataNotFoundFailure, } from "../../../framework/common/converter-failures"; -import { BarbatosScore } from "./types"; -import { Lamps } from "tachi-common"; +import { GenericGetGradeAndPercent } from "../../../framework/common/score-utils"; import { DryScore } from "../../../framework/common/types"; import { ConverterFunction } from "../../common/types"; +import { BarbatosScore } from "./types"; const LAMP_LOOKUP = { 1: "FAILED", diff --git a/server/src/lib/score-import/import-types/ir/barbatos/parser.test.ts b/server/src/lib/score-import/import-types/ir/barbatos/parser.test.ts index 8233cd668..f654fd838 100644 --- a/server/src/lib/score-import/import-types/ir/barbatos/parser.test.ts +++ b/server/src/lib/score-import/import-types/ir/barbatos/parser.test.ts @@ -1,8 +1,7 @@ +import CreateLogCtx from "lib/logger/logger"; import t from "tap"; - import ResetDBState from "test-utils/resets"; import { barbScore } from "test-utils/test-data"; -import CreateLogCtx from "lib/logger/logger"; import { ParseBarbatosSingle } from "./parser"; const logger = CreateLogCtx(__filename); diff --git a/server/src/lib/score-import/import-types/ir/beatoraja/parser.ts b/server/src/lib/score-import/import-types/ir/beatoraja/parser.ts index 6ce0b5f92..d02677d75 100644 --- a/server/src/lib/score-import/import-types/ir/beatoraja/parser.ts +++ b/server/src/lib/score-import/import-types/ir/beatoraja/parser.ts @@ -1,10 +1,10 @@ import { KtLogger } from "lib/logger/logger"; import p from "prudence"; -import ScoreImportFatalError from "../../../framework/score-importing/score-import-error"; -import { FormatPrError } from "utils/prudence"; -import { BeatorajaChart, BeatorajaContext, BeatorajaScore } from "./types"; -import { ParserFunctionReturns } from "../../common/types"; import { integer } from "tachi-common"; +import { FormatPrError } from "utils/prudence"; +import ScoreImportFatalError from "../../../framework/score-importing/score-import-error"; +import { ParserFunctionReturns } from "../../common/types"; +import { BeatorajaChart, BeatorajaContext, BeatorajaScore } from "./types"; const PR_BeatorajaScore = { sha256: "string", diff --git a/server/src/lib/score-import/import-types/ir/fervidex/converter.ts b/server/src/lib/score-import/import-types/ir/fervidex/converter.ts index 59a7f5aef..43d5284ea 100644 --- a/server/src/lib/score-import/import-types/ir/fervidex/converter.ts +++ b/server/src/lib/score-import/import-types/ir/fervidex/converter.ts @@ -1,15 +1,15 @@ +import { Difficulties, Lamps, Playtypes } from "tachi-common"; +import { FindIIDXChartOnInGameIDVersion, FindIIDXChartWith2DXtraHash } from "utils/queries/charts"; import { FindSongOnID } from "utils/queries/songs"; -import { GenericGetGradeAndPercent } from "../../../framework/common/score-utils"; import { InternalFailure, InvalidScoreFailure, KTDataNotFoundFailure, } from "../../../framework/common/converter-failures"; -import { FervidexContext, FervidexScore } from "./types"; -import { Lamps, Difficulties, Playtypes } from "tachi-common"; -import { FindIIDXChartOnInGameIDVersion, FindIIDXChartWith2DXtraHash } from "utils/queries/charts"; -import { ConverterFunction } from "../../common/types"; +import { GenericGetGradeAndPercent } from "../../../framework/common/score-utils"; import { DryScore } from "../../../framework/common/types"; +import { ConverterFunction } from "../../common/types"; +import { FervidexContext, FervidexScore } from "./types"; export const FERVIDEX_LAMP_LOOKUP = { 0: "NO PLAY", diff --git a/server/src/lib/score-import/import-types/ir/fervidex/parser.ts b/server/src/lib/score-import/import-types/ir/fervidex/parser.ts index 6fa1b2fcf..be162253a 100644 --- a/server/src/lib/score-import/import-types/ir/fervidex/parser.ts +++ b/server/src/lib/score-import/import-types/ir/fervidex/parser.ts @@ -1,9 +1,3 @@ -import { KtLogger } from "lib/logger/logger"; -import p, { PrudenceSchema, ValidSchemaValue } from "prudence"; -import ScoreImportFatalError from "../../../framework/score-importing/score-import-error"; -import { FormatPrError, optNull } from "utils/prudence"; -import { FervidexContext, FervidexScore } from "./types"; -import { ParseEA3SoftID } from "utils/ea3id"; import { EXT_HEROIC_VERSE, MODEL_IIDX, @@ -11,7 +5,13 @@ import { REV_2DXTRA, REV_OMNIMIX, } from "lib/constants/ea3id"; +import { KtLogger } from "lib/logger/logger"; +import p, { PrudenceSchema, ValidSchemaValue } from "prudence"; +import { ParseEA3SoftID } from "utils/ea3id"; +import { FormatPrError, optNull } from "utils/prudence"; +import ScoreImportFatalError from "../../../framework/score-importing/score-import-error"; import { ParserFunctionReturns } from "../../common/types"; +import { FervidexContext, FervidexScore } from "./types"; const PR_Fervidex: PrudenceSchema = { chart: p.isIn("spb", "spn", "dpn", "sph", "dph", "spa", "dpa", "spl", "dpl"), diff --git a/server/src/server/middleware/rate-limiter.ts b/server/src/server/middleware/rate-limiter.ts index b5c9c683c..185aecbbf 100644 --- a/server/src/server/middleware/rate-limiter.ts +++ b/server/src/server/middleware/rate-limiter.ts @@ -1,8 +1,8 @@ -import RateLimitRedis from "rate-limit-redis"; -import { Environment, ServerConfig, TachiConfig } from "lib/setup/config"; import rateLimit from "express-rate-limit"; -import CreateLogCtx from "lib/logger/logger"; import { RedisClient } from "external/redis/redis"; +import CreateLogCtx from "lib/logger/logger"; +import { Environment, ServerConfig, TachiConfig } from "lib/setup/config"; +import RateLimitRedis from "rate-limit-redis"; const logger = CreateLogCtx(__filename); diff --git a/server/src/server/middleware/type-require.ts b/server/src/server/middleware/type-require.ts index 9fba564eb..7e0662837 100644 --- a/server/src/server/middleware/type-require.ts +++ b/server/src/server/middleware/type-require.ts @@ -1,5 +1,5 @@ -import { TachiConfig } from "lib/setup/config"; import { RequestHandler } from "express"; +import { TachiConfig } from "lib/setup/config"; /** * Middleware that makes the route only available under Bokutachi. diff --git a/server/src/server/router/api/v1/auth/router.ts b/server/src/server/router/api/v1/auth/router.ts index 0deb3ac25..925c24a77 100644 --- a/server/src/server/router/api/v1/auth/router.ts +++ b/server/src/server/router/api/v1/auth/router.ts @@ -1,15 +1,14 @@ import { Router } from "express"; +import db from "external/mongo/db"; +import { SendEmail } from "lib/email/client"; +import { EmailFormatResetPassword, EmailFormatVerifyEmail } from "lib/email/formats"; +import CreateLogCtx from "lib/logger/logger"; +import { Environment, ServerConfig } from "lib/setup/config"; import Prudence from "prudence"; -import { - AddNewUser, - PasswordCompare, - ReinstateInvite, - ValidatePassword, - ValidateCaptcha, - MountAuthCookie, - InsertDefaultUserSettings, - HashPassword, -} from "./auth"; +import prValidate from "server/middleware/prudence-validate"; +import { integer } from "tachi-common"; +import { DecrementCounterValue, GetNextCounterValue } from "utils/db"; +import { Random20Hex } from "utils/misc"; import { CheckIfEmailInUse, FormatUserDoc, @@ -18,15 +17,16 @@ import { GetUserPrivateInfo, GetUserWithID, } from "utils/user"; -import db from "external/mongo/db"; -import CreateLogCtx from "lib/logger/logger"; -import prValidate from "server/middleware/prudence-validate"; -import { DecrementCounterValue, GetNextCounterValue } from "utils/db"; -import { SendEmail } from "lib/email/client"; -import { EmailFormatResetPassword, EmailFormatVerifyEmail } from "lib/email/formats"; -import { Random20Hex } from "utils/misc"; -import { Environment, ServerConfig } from "lib/setup/config"; -import { integer } from "tachi-common"; +import { + AddNewUser, + HashPassword, + InsertDefaultUserSettings, + MountAuthCookie, + PasswordCompare, + ReinstateInvite, + ValidateCaptcha, + ValidatePassword, +} from "./auth"; const logger = CreateLogCtx(__filename); diff --git a/server/src/server/router/api/v1/clients/middleware.test.ts b/server/src/server/router/api/v1/clients/middleware.test.ts index db836dd1c..e86217167 100644 --- a/server/src/server/router/api/v1/clients/middleware.test.ts +++ b/server/src/server/router/api/v1/clients/middleware.test.ts @@ -1,8 +1,8 @@ -import t from "tap"; -import { GetClientFromID, RequireOwnershipOfClient } from "./middleware"; import expMiddlewareMock from "express-request-mock"; -import ResetDBState from "test-utils/resets"; import { SYMBOL_TachiData } from "lib/constants/tachi"; +import t from "tap"; +import ResetDBState from "test-utils/resets"; +import { GetClientFromID, RequireOwnershipOfClient } from "./middleware"; t.test("#GetClientFromID", (t) => { t.beforeEach(ResetDBState); diff --git a/server/src/server/router/api/v1/clients/router.test.ts b/server/src/server/router/api/v1/clients/router.test.ts index 9d98e0748..717b9cd67 100644 --- a/server/src/server/router/api/v1/clients/router.test.ts +++ b/server/src/server/router/api/v1/clients/router.test.ts @@ -1,12 +1,12 @@ import db from "external/mongo/db"; -import { UserAuthLevels, APITokenDocument, TachiAPIClientDocument } from "tachi-common"; import { ServerConfig } from "lib/setup/config"; - +import { APITokenDocument, TachiAPIClientDocument } from "tachi-common"; import t from "tap"; import { CreateFakeAuthCookie } from "test-utils/fake-auth"; import mockApi from "test-utils/mock-api"; import ResetDBState from "test-utils/resets"; + const clientDataset: TachiAPIClientDocument[] = [ { author: 1, diff --git a/server/src/server/router/api/v1/clients/router.ts b/server/src/server/router/api/v1/clients/router.ts index 758ecda93..bafefc351 100644 --- a/server/src/server/router/api/v1/clients/router.ts +++ b/server/src/server/router/api/v1/clients/router.ts @@ -1,16 +1,16 @@ import { Router } from "express"; -import { SYMBOL_TachiData } from "lib/constants/tachi"; -import prValidate from "server/middleware/prudence-validate"; -import p from "prudence"; import db from "external/mongo/db"; -import { GetClientFromID, RequireOwnershipOfClient } from "./middleware"; -import { DedupeArr, DeleteUndefinedProps, IsValidURL, Random20Hex } from "utils/misc"; +import { SYMBOL_TachiData } from "lib/constants/tachi"; import CreateLogCtx from "lib/logger/logger"; -import { APIPermissions, TachiAPIClientDocument, UserAuthLevels } from "tachi-common"; -import { AllPermissions } from "server/middleware/auth"; import { ServerConfig } from "lib/setup/config"; -import { FormatUserDoc } from "utils/user"; +import p from "prudence"; +import { AllPermissions } from "server/middleware/auth"; +import prValidate from "server/middleware/prudence-validate"; +import { APIPermissions, TachiAPIClientDocument, UserAuthLevels } from "tachi-common"; +import { DedupeArr, DeleteUndefinedProps, IsValidURL, Random20Hex } from "utils/misc"; import { optNull } from "utils/prudence"; +import { FormatUserDoc } from "utils/user"; +import { GetClientFromID, RequireOwnershipOfClient } from "./middleware"; const logger = CreateLogCtx(__filename); diff --git a/server/src/server/router/api/v1/games/router.test.ts b/server/src/server/router/api/v1/games/router.test.ts index 5fad61e8b..d839db3f6 100644 --- a/server/src/server/router/api/v1/games/router.test.ts +++ b/server/src/server/router/api/v1/games/router.test.ts @@ -1,9 +1,9 @@ +import { TachiConfig } from "lib/setup/config"; import { GetGameConfig } from "tachi-common"; import t from "tap"; -import { TachiConfig } from "lib/setup/config"; - import mockApi from "test-utils/mock-api"; + t.test("GET /api/v1/games", async (t) => { // lets just run some basic tests that this contains all of our supported games // and also returns configs properly. diff --git a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/folders/_folderID/router.test.ts b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/folders/_folderID/router.test.ts index 828a42e49..f23b243c8 100644 --- a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/folders/_folderID/router.test.ts +++ b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/folders/_folderID/router.test.ts @@ -1,11 +1,10 @@ -import t from "tap"; -import db from "external/mongo/db"; - -import ResetDBState from "test-utils/resets"; import deepmerge from "deepmerge"; -import { Testing511SPA, TestingIIDXFolderSP10, TestingIIDXSPScorePB } from "test-utils/test-data"; +import db from "external/mongo/db"; import { FolderDocument } from "tachi-common"; +import t from "tap"; import mockApi from "test-utils/mock-api"; +import ResetDBState from "test-utils/resets"; +import { Testing511SPA, TestingIIDXFolderSP10, TestingIIDXSPScorePB } from "test-utils/test-data"; import { CreateFolderChartLookup } from "utils/folder"; t.test("GET /api/v1/users/:userID/games/:game/:playtype/folders/:folderID", (t) => { diff --git a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/folders/_folderID/router.ts b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/folders/_folderID/router.ts index d111e9e64..981af9858 100644 --- a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/folders/_folderID/router.ts +++ b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/folders/_folderID/router.ts @@ -1,8 +1,8 @@ -import { FilterQuery } from "mongodb"; -import { GetGamePTConfig, ScoreDocument } from "tachi-common"; import { Router } from "express"; import db from "external/mongo/db"; import { SYMBOL_TachiData } from "lib/constants/tachi"; +import { FilterQuery } from "mongodb"; +import { GetGamePTConfig, ScoreDocument } from "tachi-common"; import { GetFolderCharts, GetPBsOnFolder } from "utils/folder"; import { ParseStrPositiveInt } from "utils/string-checks"; import { GetFolderFromParam } from "../../../../../../../games/_game/_playtype/folders/middleware"; diff --git a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/pbs/router.test.ts b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/pbs/router.test.ts index a2788f0c9..9b00e7038 100644 --- a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/pbs/router.test.ts +++ b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/pbs/router.test.ts @@ -1,16 +1,15 @@ -import t from "tap"; import db from "external/mongo/db"; - +import { PBScoreDocument } from "tachi-common"; +import t from "tap"; import mockApi from "test-utils/mock-api"; import ResetDBState from "test-utils/resets"; import { - Testing511Song, - LoadTachiIIDXData, GetKTDataJSON, - TestingIIDXSPScorePB, + LoadTachiIIDXData, + Testing511Song, Testing511SPA, + TestingIIDXSPScorePB, } from "test-utils/test-data"; -import { PBScoreDocument } from "tachi-common"; t.test("GET /api/v1/users/:userID/games/:game/:playtype/pbs/best", (t) => { t.beforeEach(ResetDBState); diff --git a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/pbs/router.ts b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/pbs/router.ts index 01d1278ed..3e3889062 100644 --- a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/pbs/router.ts +++ b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/pbs/router.ts @@ -2,11 +2,11 @@ import { Router } from "express"; import db from "external/mongo/db"; import { SYMBOL_TachiData } from "lib/constants/tachi"; import { SearchGameSongsAndCharts } from "lib/search/search"; -import { GetRelevantSongsAndCharts } from "utils/db"; -import { FilterChartsAndSongs, GetScoreIDsFromComposed } from "utils/scores"; import { GetGamePTConfig } from "tachi-common"; +import { GetRelevantSongsAndCharts } from "utils/db"; import { IsValidScoreAlg } from "utils/misc"; import { GetAdjacentAbove, GetAdjacentBelow } from "utils/queries/pbs"; +import { FilterChartsAndSongs, GetScoreIDsFromComposed } from "utils/scores"; import { GetUsersWithIDs } from "utils/user"; const router: Router = Router({ mergeParams: true }); diff --git a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.test.ts b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.test.ts index 3e76537ab..89407a559 100644 --- a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.test.ts +++ b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/router.test.ts @@ -1,17 +1,16 @@ -import t from "tap"; +import deepmerge from "deepmerge"; import db from "external/mongo/db"; - -import mockApi from "test-utils/mock-api"; -import ResetDBState from "test-utils/resets"; import { - ScoreDocument, - UserGoalDocument, GoalDocument, MilestoneDocument, + ScoreDocument, + UserGoalDocument, UserMilestoneDocument, } from "tachi-common"; +import t from "tap"; +import mockApi from "test-utils/mock-api"; +import ResetDBState from "test-utils/resets"; import { Testing511SPA, TestingIIDXSPScore, TestingIIDXSPScorePB } from "test-utils/test-data"; -import deepmerge from "deepmerge"; t.test("GET /api/v1/users/:userID/games/:game/:playtype", (t) => { t.beforeEach(ResetDBState); 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 542638e1e..c2c5d672a 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 @@ -1,6 +1,17 @@ import { Router } from "express"; import db from "external/mongo/db"; import { SYMBOL_TachiData } from "lib/constants/tachi"; +import { FilterQuery } from "mongodb"; +import { + GetGamePTConfig, + integer, + PBScoreDocument, + UserGameStatsSnapshot, + UserGoalDocument, + UserMilestoneDocument, +} from "tachi-common"; +import { IsString } from "utils/misc"; +import { CheckStrProfileAlg } from "utils/string-checks"; import { GetAllRankings, GetUGPTPlaycount, @@ -8,25 +19,14 @@ import { GetUsersRankingAndOutOf, GetUsersWithIDs, } from "utils/user"; -import { CheckUserPlayedGamePlaytype } from "./middleware"; -import { FilterQuery } from "mongodb"; -import { - UserGoalDocument, - UserMilestoneDocument, - GetGamePTConfig, - integer, - PBScoreDocument, - UserGameStatsSnapshot, -} from "tachi-common"; -import { CheckStrProfileAlg } from "utils/string-checks"; -import { IsString } from "utils/misc"; -import pbsRouter from "./pbs/router"; -import sessionsRouter from "./sessions/router"; import foldersRouter from "./folders/router"; -import tablesRouter from "./tables/router"; -import showcaseRouter from "./showcase/router"; -import settingsRouter from "./settings/router"; +import { CheckUserPlayedGamePlaytype } from "./middleware"; +import pbsRouter from "./pbs/router"; import scoresRouter from "./scores/router"; +import sessionsRouter from "./sessions/router"; +import settingsRouter from "./settings/router"; +import showcaseRouter from "./showcase/router"; +import tablesRouter from "./tables/router"; const router: Router = Router({ mergeParams: true }); diff --git a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/scores/router.test.ts b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/scores/router.test.ts index 778fce5cd..573f44b9b 100644 --- a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/scores/router.test.ts +++ b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/scores/router.test.ts @@ -1,14 +1,13 @@ import db from "external/mongo/db"; import { ScoreDocument } from "tachi-common"; import t from "tap"; - import mockApi from "test-utils/mock-api"; import ResetDBState from "test-utils/resets"; import { - Testing511SPA, - Testing511Song, - LoadTachiIIDXData, GetKTDataJSON, + LoadTachiIIDXData, + Testing511Song, + Testing511SPA, } from "test-utils/test-data"; t.test("GET /api/v1/users/:userID/games/:game/:playtype/scores/recent", (t) => { diff --git a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/sessions/router.test.ts b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/sessions/router.test.ts index 0af564941..f6d76180e 100644 --- a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/sessions/router.test.ts +++ b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/sessions/router.test.ts @@ -1,10 +1,9 @@ -import t from "tap"; import db from "external/mongo/db"; - +import { SessionDocument } from "tachi-common"; +import t from "tap"; import mockApi from "test-utils/mock-api"; import ResetDBState from "test-utils/resets"; import { LoadTachiIIDXData } from "test-utils/test-data"; -import { SessionDocument } from "tachi-common"; t.test("GET /api/v1/users/:userID/games/:game/:playtype/sessions", (t) => { t.beforeEach(ResetDBState); diff --git a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/settings/router.ts b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/settings/router.ts index f74f217f9..07184799e 100644 --- a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/settings/router.ts +++ b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/settings/router.ts @@ -1,11 +1,11 @@ -import { GetGamePTConfig } from "tachi-common"; import { Router } from "express"; -import { SYMBOL_TachiData } from "lib/constants/tachi"; -import { RequirePermissions } from "server/middleware/auth"; -import p from "prudence"; -import { FormatPrError } from "utils/prudence"; 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"; +import { GetGamePTConfig } from "tachi-common"; +import { FormatPrError } from "utils/prudence"; import { FormatUserDoc } from "utils/user"; import { RequireAuthedAsUser } from "../../../../middleware"; diff --git a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/tables/router.test.ts b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/tables/router.test.ts index d24275671..5263e6d23 100644 --- a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/tables/router.test.ts +++ b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/tables/router.test.ts @@ -1,11 +1,10 @@ -import t from "tap"; +import deepmerge from "deepmerge"; import db from "external/mongo/db"; - +import { FolderDocument } from "tachi-common"; +import t from "tap"; import mockApi from "test-utils/mock-api"; import ResetDBState from "test-utils/resets"; import { TestingIIDXFolderSP10, TestingIIDXSPScorePB } from "test-utils/test-data"; -import deepmerge from "deepmerge"; -import { FolderDocument } from "tachi-common"; import { CreateFolderChartLookup } from "utils/folder"; t.test("GET /api/v1/users/:userID/games/:game/:playtype/tables/:tableID", (t) => { diff --git a/server/src/server/router/ir/fervidex/router.ts b/server/src/server/router/ir/fervidex/router.ts index 501233f35..7ca9d87c7 100644 --- a/server/src/server/router/ir/fervidex/router.ts +++ b/server/src/server/router/ir/fervidex/router.ts @@ -4,13 +4,10 @@ import { EXT_HEROIC_VERSE, MODEL_INFINITAS_2, REV_2DXBMS } from "lib/constants/e import { SYMBOL_TachiAPIAuth } from "lib/constants/tachi"; import CreateLogCtx from "lib/logger/logger"; import { ExpressWrappedScoreImportMain } from "lib/score-import/framework/express-wrapper"; -import { ParseFervidexStatic } from "lib/score-import/import-types/ir/fervidex-static/parser"; -import { ParseFervidexSingle } from "lib/score-import/import-types/ir/fervidex/parser"; import { RequirePermissions } from "server/middleware/auth"; import { integer, Playtypes } from "tachi-common"; import { UpdateClassIfGreater } from "utils/class"; import { ParseEA3SoftID } from "utils/ea3id"; -import { GetUserWithIDGuaranteed } from "utils/user"; const logger = CreateLogCtx(__filename); diff --git a/server/src/server/router/ir/kshook/sv3c/router.ts b/server/src/server/router/ir/kshook/sv3c/router.ts index 4e6bfaf98..521e3be7c 100644 --- a/server/src/server/router/ir/kshook/sv3c/router.ts +++ b/server/src/server/router/ir/kshook/sv3c/router.ts @@ -1,11 +1,9 @@ -import { Router, RequestHandler } from "express"; +import { RequestHandler, Router } from "express"; import { MODEL_SDVX3_KONASTE } from "lib/constants/ea3id"; import { SYMBOL_TachiAPIAuth } from "lib/constants/tachi"; import CreateLogCtx from "lib/logger/logger"; import { ExpressWrappedScoreImportMain } from "lib/score-import/framework/express-wrapper"; -import { ParseKsHookSV3C } from "lib/score-import/import-types/ir/kshook-sv3c/parser"; import { ParseEA3SoftID } from "utils/ea3id"; -import { GetUserWithIDGuaranteed } from "utils/user"; const router: Router = Router({ mergeParams: true }); diff --git a/server/src/utils/class.ts b/server/src/utils/class.ts index 1b857235f..bcbbd9602 100644 --- a/server/src/utils/class.ts +++ b/server/src/utils/class.ts @@ -1,9 +1,9 @@ -import { Game, integer, IDStrings, Playtypes, UserGameStats } from "tachi-common"; import db from "external/mongo/db"; -import CreateLogCtx from "lib/logger/logger"; -import { GameClassSets } from "tachi-common/js/game-classes"; import { CreateGameSettings } from "lib/game-settings/create-game-settings"; +import CreateLogCtx from "lib/logger/logger"; import { EmitWebhookEvent } from "lib/webhooks/webhooks"; +import { Game, IDStrings, integer, Playtypes, UserGameStats } from "tachi-common"; +import { GameClassSets } from "tachi-common/js/game-classes"; const logger = CreateLogCtx(__filename); diff --git a/server/src/utils/db.ts b/server/src/utils/db.ts index 0ec029c08..4f5ebe8b2 100644 --- a/server/src/utils/db.ts +++ b/server/src/utils/db.ts @@ -1,7 +1,7 @@ import db from "external/mongo/db"; import CreateLogCtx from "lib/logger/logger"; +import { Game, integer, PBScoreDocument, ScoreDocument } from "tachi-common"; const logger = CreateLogCtx(__filename); -import { integer, Game, ScoreDocument, PBScoreDocument } from "tachi-common"; export async function GetNextCounterValue(counterName: string): Promise { const sequenceDoc = await db.counters.findOneAndUpdate( diff --git a/server/src/utils/milestone.ts b/server/src/utils/milestone.ts index 70391eb09..f97d4374b 100644 --- a/server/src/utils/milestone.ts +++ b/server/src/utils/milestone.ts @@ -1,4 +1,4 @@ -import { MilestoneDocument, integer } from "tachi-common"; +import { integer, MilestoneDocument } from "tachi-common"; /** * Retrieves the goalID documents in a single array from the diff --git a/server/src/utils/session.test.ts b/server/src/utils/session.test.ts index 24dbac1a7..23993c609 100644 --- a/server/src/utils/session.test.ts +++ b/server/src/utils/session.test.ts @@ -1,9 +1,9 @@ -import t from "tap"; import db from "external/mongo/db"; - +import t from "tap"; import ResetDBState from "test-utils/resets"; import { GetScoresFromSession } from "./session"; + t.test("#GetScoresFromSession", async (t) => { t.beforeEach(ResetDBState); diff --git a/server/src/utils/session.ts b/server/src/utils/session.ts index adbc4de6b..6c54a1b09 100644 --- a/server/src/utils/session.ts +++ b/server/src/utils/session.ts @@ -1,6 +1,6 @@ -import { SessionDocument, ScoreDocument, SessionScoreInfo } from "tachi-common"; -import { Condition } from "mongodb"; import db from "external/mongo/db"; +import { Condition } from "mongodb"; +import { ScoreDocument, SessionDocument, SessionScoreInfo } from "tachi-common"; /** * Returns all the score documents inside a session. diff --git a/server/src/utils/string-checks.ts b/server/src/utils/string-checks.ts index 0a11bae1f..e40fe2087 100644 --- a/server/src/utils/string-checks.ts +++ b/server/src/utils/string-checks.ts @@ -1,4 +1,4 @@ -import { Game, Playtypes, GetGamePTConfig, GamePTConfig } from "tachi-common"; +import { Game, GamePTConfig, GetGamePTConfig, Playtypes } from "tachi-common"; import { IsString } from "./misc"; const isIntegerRegex = /^-?\d+$/u; diff --git a/server/src/utils/user.ts b/server/src/utils/user.ts index 8a0c66639..a4e7fe3b7 100644 --- a/server/src/utils/user.ts +++ b/server/src/utils/user.ts @@ -1,16 +1,9 @@ -import { - integer, - PublicUserDocument, - UserGameStats, - GetGamePTConfig, - Game, - Playtypes, - UGSRatingsLookup, - IDStrings, -} from "tachi-common"; -import { FindOneResult } from "monk"; import db from "external/mongo/db"; import CreateLogCtx from "lib/logger/logger"; +import { FindOneResult } from "monk"; +import { + Game, GetGamePTConfig, IDStrings, integer, Playtypes, PublicUserDocument, UGSRatingsLookup, UserGameStats +} from "tachi-common"; const logger = CreateLogCtx(__filename);