forked from OpenWF/SpaceNinjaServer
		
	fix lint
This commit is contained in:
		
							parent
							
								
									0af98bc6c2
								
							
						
					
					
						commit
						fd2027b071
					
				@ -11,4 +11,4 @@ export const giveStartingGearController: RequestHandler = async (req, res) => {
 | 
			
		||||
    console.log(req.query);
 | 
			
		||||
    await inventory.save();
 | 
			
		||||
    res.status(200);
 | 
			
		||||
};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,6 @@ import { toInventoryResponse } from "@/src/helpers/inventoryHelpers";
 | 
			
		||||
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
 | 
			
		||||
import { config } from "@/src/services/configService";
 | 
			
		||||
import { IInventoryDatabase } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
			
		||||
import { ExportCustoms, ExportFlavour } from "warframe-public-export-plus";
 | 
			
		||||
 | 
			
		||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
			
		||||
const inventoryController: RequestHandler = async (request, response) => {
 | 
			
		||||
 | 
			
		||||
@ -57,8 +57,10 @@ const missionInventoryUpdateController: RequestHandler = async (req, res): Promi
 | 
			
		||||
 | 
			
		||||
        const { InventoryChanges, MissionRewards } = getRewards(lootInventory);
 | 
			
		||||
 | 
			
		||||
        const { combinedInventoryChanges, TotalCredits, CreditsBonus, MissionCredits } =
 | 
			
		||||
            combineRewardAndLootInventory(InventoryChanges, lootInventory);
 | 
			
		||||
        const { combinedInventoryChanges, TotalCredits, CreditsBonus, MissionCredits } = combineRewardAndLootInventory(
 | 
			
		||||
            InventoryChanges,
 | 
			
		||||
            lootInventory
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        // eslint-disable-next-line @typescript-eslint/no-unused-vars
 | 
			
		||||
        const InventoryJson = JSON.stringify(await missionInventoryUpdate(combinedInventoryChanges, accountId));
 | 
			
		||||
 | 
			
		||||
@ -1,14 +1,9 @@
 | 
			
		||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
			
		||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
			
		||||
import { getInventory } from "@/src/services/inventoryService";
 | 
			
		||||
import { IMongoDate } from "@/src/types/commonTypes";
 | 
			
		||||
import { RequestHandler } from "express";
 | 
			
		||||
import { unixTimesInMs } from "@/src/constants/timeConstants";
 | 
			
		||||
 | 
			
		||||
interface ITrainingResultsRequest {
 | 
			
		||||
    numLevelsGained: number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface ITrainingResultsResponse {
 | 
			
		||||
    NewTrainingDate: IMongoDate;
 | 
			
		||||
    NewLevel: number;
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
			
		||||
import { RequestHandler } from "express";
 | 
			
		||||
import { getInventory, missionInventoryUpdate } from "@/src/services/inventoryService";
 | 
			
		||||
import { missionInventoryUpdate } from "@/src/services/inventoryService";
 | 
			
		||||
import { combineRewardAndLootInventory } from "@/src/services/missionInventoryUpdateService";
 | 
			
		||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
			
		||||
import { IMissionInventoryUpdateRequest } from "@/src/types/requestTypes";
 | 
			
		||||
@ -8,9 +8,11 @@ import { IMissionInventoryUpdateRequest } from "@/src/types/requestTypes";
 | 
			
		||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
			
		||||
export const updateInventoryController: RequestHandler = async (req, res) => {
 | 
			
		||||
    const accountId = await getAccountIdForRequest(req);
 | 
			
		||||
    const lootInventory = getJSONfromString(req.body.toString()) as IMissionInventoryUpdateRequest;
 | 
			
		||||
    const { combinedInventoryChanges, TotalCredits, CreditsBonus, MissionCredits } =
 | 
			
		||||
    combineRewardAndLootInventory(lootInventory, lootInventory);
 | 
			
		||||
    const lootInventory = getJSONfromString(req.body as string) as IMissionInventoryUpdateRequest;
 | 
			
		||||
    const { combinedInventoryChanges, TotalCredits, CreditsBonus, MissionCredits } = combineRewardAndLootInventory(
 | 
			
		||||
        lootInventory,
 | 
			
		||||
        lootInventory
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    await missionInventoryUpdate(combinedInventoryChanges, accountId);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -694,17 +694,7 @@ const addMissionComplete = (inventory: IInventoryDatabaseDocument, { Tag, Comple
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const missionInventoryUpdate = async (data: IMissionInventoryUpdateRequest, accountId: string) => {
 | 
			
		||||
    const {
 | 
			
		||||
        RawUpgrades,
 | 
			
		||||
        MiscItems,
 | 
			
		||||
        RegularCredits,
 | 
			
		||||
        ChallengeProgress,
 | 
			
		||||
        FusionPoints,
 | 
			
		||||
        Consumables,
 | 
			
		||||
        Recipes,
 | 
			
		||||
        Missions,
 | 
			
		||||
        FusionTreasures
 | 
			
		||||
    } = data;
 | 
			
		||||
    const { RawUpgrades, MiscItems, RegularCredits, ChallengeProgress, Consumables, Recipes, Missions } = data;
 | 
			
		||||
    const inventory = await getInventory(accountId);
 | 
			
		||||
 | 
			
		||||
    // credits
 | 
			
		||||
 | 
			
		||||
@ -86,7 +86,7 @@ const combineRewardAndLootInventory = (
 | 
			
		||||
        combinedInventoryChanges: lootInventory,
 | 
			
		||||
        TotalCredits: [totalCredits, totalCredits],
 | 
			
		||||
        CreditsBonus: [creditsBonus, creditsBonus],
 | 
			
		||||
        MissionCredits: [missionCredits, missionCredits],
 | 
			
		||||
        MissionCredits: [missionCredits, missionCredits]
 | 
			
		||||
    };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -23,17 +23,9 @@ export type IBinChanges = {
 | 
			
		||||
    Extra?: number;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export type SlotPurchaseName =
 | 
			
		||||
    | "SuitSlotItem"
 | 
			
		||||
    | "TwoSentinelSlotItem"
 | 
			
		||||
    | "TwoWeaponSlotItem";
 | 
			
		||||
export type SlotPurchaseName = "SuitSlotItem" | "TwoSentinelSlotItem" | "TwoWeaponSlotItem";
 | 
			
		||||
 | 
			
		||||
export type SlotNames =
 | 
			
		||||
    | "SuitBin"
 | 
			
		||||
    | "WeaponBin"
 | 
			
		||||
    | "MechBin"
 | 
			
		||||
    | "PveBonusLoadoutBin"
 | 
			
		||||
    | "SentinelBin";
 | 
			
		||||
export type SlotNames = "SuitBin" | "WeaponBin" | "MechBin" | "PveBonusLoadoutBin" | "SentinelBin";
 | 
			
		||||
 | 
			
		||||
export type SlotPurchase = {
 | 
			
		||||
    [P in SlotPurchaseName]: { name: SlotNames; slotsPerPurchase: number };
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user