forked from OpenWF/SpaceNinjaServer
		
	chore: fix most explicit-function-return-type warnings (#656)
This commit is contained in:
		
							parent
							
								
									05be199927
								
							
						
					
					
						commit
						d31f9f8d24
					
				@ -1,6 +1,6 @@
 | 
				
			|||||||
import { Request, Response } from "express";
 | 
					import { Request, Response } from "express";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const getFriendsController = (_request: Request, response: Response) => {
 | 
					const getFriendsController = (_request: Request, response: Response): void => {
 | 
				
			||||||
    response.writeHead(200, {
 | 
					    response.writeHead(200, {
 | 
				
			||||||
        //Connection: "keep-alive",
 | 
					        //Connection: "keep-alive",
 | 
				
			||||||
        //"Content-Encoding": "gzip",
 | 
					        //"Content-Encoding": "gzip",
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
import { IOid } from "@/src/types/commonTypes";
 | 
					import { IMongoDate, IOid } from "@/src/types/commonTypes";
 | 
				
			||||||
import { IInventoryResponse } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
					import { IInventoryResponse } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
				
			||||||
import { Types } from "mongoose";
 | 
					import { Types } from "mongoose";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -13,6 +13,6 @@ export const toOid = (objectId: Types.ObjectId): IOid => {
 | 
				
			|||||||
    return { $oid: objectId.toString() } satisfies IOid;
 | 
					    return { $oid: objectId.toString() } satisfies IOid;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const toMongoDate = (date: Date) => {
 | 
					export const toMongoDate = (date: Date): IMongoDate => {
 | 
				
			||||||
    return { $date: { $numberLong: date.getTime().toString() } };
 | 
					    return { $date: { $numberLong: date.getTime().toString() } };
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@ export const isSlotPurchaseName = (slotPurchaseName: string): slotPurchaseName i
 | 
				
			|||||||
    return slotPurchaseName in slotPurchaseNameToSlotName;
 | 
					    return slotPurchaseName in slotPurchaseNameToSlotName;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const parseSlotPurchaseName = (slotPurchaseName: string) => {
 | 
					export const parseSlotPurchaseName = (slotPurchaseName: string): SlotPurchaseName => {
 | 
				
			||||||
    if (!isSlotPurchaseName(slotPurchaseName)) throw new Error(`invalid slot name ${slotPurchaseName}`);
 | 
					    if (!isSlotPurchaseName(slotPurchaseName)) throw new Error(`invalid slot name ${slotPurchaseName}`);
 | 
				
			||||||
    return slotPurchaseName;
 | 
					    return slotPurchaseName;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -17,7 +17,7 @@ export const getSubstringFromKeywordToKeyword = (str: string, keywordBegin: stri
 | 
				
			|||||||
    return str.substring(beginIndex, endIndex + 1);
 | 
					    return str.substring(beginIndex, endIndex + 1);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const getIndexAfter = (str: string, searchWord: string) => {
 | 
					export const getIndexAfter = (str: string, searchWord: string): number => {
 | 
				
			||||||
    const index = str.indexOf(searchWord);
 | 
					    const index = str.indexOf(searchWord);
 | 
				
			||||||
    if (index === -1) {
 | 
					    if (index === -1) {
 | 
				
			||||||
        return -1;
 | 
					        return -1;
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
import { logger } from "@/src/utils/logger";
 | 
					import { logger } from "@/src/utils/logger";
 | 
				
			||||||
import { /*NextFunction,*/ Request, Response } from "express";
 | 
					import { /*NextFunction,*/ Request, Response } from "express";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const unknownEndpointHandler = (request: Request, response: Response) => {
 | 
					const unknownEndpointHandler = (request: Request, response: Response): void => {
 | 
				
			||||||
    logger.error(`unknown endpoint ${request.method} ${request.path}`);
 | 
					    logger.error(`unknown endpoint ${request.method} ${request.path}`);
 | 
				
			||||||
    if (request.body) {
 | 
					    if (request.body) {
 | 
				
			||||||
        logger.debug(`data provided to ${request.path}: ${String(request.body)}`);
 | 
					        logger.debug(`data provided to ${request.path}: ${String(request.body)}`);
 | 
				
			||||||
 | 
				
			|||||||
@ -326,7 +326,7 @@ const MailboxSchema = new Schema<IMailbox>(
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        LastInboxId: {
 | 
					        LastInboxId: {
 | 
				
			||||||
            type: Schema.Types.ObjectId,
 | 
					            type: Schema.Types.ObjectId,
 | 
				
			||||||
            set: (v: IMailbox["LastInboxId"]) => v.$oid.toString()
 | 
					            set: (v: IMailbox["LastInboxId"]): string => v.$oid.toString()
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    { id: false, _id: false }
 | 
					    { id: false, _id: false }
 | 
				
			||||||
 | 
				
			|||||||
@ -56,7 +56,7 @@ interface ILoggerConfig {
 | 
				
			|||||||
    level: string; // "fatal" | "error" | "warn" | "info" | "http" | "debug" | "trace";
 | 
					    level: string; // "fatal" | "error" | "warn" | "info" | "http" | "debug" | "trace";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const updateConfig = async (data: string) => {
 | 
					export const updateConfig = async (data: string): Promise<void> => {
 | 
				
			||||||
    amnesia = true;
 | 
					    amnesia = true;
 | 
				
			||||||
    await fsPromises.writeFile(configPath, data);
 | 
					    await fsPromises.writeFile(configPath, data);
 | 
				
			||||||
    Object.assign(config, JSON.parse(data));
 | 
					    Object.assign(config, JSON.parse(data));
 | 
				
			||||||
 | 
				
			|||||||
@ -47,7 +47,7 @@ import { handleStoreItemAcquisition } from "./purchaseService";
 | 
				
			|||||||
export const createInventory = async (
 | 
					export const createInventory = async (
 | 
				
			||||||
    accountOwnerId: Types.ObjectId,
 | 
					    accountOwnerId: Types.ObjectId,
 | 
				
			||||||
    defaultItemReferences: { loadOutPresetId: Types.ObjectId; ship: Types.ObjectId }
 | 
					    defaultItemReferences: { loadOutPresetId: Types.ObjectId; ship: Types.ObjectId }
 | 
				
			||||||
) => {
 | 
					): Promise<void> => {
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
        const inventory = config.skipTutorial
 | 
					        const inventory = config.skipTutorial
 | 
				
			||||||
            ? new Inventory({
 | 
					            ? new Inventory({
 | 
				
			||||||
@ -367,7 +367,7 @@ export const addItem = async (
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//TODO: maybe genericMethod for all the add methods, they share a lot of logic
 | 
					//TODO: maybe genericMethod for all the add methods, they share a lot of logic
 | 
				
			||||||
export const addSentinel = async (sentinelName: string, accountId: string) => {
 | 
					export const addSentinel = async (sentinelName: string, accountId: string): Promise<IInventoryChanges> => {
 | 
				
			||||||
    const inventoryChanges: IInventoryChanges = {};
 | 
					    const inventoryChanges: IInventoryChanges = {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (ExportSentinels[sentinelName]?.defaultWeapon) {
 | 
					    if (ExportSentinels[sentinelName]?.defaultWeapon) {
 | 
				
			||||||
@ -400,11 +400,11 @@ export const addSentinel = async (sentinelName: string, accountId: string) => {
 | 
				
			|||||||
    return inventoryChanges;
 | 
					    return inventoryChanges;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const addSentinelWeapon = async (typeName: string, accountId: string) => {
 | 
					export const addSentinelWeapon = async (typeName: string, accountId: string): Promise<IEquipmentClient> => {
 | 
				
			||||||
    const inventory = await getInventory(accountId);
 | 
					    const inventory = await getInventory(accountId);
 | 
				
			||||||
    const sentinelIndex = inventory.SentinelWeapons.push({ ItemType: typeName });
 | 
					    const sentinelIndex = inventory.SentinelWeapons.push({ ItemType: typeName });
 | 
				
			||||||
    const changedInventory = await inventory.save();
 | 
					    const changedInventory = await inventory.save();
 | 
				
			||||||
    return changedInventory.SentinelWeapons[sentinelIndex - 1].toJSON();
 | 
					    return changedInventory.SentinelWeapons[sentinelIndex - 1].toJSON<IEquipmentClient>();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const addPowerSuit = async (powersuitName: string, accountId: string): Promise<IInventoryChanges> => {
 | 
					export const addPowerSuit = async (powersuitName: string, accountId: string): Promise<IInventoryChanges> => {
 | 
				
			||||||
@ -458,14 +458,19 @@ export const addSpecialItem = async (
 | 
				
			|||||||
    (inventoryChanges.SpecialItems as object[]).push(changedInventory.SpecialItems[specialItemIndex - 1].toJSON());
 | 
					    (inventoryChanges.SpecialItems as object[]).push(changedInventory.SpecialItems[specialItemIndex - 1].toJSON());
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const addSpaceSuit = async (spacesuitName: string, accountId: string) => {
 | 
					export const addSpaceSuit = async (spacesuitName: string, accountId: string): Promise<IEquipmentClient> => {
 | 
				
			||||||
    const inventory = await getInventory(accountId);
 | 
					    const inventory = await getInventory(accountId);
 | 
				
			||||||
    const suitIndex = inventory.SpaceSuits.push({ ItemType: spacesuitName, Configs: [], UpgradeVer: 101, XP: 0 });
 | 
					    const suitIndex = inventory.SpaceSuits.push({ ItemType: spacesuitName, Configs: [], UpgradeVer: 101, XP: 0 });
 | 
				
			||||||
    const changedInventory = await inventory.save();
 | 
					    const changedInventory = await inventory.save();
 | 
				
			||||||
    return changedInventory.SpaceSuits[suitIndex - 1].toJSON();
 | 
					    return changedInventory.SpaceSuits[suitIndex - 1].toJSON<IEquipmentClient>();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const updateSlots = async (accountId: string, slotName: SlotNames, slotAmount: number, extraAmount: number) => {
 | 
					export const updateSlots = async (
 | 
				
			||||||
 | 
					    accountId: string,
 | 
				
			||||||
 | 
					    slotName: SlotNames,
 | 
				
			||||||
 | 
					    slotAmount: number,
 | 
				
			||||||
 | 
					    extraAmount: number
 | 
				
			||||||
 | 
					): Promise<void> => {
 | 
				
			||||||
    const inventory = await getInventory(accountId);
 | 
					    const inventory = await getInventory(accountId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    inventory[slotName].Slots += slotAmount;
 | 
					    inventory[slotName].Slots += slotAmount;
 | 
				
			||||||
@ -542,7 +547,7 @@ export const updateGeneric = async (data: IGenericUpdate, accountId: string): Pr
 | 
				
			|||||||
    await inventory.save();
 | 
					    await inventory.save();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const updateTheme = async (data: IThemeUpdateRequest, accountId: string) => {
 | 
					export const updateTheme = async (data: IThemeUpdateRequest, accountId: string): Promise<void> => {
 | 
				
			||||||
    const inventory = await getInventory(accountId);
 | 
					    const inventory = await getInventory(accountId);
 | 
				
			||||||
    if (data.Style) inventory.ThemeStyle = data.Style;
 | 
					    if (data.Style) inventory.ThemeStyle = data.Style;
 | 
				
			||||||
    if (data.Background) inventory.ThemeBackground = data.Background;
 | 
					    if (data.Background) inventory.ThemeBackground = data.Background;
 | 
				
			||||||
@ -634,7 +639,7 @@ const addGearExpByCategory = (
 | 
				
			|||||||
    inventory: IInventoryDatabaseDocument,
 | 
					    inventory: IInventoryDatabaseDocument,
 | 
				
			||||||
    gearArray: IEquipmentClient[] | undefined,
 | 
					    gearArray: IEquipmentClient[] | undefined,
 | 
				
			||||||
    categoryName: TEquipmentKey
 | 
					    categoryName: TEquipmentKey
 | 
				
			||||||
) => {
 | 
					): void => {
 | 
				
			||||||
    const category = inventory[categoryName];
 | 
					    const category = inventory[categoryName];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gearArray?.forEach(({ ItemId, XP }) => {
 | 
					    gearArray?.forEach(({ ItemId, XP }) => {
 | 
				
			||||||
@ -663,7 +668,7 @@ const addGearExpByCategory = (
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const addMiscItems = (inventory: IInventoryDatabaseDocument, itemsArray: IMiscItem[] | undefined) => {
 | 
					export const addMiscItems = (inventory: IInventoryDatabaseDocument, itemsArray: IMiscItem[] | undefined): void => {
 | 
				
			||||||
    const { MiscItems } = inventory;
 | 
					    const { MiscItems } = inventory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    itemsArray?.forEach(({ ItemCount, ItemType }) => {
 | 
					    itemsArray?.forEach(({ ItemCount, ItemType }) => {
 | 
				
			||||||
@ -678,7 +683,10 @@ export const addMiscItems = (inventory: IInventoryDatabaseDocument, itemsArray:
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const addShipDecorations = (inventory: IInventoryDatabaseDocument, itemsArray: IConsumable[] | undefined) => {
 | 
					export const addShipDecorations = (
 | 
				
			||||||
 | 
					    inventory: IInventoryDatabaseDocument,
 | 
				
			||||||
 | 
					    itemsArray: IConsumable[] | undefined
 | 
				
			||||||
 | 
					): void => {
 | 
				
			||||||
    const { ShipDecorations } = inventory;
 | 
					    const { ShipDecorations } = inventory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    itemsArray?.forEach(({ ItemCount, ItemType }) => {
 | 
					    itemsArray?.forEach(({ ItemCount, ItemType }) => {
 | 
				
			||||||
@ -693,7 +701,7 @@ export const addShipDecorations = (inventory: IInventoryDatabaseDocument, itemsA
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const addConsumables = (inventory: IInventoryDatabaseDocument, itemsArray: IConsumable[] | undefined) => {
 | 
					export const addConsumables = (inventory: IInventoryDatabaseDocument, itemsArray: IConsumable[] | undefined): void => {
 | 
				
			||||||
    const { Consumables } = inventory;
 | 
					    const { Consumables } = inventory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    itemsArray?.forEach(({ ItemCount, ItemType }) => {
 | 
					    itemsArray?.forEach(({ ItemCount, ItemType }) => {
 | 
				
			||||||
@ -708,7 +716,7 @@ export const addConsumables = (inventory: IInventoryDatabaseDocument, itemsArray
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const addRecipes = (inventory: IInventoryDatabaseDocument, itemsArray: ITypeCount[] | undefined) => {
 | 
					export const addRecipes = (inventory: IInventoryDatabaseDocument, itemsArray: ITypeCount[] | undefined): void => {
 | 
				
			||||||
    const { Recipes } = inventory;
 | 
					    const { Recipes } = inventory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    itemsArray?.forEach(({ ItemCount, ItemType }) => {
 | 
					    itemsArray?.forEach(({ ItemCount, ItemType }) => {
 | 
				
			||||||
@ -723,7 +731,7 @@ export const addRecipes = (inventory: IInventoryDatabaseDocument, itemsArray: IT
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const addMods = (inventory: IInventoryDatabaseDocument, itemsArray: IRawUpgrade[] | undefined) => {
 | 
					export const addMods = (inventory: IInventoryDatabaseDocument, itemsArray: IRawUpgrade[] | undefined): void => {
 | 
				
			||||||
    const { RawUpgrades } = inventory;
 | 
					    const { RawUpgrades } = inventory;
 | 
				
			||||||
    itemsArray?.forEach(({ ItemType, ItemCount }) => {
 | 
					    itemsArray?.forEach(({ ItemType, ItemCount }) => {
 | 
				
			||||||
        const itemIndex = RawUpgrades.findIndex(i => i.ItemType === ItemType);
 | 
					        const itemIndex = RawUpgrades.findIndex(i => i.ItemType === ItemType);
 | 
				
			||||||
@ -740,7 +748,7 @@ export const addMods = (inventory: IInventoryDatabaseDocument, itemsArray: IRawU
 | 
				
			|||||||
export const addFusionTreasures = (
 | 
					export const addFusionTreasures = (
 | 
				
			||||||
    inventory: IInventoryDatabaseDocument,
 | 
					    inventory: IInventoryDatabaseDocument,
 | 
				
			||||||
    itemsArray: IFusionTreasure[] | undefined
 | 
					    itemsArray: IFusionTreasure[] | undefined
 | 
				
			||||||
) => {
 | 
					): void => {
 | 
				
			||||||
    const { FusionTreasures } = inventory;
 | 
					    const { FusionTreasures } = inventory;
 | 
				
			||||||
    itemsArray?.forEach(({ ItemType, ItemCount, Sockets }) => {
 | 
					    itemsArray?.forEach(({ ItemType, ItemCount, Sockets }) => {
 | 
				
			||||||
        const itemIndex = FusionTreasures.findIndex(i => i.ItemType == ItemType && (i.Sockets || 0) == (Sockets || 0));
 | 
					        const itemIndex = FusionTreasures.findIndex(i => i.ItemType == ItemType && (i.Sockets || 0) == (Sockets || 0));
 | 
				
			||||||
@ -754,7 +762,10 @@ export const addFusionTreasures = (
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const updateChallengeProgress = async (challenges: IUpdateChallengeProgressRequest, accountId: string) => {
 | 
					export const updateChallengeProgress = async (
 | 
				
			||||||
 | 
					    challenges: IUpdateChallengeProgressRequest,
 | 
				
			||||||
 | 
					    accountId: string
 | 
				
			||||||
 | 
					): Promise<void> => {
 | 
				
			||||||
    const inventory = await getInventory(accountId);
 | 
					    const inventory = await getInventory(accountId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    addChallenges(inventory, challenges.ChallengeProgress);
 | 
					    addChallenges(inventory, challenges.ChallengeProgress);
 | 
				
			||||||
@ -766,7 +777,7 @@ export const updateChallengeProgress = async (challenges: IUpdateChallengeProgre
 | 
				
			|||||||
export const addSeasonalChallengeHistory = (
 | 
					export const addSeasonalChallengeHistory = (
 | 
				
			||||||
    inventory: IInventoryDatabaseDocument,
 | 
					    inventory: IInventoryDatabaseDocument,
 | 
				
			||||||
    itemsArray: ISeasonChallenge[] | undefined
 | 
					    itemsArray: ISeasonChallenge[] | undefined
 | 
				
			||||||
) => {
 | 
					): void => {
 | 
				
			||||||
    const category = inventory.SeasonChallengeHistory;
 | 
					    const category = inventory.SeasonChallengeHistory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    itemsArray?.forEach(({ challenge, id }) => {
 | 
					    itemsArray?.forEach(({ challenge, id }) => {
 | 
				
			||||||
@ -780,7 +791,10 @@ export const addSeasonalChallengeHistory = (
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const addChallenges = (inventory: IInventoryDatabaseDocument, itemsArray: IChallengeProgress[] | undefined) => {
 | 
					export const addChallenges = (
 | 
				
			||||||
 | 
					    inventory: IInventoryDatabaseDocument,
 | 
				
			||||||
 | 
					    itemsArray: IChallengeProgress[] | undefined
 | 
				
			||||||
 | 
					): void => {
 | 
				
			||||||
    const category = inventory.ChallengeProgress;
 | 
					    const category = inventory.ChallengeProgress;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    itemsArray?.forEach(({ Name, Progress }) => {
 | 
					    itemsArray?.forEach(({ Name, Progress }) => {
 | 
				
			||||||
@ -795,7 +809,7 @@ export const addChallenges = (inventory: IInventoryDatabaseDocument, itemsArray:
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const addMissionComplete = (inventory: IInventoryDatabaseDocument, { Tag, Completes }: IMission) => {
 | 
					const addMissionComplete = (inventory: IInventoryDatabaseDocument, { Tag, Completes }: IMission): void => {
 | 
				
			||||||
    const { Missions } = inventory;
 | 
					    const { Missions } = inventory;
 | 
				
			||||||
    const itemIndex = Missions.findIndex(item => item.Tag === Tag);
 | 
					    const itemIndex = Missions.findIndex(item => item.Tag === Tag);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -34,13 +34,13 @@ export const createAccount = async (accountData: IDatabaseAccount): Promise<IDat
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const createLoadout = async (accountId: Types.ObjectId) => {
 | 
					export const createLoadout = async (accountId: Types.ObjectId): Promise<Types.ObjectId> => {
 | 
				
			||||||
    const loadout = new Loadout({ loadoutOwnerId: accountId });
 | 
					    const loadout = new Loadout({ loadoutOwnerId: accountId });
 | 
				
			||||||
    const savedLoadout = await loadout.save();
 | 
					    const savedLoadout = await loadout.save();
 | 
				
			||||||
    return savedLoadout._id;
 | 
					    return savedLoadout._id;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const createPersonalRooms = async (accountId: Types.ObjectId, shipId: Types.ObjectId) => {
 | 
					export const createPersonalRooms = async (accountId: Types.ObjectId, shipId: Types.ObjectId): Promise<void> => {
 | 
				
			||||||
    const personalRooms = new PersonalRooms({
 | 
					    const personalRooms = new PersonalRooms({
 | 
				
			||||||
        ...new_personal_rooms,
 | 
					        ...new_personal_rooms,
 | 
				
			||||||
        personalRoomsOwnerId: accountId,
 | 
					        personalRoomsOwnerId: accountId,
 | 
				
			||||||
 | 
				
			|||||||
@ -25,13 +25,13 @@ import {
 | 
				
			|||||||
    TRarity
 | 
					    TRarity
 | 
				
			||||||
} from "warframe-public-export-plus";
 | 
					} from "warframe-public-export-plus";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const getStoreItemCategory = (storeItem: string) => {
 | 
					export const getStoreItemCategory = (storeItem: string): string => {
 | 
				
			||||||
    const storeItemString = getSubstringFromKeyword(storeItem, "StoreItems/");
 | 
					    const storeItemString = getSubstringFromKeyword(storeItem, "StoreItems/");
 | 
				
			||||||
    const storeItemElements = storeItemString.split("/");
 | 
					    const storeItemElements = storeItemString.split("/");
 | 
				
			||||||
    return storeItemElements[1];
 | 
					    return storeItemElements[1];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const getStoreItemTypesCategory = (typesItem: string) => {
 | 
					export const getStoreItemTypesCategory = (typesItem: string): string => {
 | 
				
			||||||
    const typesString = getSubstringFromKeyword(typesItem, "Types");
 | 
					    const typesString = getSubstringFromKeyword(typesItem, "Types");
 | 
				
			||||||
    const typeElements = typesString.split("/");
 | 
					    const typeElements = typesString.split("/");
 | 
				
			||||||
    if (typesItem.includes("StoreItems")) {
 | 
					    if (typesItem.includes("StoreItems")) {
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,7 @@ import { getRecipe } from "@/src/services/itemDataService";
 | 
				
			|||||||
import { logger } from "@/src/utils/logger";
 | 
					import { logger } from "@/src/utils/logger";
 | 
				
			||||||
import { Types } from "mongoose";
 | 
					import { Types } from "mongoose";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const startRecipe = async (recipeName: string, accountId: string) => {
 | 
					export const startRecipe = async (recipeName: string, accountId: string): Promise<{ RecipeId: { $oid: string } }> => {
 | 
				
			||||||
    const recipe = getRecipe(recipeName);
 | 
					    const recipe = getRecipe(recipeName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!recipe) {
 | 
					    if (!recipe) {
 | 
				
			||||||
@ -34,6 +34,6 @@ export const startRecipe = async (recipeName: string, accountId: string) => {
 | 
				
			|||||||
    const newInventory = await inventory.save();
 | 
					    const newInventory = await inventory.save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
        RecipeId: { $oid: newInventory.PendingRecipes[newInventory.PendingRecipes.length - 1]._id?.toString() }
 | 
					        RecipeId: { $oid: newInventory.PendingRecipes[newInventory.PendingRecipes.length - 1]._id.toString() }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -103,7 +103,7 @@ export const logger = createLogger({
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
addColors(logLevels.colors);
 | 
					addColors(logLevels.colors);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function registerLogFileCreationListener() {
 | 
					export function registerLogFileCreationListener(): void {
 | 
				
			||||||
    errorLog.on("new", filename => logger.info(`Using error log file: ${filename}`));
 | 
					    errorLog.on("new", filename => logger.info(`Using error log file: ${filename}`));
 | 
				
			||||||
    combinedLog.on("new", filename => logger.info(`Using combined log file: ${filename}`));
 | 
					    combinedLog.on("new", filename => logger.info(`Using combined log file: ${filename}`));
 | 
				
			||||||
    errorLog.on("rotate", filename => logger.info(`Rotated error log file: ${filename}`));
 | 
					    errorLog.on("rotate", filename => logger.info(`Rotated error log file: ${filename}`));
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user