chore: resolve various eslint complaints
Some warnings remain, none of them particularly useful, but I've decided not to disable them. However, I did decide to disable `@typescript-eslint/no-misused-promises` due to basically only being noise, and removed the respective comments made because of it.
This commit is contained in:
		
							parent
							
								
									9bded04dfd
								
							
						
					
					
						commit
						2c440bde65
					
				@ -19,6 +19,7 @@
 | 
				
			|||||||
        "@typescript-eslint/restrict-plus-operands": "off",
 | 
					        "@typescript-eslint/restrict-plus-operands": "off",
 | 
				
			||||||
        "@typescript-eslint/no-unsafe-member-access": "off",
 | 
					        "@typescript-eslint/no-unsafe-member-access": "off",
 | 
				
			||||||
        "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
 | 
					        "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
 | 
				
			||||||
 | 
					        "@typescript-eslint/no-misused-promises": "off",
 | 
				
			||||||
        "no-case-declarations": "off"
 | 
					        "no-case-declarations": "off"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "parser": "@typescript-eslint/parser",
 | 
					    "parser": "@typescript-eslint/parser",
 | 
				
			||||||
 | 
				
			|||||||
@ -8,6 +8,7 @@
 | 
				
			|||||||
    "dev": "ts-node-dev --openssl-legacy-provider -r tsconfig-paths/register src/index.ts ",
 | 
					    "dev": "ts-node-dev --openssl-legacy-provider -r tsconfig-paths/register src/index.ts ",
 | 
				
			||||||
    "build": "tsc",
 | 
					    "build": "tsc",
 | 
				
			||||||
    "lint": "eslint --ext .ts .",
 | 
					    "lint": "eslint --ext .ts .",
 | 
				
			||||||
 | 
					    "lint:fix": "eslint --fix --ext .ts .",
 | 
				
			||||||
    "prettier": "prettier --write ."
 | 
					    "prettier": "prettier --write ."
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "license": "GNU",
 | 
					  "license": "GNU",
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@ import { getInventory } from "@/src/services/inventoryService";
 | 
				
			|||||||
