refactor getAccountCheats() as an internal method

This commit is contained in:
AlexisinGit 2025-08-31 10:58:06 +08:00
parent 859278df37
commit 049153134f
3 changed files with 8 additions and 14 deletions

View File

@ -18,7 +18,7 @@ import {
import { getJSONfromString } from "../../helpers/stringHelpers.ts";
import type { TInventoryDatabaseDocument } from "../../models/inventoryModels/inventoryModel.ts";
import { Loadout } from "../../models/inventoryModels/loadoutModel.ts";
import { addMods, freeUpSlot, getInventory, getAccountCheats } from "../../services/inventoryService.ts";
import { addMods, freeUpSlot, getInventory } from "../../services/inventoryService.ts";
import { getAccountForRequest } from "../../services/loginService.ts";
import { SRng } from "../../services/rngService.ts";
import type { IMongoDate, IOid } from "../../types/commonTypes.ts";
@ -30,7 +30,8 @@ import type {
IUpgradeClient,
IWeaponSkinClient,
TEquipmentKey,
TNemesisFaction
TNemesisFaction,
IAccountCheats
} from "../../types/inventoryTypes/inventoryTypes.ts";
import { InventorySlot, LoadoutIndex } from "../../types/inventoryTypes/inventoryTypes.ts";
import { logger } from "../../utils/logger.ts";
@ -39,7 +40,9 @@ import { Types } from "mongoose";
export const nemesisController: RequestHandler = async (req, res) => {
const account = await getAccountForRequest(req);
const accountCheats = await getAccountCheats(account._id.toString());
const cheatProperties = Object.keys({} as IAccountCheats) as Array<keyof IAccountCheats>;
const accountCheats = await getInventory(account._id.toString(), cheatProperties.join(" "));
if ((req.query.mode as string) == "f") {
const body = getJSONfromString<IValenceFusionRequest>(String(req.body));
const inventory = await getInventory(account._id.toString(), body.Category + " WeaponBin");

View File

@ -26,8 +26,7 @@ import type {
INemesisWeaponTargetFingerprint,
INemesisPetTargetFingerprint,
IDialogueDatabase,
IKubrowPetPrintClient,
IAccountCheats
IKubrowPetPrintClient
} from "../types/inventoryTypes/inventoryTypes.ts";
import { InventorySlot, equipmentKeys } from "../types/inventoryTypes/inventoryTypes.ts";
import type { IGenericUpdate, IUpdateNodeIntrosResponse } from "../types/genericUpdate.ts";
@ -267,13 +266,6 @@ export const getInventory = async (
return inventory;
};
export const getAccountCheats = async (accountOwnerId: string): Promise<Partial<IAccountCheats>> => {
const cheatProperties = Object.keys({} as IAccountCheats) as Array<keyof IAccountCheats>;
const inventoryWithCheats = await getInventory(accountOwnerId, cheatProperties.join(" "));
return inventoryWithCheats;
};
export const productCategoryToInventoryBin = (productCategory: string): InventorySlot | undefined => {
switch (productCategory) {
case "Suits":

View File

@ -35,7 +35,6 @@ import {
addStanding,
applyClientEquipmentUpdates,
combineInventoryChanges,
getAccountCheats,
getDialogue,
giveNemesisPetRecipe,
giveNemesisWeaponRecipe,