const addFriendImageController: RequestHandler = async (req, res) => {
 | 
					const addFriendImageController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const accountId = req.query.accountId as string;
 | 
					    const accountId = req.query.accountId as string;
 | 
				
			||||||
    const json = getJSONfromString(req.body.toString()) as IUpdateGlyphRequest;
 | 
					    const json = getJSONfromString(req.body.toString()) as IUpdateGlyphRequest;
 | 
				
			||||||
    let inventory = await getInventory(accountId);
 | 
					    const inventory = await getInventory(accountId);
 | 
				
			||||||
    inventory.ActiveAvatarImageType = json.AvatarImageType;
 | 
					    inventory.ActiveAvatarImageType = json.AvatarImageType;
 | 
				
			||||||
    await inventory.save();
 | 
					    await inventory.save();
 | 
				
			||||||
    res.json({});
 | 
					    res.json({});
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,6 @@ import { upgradeMod } from "@/src/services/inventoryService";
 | 
				
			|||||||
import { IArtifactsRequest } from "@/src/types/requestTypes";
 | 
					import { IArtifactsRequest } from "@/src/types/requestTypes";
 | 
				
			||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
const artifactsController: RequestHandler = async (req, res) => {
 | 
					const artifactsController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const accountId = parseString(req.query.accountId);
 | 
					    const accountId = parseString(req.query.accountId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
//this is a controller for the claimCompletedRecipe route
 | 
					//this is a controller for the claimCompletedRecipe route
 | 
				
			||||||
//it will claim a recipe for the user
 | 
					//it will claim a recipe for the user
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { Request, RequestHandler, Response } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import { logger } from "@/src/utils/logger";
 | 
					import { logger } from "@/src/utils/logger";
 | 
				
			||||||
import { getItemByBlueprint, getItemCategoryByUniqueName } from "@/src/services/itemDataService";
 | 
					import { getItemByBlueprint, getItemCategoryByUniqueName } from "@/src/services/itemDataService";
 | 
				
			||||||
import { IOid } from "@/src/types/commonTypes";
 | 
					import { IOid } from "@/src/types/commonTypes";
 | 
				
			||||||
@ -13,7 +13,6 @@ export interface IClaimCompletedRecipeRequest {
 | 
				
			|||||||
    RecipeIds: IOid[];
 | 
					    RecipeIds: IOid[];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
export const claimCompletedRecipeController: RequestHandler = async (req, res) => {
 | 
					export const claimCompletedRecipeController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const claimCompletedRecipeRequest = getJSONfromString(req.body.toString()) as IClaimCompletedRecipeRequest;
 | 
					    const claimCompletedRecipeRequest = getJSONfromString(req.body.toString()) as IClaimCompletedRecipeRequest;
 | 
				
			||||||
    const accountId = req.query.accountId as string;
 | 
					    const accountId = req.query.accountId as string;
 | 
				
			||||||
 | 
				
			|||||||
@ -5,16 +5,16 @@ import { Guild } from "@/src/models/guildModel";
 | 
				
			|||||||
import { IGuild, ICreateGuildRequest } from "@/src/types/guildTypes";
 | 
					import { IGuild, ICreateGuildRequest } from "@/src/types/guildTypes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const createGuildController: RequestHandler = async (req, res) => {
 | 
					const createGuildController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    let payload: ICreateGuildRequest = getJSONfromString(req.body.toString());
 | 
					    const payload: ICreateGuildRequest = getJSONfromString(req.body.toString());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Create guild on database
 | 
					    // Create guild on database
 | 
				
			||||||
    let guild = new Guild({
 | 
					    const guild = new Guild({
 | 
				
			||||||
        Name: payload.guildName
 | 
					        Name: payload.guildName
 | 
				
			||||||
    } satisfies IGuild);
 | 
					    } satisfies IGuild);
 | 
				
			||||||
    await guild.save();
 | 
					    await guild.save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Update inventory
 | 
					    // Update inventory
 | 
				
			||||||
    let inventory = await Inventory.findOne({ accountOwnerId: req.query.accountId });
 | 
					    const inventory = await Inventory.findOne({ accountOwnerId: req.query.accountId });
 | 
				
			||||||
    if (inventory) {
 | 
					    if (inventory) {
 | 
				
			||||||
        // Set GuildId
 | 
					        // Set GuildId
 | 
				
			||||||
        inventory.GuildId = guild._id;
 | 
					        inventory.GuildId = guild._id;
 | 
				
			||||||
 | 
				
			|||||||
@ -6,23 +6,23 @@ import { logger } from "@/src/utils/logger";
 | 
				
			|||||||
const findSessionsController: RequestHandler = (_req, res) => {
 | 
					const findSessionsController: RequestHandler = (_req, res) => {
 | 
				
			||||||
    const reqBody = JSON.parse(_req.body);
 | 
					    const reqBody = JSON.parse(_req.body);
 | 
				
			||||||
    logger.debug("FindSession Request ", { reqBody });
 | 
					    logger.debug("FindSession Request ", { reqBody });
 | 
				
			||||||
    let req = JSON.parse(_req.body);
 | 
					    const req = JSON.parse(_req.body);
 | 
				
			||||||
    if (req.id != undefined) {
 | 
					    if (req.id != undefined) {
 | 
				
			||||||
        logger.debug("Found ID");
 | 
					        logger.debug("Found ID");
 | 
				
			||||||
        let session = getSession(req.id);
 | 
					        const session = getSession(req.id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (session) res.json({ queryId: req.queryId, Sessions: session });
 | 
					        if (session) res.json({ queryId: req.queryId, Sessions: session });
 | 
				
			||||||
        else res.json({});
 | 
					        else res.json({});
 | 
				
			||||||
    } else if (req.originalSessionId != undefined) {
 | 
					    } else if (req.originalSessionId != undefined) {
 | 
				
			||||||
        logger.debug("Found OriginalSessionID");
 | 
					        logger.debug("Found OriginalSessionID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let session = getSession(req.originalSessionId);
 | 
					        const session = getSession(req.originalSessionId);
 | 
				
			||||||
        if (session) res.json({ queryId: req.queryId, Sessions: session });
 | 
					        if (session) res.json({ queryId: req.queryId, Sessions: session });
 | 
				
			||||||
        else res.json({});
 | 
					        else res.json({});
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        logger.debug("Found SessionRequest");
 | 
					        logger.debug("Found SessionRequest");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let session = getSession(_req.body);
 | 
					        const session = getSession(_req.body);
 | 
				
			||||||
        if (session) res.json({ queryId: req.queryId, Sessions: session });
 | 
					        if (session) res.json({ queryId: req.queryId, Sessions: session });
 | 
				
			||||||
        else res.json({});
 | 
					        else res.json({});
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,6 @@ import { updateGeneric } from "@/src/services/inventoryService";
 | 
				
			|||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
					import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
const genericUpdateController: RequestHandler = async (request, response) => {
 | 
					const genericUpdateController: RequestHandler = async (request, response) => {
 | 
				
			||||||
    const accountId = request.query.accountId as string;
 | 
					    const accountId = request.query.accountId as string;
 | 
				
			||||||
    const update = getJSONfromString(request.body.toString());
 | 
					    const update = getJSONfromString(request.body.toString());
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,6 @@ import config from "@/config.json";
 | 
				
			|||||||
import { getInventory } from "@/src/services/inventoryService";
 | 
					import { getInventory } from "@/src/services/inventoryService";
 | 
				
			||||||
import { parseString } from "@/src/helpers/general";
 | 
					import { parseString } from "@/src/helpers/general";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
export const getCreditsController: RequestHandler = async (req, res) => {
 | 
					export const getCreditsController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    if (config.infiniteResources) {
 | 
					    if (config.infiniteResources) {
 | 
				
			||||||
        res.json({
 | 
					        res.json({
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,6 @@ import { logger } from "@/src/utils/logger";
 | 
				
			|||||||
import { toOid } from "@/src/helpers/inventoryHelpers";
 | 
					import { toOid } from "@/src/helpers/inventoryHelpers";
 | 
				
			||||||
import { IGetShipResponse } from "@/src/types/shipTypes";
 | 
					import { IGetShipResponse } from "@/src/types/shipTypes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
export const getShipController: RequestHandler = async (req, res) => {
 | 
					export const getShipController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const accountId = parseString(req.query.accountId);
 | 
					    const accountId = parseString(req.query.accountId);
 | 
				
			||||||
    const personalRooms = await getPersonalRooms(accountId);
 | 
					    const personalRooms = await getPersonalRooms(accountId);
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@ import { ISession } from "@/src/types/session";
 | 
				
			|||||||
const hostSessionController: RequestHandler = (req, res) => {
 | 
					const hostSessionController: RequestHandler = (req, res) => {
 | 
				
			||||||
    const hostSessionRequest = JSON.parse(req.body as string) as ISession;
 | 
					    const hostSessionRequest = JSON.parse(req.body as string) as ISession;
 | 
				
			||||||
    logger.debug("HostSession Request", { hostSessionRequest });
 | 
					    logger.debug("HostSession Request", { hostSessionRequest });
 | 
				
			||||||
    let session = createNewSession(hostSessionRequest, req.query.accountId as string);
 | 
					    const session = createNewSession(hostSessionRequest, req.query.accountId as string);
 | 
				
			||||||
    logger.debug(`New Session Created`, { session });
 | 
					    logger.debug(`New Session Created`, { session });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    res.json({ sessionId: { $oid: session.sessionId }, rewardSeed: 99999999 });
 | 
					    res.json({ sessionId: { $oid: session.sessionId }, rewardSeed: 99999999 });
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,3 @@
 | 
				
			|||||||
/* eslint-disable @typescript-eslint/no-misused-promises */
 | 
					 | 
				
			||||||
import { toInventoryResponse } from "@/src/helpers/inventoryHelpers";
 | 
					import { toInventoryResponse } from "@/src/helpers/inventoryHelpers";
 | 
				
			||||||
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
 | 
					import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
 | 
				
			||||||
import { Request, RequestHandler, Response } from "express";
 | 
					import { Request, RequestHandler, Response } from "express";
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
import { parseString } from "@/src/helpers/general";
 | 
					import { parseString } from "@/src/helpers/general";
 | 
				
			||||||
import { getInventory, updateCurrency } from "@/src/services/inventoryService";
 | 
					import { updateCurrency } from "@/src/services/inventoryService";
 | 
				
			||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import { updateSlots } from "@/src/services/inventoryService";
 | 
					import { updateSlots } from "@/src/services/inventoryService";
 | 
				
			||||||
import { SlotNameToInventoryName } from "@/src/types/purchaseTypes";
 | 
					import { SlotNameToInventoryName } from "@/src/types/purchaseTypes";
 | 
				
			||||||
@ -18,7 +18,6 @@ import { SlotNameToInventoryName } from "@/src/types/purchaseTypes";
 | 
				
			|||||||
    number of frames = extra - slots + 2
 | 
					    number of frames = extra - slots + 2
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
export const inventorySlotsController: RequestHandler = async (req, res) => {
 | 
					export const inventorySlotsController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const accountId = parseString(req.query.accountId);
 | 
					    const accountId = parseString(req.query.accountId);
 | 
				
			||||||
    //const body = JSON.parse(req.body as string) as IInventorySlotsRequest;
 | 
					    //const body = JSON.parse(req.body as string) as IInventorySlotsRequest;
 | 
				
			||||||
 | 
				
			|||||||
@ -5,8 +5,8 @@ import { logger } from "@/src/utils/logger";
 | 
				
			|||||||
const joinSessionController: RequestHandler = (_req, res) => {
 | 
					const joinSessionController: RequestHandler = (_req, res) => {
 | 
				
			||||||
    const reqBody = JSON.parse(_req.body);
 | 
					    const reqBody = JSON.parse(_req.body);
 | 
				
			||||||
    logger.debug(`JoinSession Request`, { reqBody });
 | 
					    logger.debug(`JoinSession Request`, { reqBody });
 | 
				
			||||||
    let req = JSON.parse(_req.body);
 | 
					    const req = JSON.parse(_req.body);
 | 
				
			||||||
    let session = getSessionByID(req.sessionIds[0]);
 | 
					    const session = getSessionByID(req.sessionIds[0]);
 | 
				
			||||||
    res.json({ rewardSeed: session?.rewardSeed, sessionId: { $oid: session?.sessionId } });
 | 
					    res.json({ rewardSeed: session?.rewardSeed, sessionId: { $oid: session?.sessionId } });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -10,7 +10,6 @@ import { ILoginResponse } from "@/src/types/loginTypes";
 | 
				
			|||||||
import { DTLS, groups, HUB, IRC, Nonce, NRS, platformCDNs } from "@/static/fixed_responses/login_static";
 | 
					import { DTLS, groups, HUB, IRC, Nonce, NRS, platformCDNs } from "@/static/fixed_responses/login_static";
 | 
				
			||||||
import { logger } from "@/src/utils/logger";
 | 
					import { logger } from "@/src/utils/logger";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
const loginController: RequestHandler = async (request, response) => {
 | 
					const loginController: RequestHandler = async (request, response) => {
 | 
				
			||||||
    // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
 | 
					    // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
 | 
				
			||||||
    const body = JSON.parse(request.body); // parse octet stream of json data to json object
 | 
					    const body = JSON.parse(request.body); // parse octet stream of json data to json object
 | 
				
			||||||
 | 
				
			|||||||
@ -44,7 +44,6 @@ import { IMissionInventoryUpdateRequest } from "@/src/types/requestTypes";
 | 
				
			|||||||
- [ ]  FpsSamples
 | 
					- [ ]  FpsSamples
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
const missionInventoryUpdateController: RequestHandler = async (req, res): Promise<void> => {
 | 
					const missionInventoryUpdateController: RequestHandler = async (req, res): Promise<void> => {
 | 
				
			||||||
    const accountId = parseString(req.query.accountId);
 | 
					    const accountId = parseString(req.query.accountId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,11 +1,9 @@
 | 
				
			|||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import util from "util";
 | 
					 | 
				
			||||||
import { ISaveLoadoutRequest } from "@/src/types/saveLoadoutTypes";
 | 
					import { ISaveLoadoutRequest } from "@/src/types/saveLoadoutTypes";
 | 
				
			||||||
import { handleInventoryItemConfigChange } from "@/src/services/saveLoadoutService";
 | 
					import { handleInventoryItemConfigChange } from "@/src/services/saveLoadoutService";
 | 
				
			||||||
import { parseString } from "@/src/helpers/general";
 | 
					import { parseString } from "@/src/helpers/general";
 | 
				
			||||||
import { logger } from "@/src/utils/logger";
 | 
					import { logger } from "@/src/utils/logger";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
export const saveLoadoutController: RequestHandler = async (req, res) => {
 | 
					export const saveLoadoutController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    //validate here
 | 
					    //validate here
 | 
				
			||||||
    const accountId = parseString(req.query.accountId);
 | 
					    const accountId = parseString(req.query.accountId);
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,6 @@ import { parseString } from "@/src/helpers/general";
 | 
				
			|||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import { Types } from "mongoose";
 | 
					import { Types } from "mongoose";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
export const setActiveShipController: RequestHandler = async (req, res) => {
 | 
					export const setActiveShipController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const accountId = parseString(req.query.accountId);
 | 
					    const accountId = parseString(req.query.accountId);
 | 
				
			||||||
    const shipId = parseString(req.query.shipId);
 | 
					    const shipId = parseString(req.query.shipId);
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,6 @@ import { ISetShipCustomizationsRequest } from "@/src/types/shipTypes";
 | 
				
			|||||||
import { logger } from "@/src/utils/logger";
 | 
					import { logger } from "@/src/utils/logger";
 | 
				
			||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
export const setShipCustomizationsController: RequestHandler = async (req, res) => {
 | 
					export const setShipCustomizationsController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
        const setShipCustomizationsRequest = JSON.parse(req.body as string) as ISetShipCustomizationsRequest;
 | 
					        const setShipCustomizationsRequest = JSON.parse(req.body as string) as ISetShipCustomizationsRequest;
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,6 @@ import { logger } from "@/src/utils/logger";
 | 
				
			|||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import { handleSetShipDecorations } from "@/src/services/shipCustomizationsService";
 | 
					import { handleSetShipDecorations } from "@/src/services/shipCustomizationsService";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
export const shipDecorationsController: RequestHandler = async (req, res) => {
 | 
					export const shipDecorationsController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const accountId = parseString(req.query.accountId);
 | 
					    const accountId = parseString(req.query.accountId);
 | 
				
			||||||
    const shipDecorationsRequest = JSON.parse(req.body as string) as IShipDecorationsRequest;
 | 
					    const shipDecorationsRequest = JSON.parse(req.body as string) as IShipDecorationsRequest;
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,6 @@ interface IStartRecipeRequest {
 | 
				
			|||||||
    Ids: string[];
 | 
					    Ids: string[];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
export const startRecipeController: RequestHandler = async (req, res) => {
 | 
					export const startRecipeController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const startRecipeRequest = getJSONfromString(req.body.toString()) as IStartRecipeRequest;
 | 
					    const startRecipeRequest = getJSONfromString(req.body.toString()) as IStartRecipeRequest;
 | 
				
			||||||
    logger.debug("StartRecipe Request", { startRecipeRequest });
 | 
					    logger.debug("StartRecipe Request", { startRecipeRequest });
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,5 @@
 | 
				
			|||||||
import { parseString } from "@/src/helpers/general";
 | 
					import { parseString } from "@/src/helpers/general";
 | 
				
			||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
					import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
				
			||||||
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
 | 
					 | 
				
			||||||
import { getInventory } from "@/src/services/inventoryService";
 | 
					import { getInventory } from "@/src/services/inventoryService";
 | 
				
			||||||
import { IMongoDate } from "@/src/types/commonTypes";
 | 
					import { IMongoDate } from "@/src/types/commonTypes";
 | 
				
			||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
@ -16,7 +15,6 @@ interface ITrainingResultsResponse {
 | 
				
			|||||||
    InventoryChanges: any[];
 | 
					    InventoryChanges: any[];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
const trainingResultController: RequestHandler = async (req, res): Promise<void> => {
 | 
					const trainingResultController: RequestHandler = async (req, res): Promise<void> => {
 | 
				
			||||||
    const accountId = parseString(req.query.accountId);
 | 
					    const accountId = parseString(req.query.accountId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,5 @@
 | 
				
			|||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import { updateSession } from "@/src/managers/sessionManager";
 | 
					import { updateSession } from "@/src/managers/sessionManager";
 | 
				
			||||||
import { logger } from "@/src/utils/logger";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const updateSessionGetController: RequestHandler = (_req, res) => {
 | 
					const updateSessionGetController: RequestHandler = (_req, res) => {
 | 
				
			||||||
    res.json({});
 | 
					    res.json({});
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,6 @@ import { updateTheme } from "@/src/services/inventoryService";
 | 
				
			|||||||
import { IThemeUpdateRequest } from "@/src/types/requestTypes";
 | 
					import { IThemeUpdateRequest } from "@/src/types/requestTypes";
 | 
				
			||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
const updateThemeController: RequestHandler = async (request, response) => {
 | 
					const updateThemeController: RequestHandler = async (request, response) => {
 | 
				
			||||||
    const accountId = request.query.accountId as string;
 | 
					    const accountId = request.query.accountId as string;
 | 
				
			||||||
    const body = String(request.body);
 | 
					    const body = String(request.body);
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,6 @@ import { getWeaponType } from "@/src/services/itemDataService";
 | 
				
			|||||||
import { addPowerSuit, addWeapon } from "@/src/services/inventoryService";
 | 
					import { addPowerSuit, addWeapon } from "@/src/services/inventoryService";
 | 
				
			||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
const addItemController: RequestHandler = async (req, res) => {
 | 
					const addItemController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const request = toAddItemRequest(req.body);
 | 
					    const request = toAddItemRequest(req.body);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,6 @@ import { toCreateAccount, toDatabaseAccount } from "@/src/helpers/customHelpers/
 | 
				
			|||||||
import { createAccount } from "@/src/services/loginService";
 | 
					import { createAccount } from "@/src/services/loginService";
 | 
				
			||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
const createAccountController: RequestHandler = async (req, res) => {
 | 
					const createAccountController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const createAccountData = toCreateAccount(req.body);
 | 
					    const createAccountData = toCreateAccount(req.body);
 | 
				
			||||||
    const databaseAccount = toDatabaseAccount(createAccountData);
 | 
					    const databaseAccount = toDatabaseAccount(createAccountData);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,4 @@
 | 
				
			|||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import config from "@/config.json";
 | 
					 | 
				
			||||||
import worldState from "@/static/fixed_responses/worldState.json";
 | 
					import worldState from "@/static/fixed_responses/worldState.json";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const worldStateController: RequestHandler = (_req, res) => {
 | 
					const worldStateController: RequestHandler = (_req, res) => {
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@ import view from "@/static/fixed_responses/view.json";
 | 
				
			|||||||
import allScans from "@/static/fixed_responses/allScans.json";
 | 
					import allScans from "@/static/fixed_responses/allScans.json";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const viewController: RequestHandler = (_req, res) => {
 | 
					const viewController: RequestHandler = (_req, res) => {
 | 
				
			||||||
    let responseJson: IStatsView = view;
 | 
					    const responseJson: IStatsView = view;
 | 
				
			||||||
    if (config.unlockAllScans) {
 | 
					    if (config.unlockAllScans) {
 | 
				
			||||||
        responseJson.Scans = allScans;
 | 
					        responseJson.Scans = allScans;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,4 @@
 | 
				
			|||||||
import { parseBoolean, parseNumber, parseString } from "@/src/helpers/general";
 | 
					import { parseBoolean, parseNumber, parseString } from "@/src/helpers/general";
 | 
				
			||||||
import { weapons } from "@/src/services/itemDataService";
 | 
					 | 
				
			||||||
import { slotPurchaseNameToSlotName } from "@/src/services/purchaseService";
 | 
					import { slotPurchaseNameToSlotName } from "@/src/services/purchaseService";
 | 
				
			||||||
import { IPurchaseRequest, SlotPurchaseName } from "@/src/types/purchaseTypes";
 | 
					import { IPurchaseRequest, SlotPurchaseName } from "@/src/types/purchaseTypes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
export const getJSONfromString = (str: string) => {
 | 
					export const getJSONfromString = (str: string): any => {
 | 
				
			||||||
    const jsonSubstring = str.substring(0, str.lastIndexOf("}") + 1);
 | 
					    const jsonSubstring = str.substring(0, str.lastIndexOf("}") + 1);
 | 
				
			||||||
    return JSON.parse(jsonSubstring);
 | 
					    return JSON.parse(jsonSubstring);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -60,7 +60,7 @@ function getSession(sessionIdOrRequest: string | IFindSessionRequest): any[] {
 | 
				
			|||||||
        return [];
 | 
					        return [];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const request = sessionIdOrRequest as IFindSessionRequest;
 | 
					    const request = sessionIdOrRequest;
 | 
				
			||||||
    const matchingSessions = sessions.filter(session => {
 | 
					    const matchingSessions = sessions.filter(session => {
 | 
				
			||||||
        for (const key in request) {
 | 
					        for (const key in request) {
 | 
				
			||||||
            if (key !== "eloRating" && key !== "queryId" && request[key] !== session[key as keyof ISession]) {
 | 
					            if (key !== "eloRating" && key !== "queryId" && request[key] !== session[key as keyof ISession]) {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
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) => {
 | 
				
			||||||
    logger.error(`unknown endpoint ${request.method} ${request.path}`);
 | 
					    logger.error(`unknown endpoint ${request.method} ${request.path}`);
 | 
				
			||||||
 | 
				
			|||||||
@ -38,7 +38,7 @@ import {
 | 
				
			|||||||
    IPeriodicMissionCompletionResponse,
 | 
					    IPeriodicMissionCompletionResponse,
 | 
				
			||||||
    ILoreFragmentScan
 | 
					    ILoreFragmentScan
 | 
				
			||||||
} from "../../types/inventoryTypes/inventoryTypes";
 | 
					} from "../../types/inventoryTypes/inventoryTypes";
 | 
				
			||||||
import { IMongoDate, IOid } from "../../types/commonTypes";
 | 
					import { IOid } from "../../types/commonTypes";
 | 
				
			||||||
import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes";
 | 
					import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes";
 | 
				
			||||||
import { IWeaponDatabase } from "@/src/types/inventoryTypes/weaponTypes";
 | 
					import { IWeaponDatabase } from "@/src/types/inventoryTypes/weaponTypes";
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
import { Model, Schema, StringSchemaDefinition, Types, model } from "mongoose";
 | 
					import { Schema, model } from "mongoose";
 | 
				
			||||||
import { IApartment, IPlacedDecosDatabase, IRooms, IShipDatabase } from "../types/shipTypes";
 | 
					import { IShipDatabase } from "../types/shipTypes";
 | 
				
			||||||
import { toOid } from "@/src/helpers/inventoryHelpers";
 | 
					import { toOid } from "@/src/helpers/inventoryHelpers";
 | 
				
			||||||
import { colorSchema } from "@/src/models/inventoryModels/inventoryModel";
 | 
					import { colorSchema } from "@/src/models/inventoryModels/inventoryModel";
 | 
				
			||||||
import { IShipInventory } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
					import { IShipInventory } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
				
			||||||
 | 
				
			|||||||
@ -73,7 +73,6 @@ apiRouter.get("/setActiveShip.php", setActiveShipController);
 | 
				
			|||||||
apiRouter.get("/getGuild.php", getGuildController);
 | 
					apiRouter.get("/getGuild.php", getGuildController);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// post
 | 
					// post
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
apiRouter.post("/shipDecorations.php", shipDecorationsController);
 | 
					apiRouter.post("/shipDecorations.php", shipDecorationsController);
 | 
				
			||||||
apiRouter.post("/setShipCustomizations.php", setShipCustomizationsController);
 | 
					apiRouter.post("/setShipCustomizations.php", setShipCustomizationsController);
 | 
				
			||||||
apiRouter.post("/claimCompletedRecipe.php", claimCompletedRecipeController);
 | 
					apiRouter.post("/claimCompletedRecipe.php", claimCompletedRecipeController);
 | 
				
			||||||
@ -82,7 +81,6 @@ apiRouter.post("/inventorySlots.php", inventorySlotsController);
 | 
				
			|||||||
apiRouter.post("/focus.php", focusController);
 | 
					apiRouter.post("/focus.php", focusController);
 | 
				
			||||||
apiRouter.post("/artifacts.php", artifactsController);
 | 
					apiRouter.post("/artifacts.php", artifactsController);
 | 
				
			||||||
apiRouter.post("/findSessions.php", findSessionsController);
 | 
					apiRouter.post("/findSessions.php", findSessionsController);
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					 | 
				
			||||||
apiRouter.post("/purchase.php", purchaseController);
 | 
					apiRouter.post("/purchase.php", purchaseController);
 | 
				
			||||||
apiRouter.post("/login.php", loginController);
 | 
					apiRouter.post("/login.php", loginController);
 | 
				
			||||||
apiRouter.post("/getAlliance.php", getAllianceController);
 | 
					apiRouter.post("/getAlliance.php", getAllianceController);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
import { unixTimesInMs } from "@/src/constants/timeConstants";
 | 
					import { unixTimesInMs } from "@/src/constants/timeConstants";
 | 
				
			||||||
import { getInventory } from "@/src/services/inventoryService";
 | 
					import { getInventory } from "@/src/services/inventoryService";
 | 
				
			||||||
import { getItemByBlueprint, getItemCategoryByUniqueName } from "@/src/services/itemDataService";
 | 
					import { getItemByBlueprint } from "@/src/services/itemDataService";
 | 
				
			||||||
import { logger } from "@/src/utils/logger";
 | 
					import { logger } from "@/src/utils/logger";
 | 
				
			||||||
import { Types } from "mongoose";
 | 
					import { Types } from "mongoose";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,3 @@
 | 
				
			|||||||
import { Types } from "mongoose";
 | 
					 | 
				
			||||||
import { IOid } from "@/src/types/commonTypes";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export interface IGuild {
 | 
					export interface IGuild {
 | 
				
			||||||
    Name: string;
 | 
					    Name: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -11,7 +11,6 @@ import {
 | 
				
			|||||||
} from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
					} from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
				
			||||||
import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes";
 | 
					import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes";
 | 
				
			||||||
import { IOperatorLoadOutSigcol, IWeaponDatabase } from "@/src/types/inventoryTypes/weaponTypes";
 | 
					import { IOperatorLoadOutSigcol, IWeaponDatabase } from "@/src/types/inventoryTypes/weaponTypes";
 | 
				
			||||||
import { Colour } from "warframe-items";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
//Document extends will be deleted soon. TODO: delete and migrate uses to ...
 | 
					//Document extends will be deleted soon. TODO: delete and migrate uses to ...
 | 
				
			||||||
export interface IInventoryDatabaseDocument extends IInventoryDatabase, Document {}
 | 
					export interface IInventoryDatabaseDocument extends IInventoryDatabase, Document {}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user