forked from OpenWF/SpaceNinjaServer
improve: suppress no-misued-promises when declaring RequestHandler (#332)
This commit is contained in:
parent
f9414dcf84
commit
722a9aba5b
@ -4,6 +4,7 @@ import { IUpdateGlyphRequest } from "@/src/types/requestTypes";
|
|||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
const addFriendImageController: RequestHandler = async (req, res) => {
|
const addFriendImageController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const json = getJSONfromString(req.body.toString()) as IUpdateGlyphRequest;
|
const json = getJSONfromString(req.body.toString()) as IUpdateGlyphRequest;
|
||||||
|
@ -5,6 +5,7 @@ import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
|
|||||||
import { Guild } from "@/src/models/guildModel";
|
import { Guild } from "@/src/models/guildModel";
|
||||||
import { ICreateGuildRequest } from "@/src/types/guildTypes";
|
import { ICreateGuildRequest } from "@/src/types/guildTypes";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
const createGuildController: RequestHandler = async (req, res) => {
|
const createGuildController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const payload: ICreateGuildRequest = getJSONfromString(req.body.toString());
|
const payload: ICreateGuildRequest = getJSONfromString(req.body.toString());
|
||||||
|
@ -5,6 +5,7 @@ import { IMiscItem, TFocusPolarity } from "@/src/types/inventoryTypes/inventoryT
|
|||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
import baseFocusPointCosts from "@/static/json/baseFocusPointCosts.json";
|
import baseFocusPointCosts from "@/static/json/baseFocusPointCosts.json";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
export const focusController: RequestHandler = async (req, res) => {
|
export const focusController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
switch (req.query.op) {
|
switch (req.query.op) {
|
||||||
|
@ -4,6 +4,7 @@ import { Guild } from "@/src/models/guildModel";
|
|||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { toOid } from "@/src/helpers/inventoryHelpers";
|
import { toOid } from "@/src/helpers/inventoryHelpers";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
const getGuildController: RequestHandler = async (req, res) => {
|
const getGuildController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const inventory = await Inventory.findOne({ accountOwnerId: accountId });
|
const inventory = await Inventory.findOne({ accountOwnerId: accountId });
|
||||||
|
@ -4,6 +4,7 @@ import { Guild } from "@/src/models/guildModel";
|
|||||||
import { IDojoClient, IDojoComponentClient } from "@/src/types/guildTypes";
|
import { IDojoClient, IDojoComponentClient } from "@/src/types/guildTypes";
|
||||||
import { toOid, toMongoDate } from "@/src/helpers/inventoryHelpers";
|
import { toOid, toMongoDate } from "@/src/helpers/inventoryHelpers";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
export const getGuildDojoController: RequestHandler = async (req, res) => {
|
export const getGuildDojoController: RequestHandler = async (req, res) => {
|
||||||
const guildId = req.query.guildId as string;
|
const guildId = req.query.guildId as string;
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import { createNewSession } from "@/src/managers/sessionManager";
|
|||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
import { ISession } from "@/src/types/session";
|
import { ISession } from "@/src/types/session";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
const hostSessionController: RequestHandler = async (req, res) => {
|
const hostSessionController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const hostSessionRequest = JSON.parse(req.body as string) as ISession;
|
const hostSessionRequest = JSON.parse(req.body as string) as ISession;
|
||||||
|
@ -4,6 +4,7 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
|||||||
import { getInventory, addMiscItems } from "@/src/services/inventoryService";
|
import { getInventory, addMiscItems } from "@/src/services/inventoryService";
|
||||||
import { IOid } from "@/src/types/commonTypes";
|
import { IOid } from "@/src/types/commonTypes";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
export const infestedFoundryController: RequestHandler = async (req, res) => {
|
export const infestedFoundryController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const payload = getJSONfromString(req.body.toString());
|
const payload = getJSONfromString(req.body.toString());
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
import { RequestHandler } from "express";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
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 { config } from "@/src/services/configService";
|
import { config } from "@/src/services/configService";
|
||||||
import allMissions from "@/static/fixed_responses/allMissions.json";
|
import allMissions from "@/static/fixed_responses/allMissions.json";
|
||||||
import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes";
|
import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes";
|
||||||
import { IShipInventory } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { IShipInventory } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { ExportCustoms, ExportFlavour, ExportKeys, ExportResources } from "warframe-public-export-plus";
|
import { ExportCustoms, ExportFlavour, ExportKeys, ExportResources } from "warframe-public-export-plus";
|
||||||
|
|
||||||
const inventoryController: RequestHandler = async (request: Request, response: Response) => {
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
|
const inventoryController: RequestHandler = async (request, response) => {
|
||||||
let accountId;
|
let accountId;
|
||||||
try {
|
try {
|
||||||
accountId = await getAccountIdForRequest(request);
|
accountId = await getAccountIdForRequest(request);
|
||||||
|
@ -2,6 +2,7 @@ import { RequestHandler } from "express";
|
|||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { Account } from "@/src/models/loginModel";
|
import { Account } from "@/src/models/loginModel";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
const logoutController: RequestHandler = async (req, res) => {
|
const logoutController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const account = await Account.findOne({ _id: accountId });
|
const account = await Account.findOne({ _id: accountId });
|
||||||
|
@ -18,6 +18,7 @@ interface IModularCraftRequest {
|
|||||||
Parts: string[];
|
Parts: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
export const modularWeaponCraftingController: RequestHandler = async (req, res) => {
|
export const modularWeaponCraftingController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const data: IModularCraftRequest = getJSONfromString(req.body.toString());
|
const data: IModularCraftRequest = getJSONfromString(req.body.toString());
|
||||||
|
@ -8,6 +8,7 @@ interface INameWeaponRequest {
|
|||||||
ItemName: string;
|
ItemName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
export const nameWeaponController: RequestHandler = async (req, res) => {
|
export const nameWeaponController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
|
import { RequestHandler } from "express";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { toPurchaseRequest } from "@/src/helpers/purchaseHelpers";
|
import { toPurchaseRequest } from "@/src/helpers/purchaseHelpers";
|
||||||
import { handlePurchase } from "@/src/services/purchaseService";
|
import { handlePurchase } from "@/src/services/purchaseService";
|
||||||
import { Request, Response } from "express";
|
|
||||||
|
|
||||||
export const purchaseController = async (req: Request, res: Response) => {
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
|
export const purchaseController: RequestHandler = async (req, res) => {
|
||||||
const purchaseRequest = toPurchaseRequest(JSON.parse(String(req.body)));
|
const purchaseRequest = toPurchaseRequest(JSON.parse(String(req.body)));
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const response = await handlePurchase(purchaseRequest, accountId);
|
const response = await handlePurchase(purchaseRequest, accountId);
|
||||||
|
@ -3,6 +3,7 @@ import { ISellRequest } from "@/src/types/sellTypes";
|
|||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { getInventory, addMods, addRecipes } from "@/src/services/inventoryService";
|
import { getInventory, addMods, addRecipes } from "@/src/services/inventoryService";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
export const sellController: RequestHandler = async (req, res) => {
|
export const sellController: RequestHandler = async (req, res) => {
|
||||||
const payload: ISellRequest = JSON.parse(req.body.toString());
|
const payload: ISellRequest = JSON.parse(req.body.toString());
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
|
@ -3,6 +3,7 @@ import { getAccountIdForRequest } from "@/src/services/loginService";
|
|||||||
import { getPersonalRooms } from "@/src/services/personalRoomsService";
|
import { getPersonalRooms } from "@/src/services/personalRoomsService";
|
||||||
import { TBootLocation } from "@/src/types/shipTypes";
|
import { TBootLocation } from "@/src/types/shipTypes";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
export const setBootLocationController: RequestHandler = async (req, res) => {
|
export const setBootLocationController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const personalRooms = await getPersonalRooms(accountId);
|
const personalRooms = await getPersonalRooms(accountId);
|
||||||
|
@ -2,6 +2,7 @@ import { RequestHandler } from "express";
|
|||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
export const setSupportedSyndicateController: RequestHandler = async (req, res) => {
|
export const setSupportedSyndicateController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
|
@ -8,6 +8,7 @@ interface IStartDojoRecipeRequest {
|
|||||||
Revision: number;
|
Revision: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
export const startDojoRecipeController: RequestHandler = async (req, res) => {
|
export const startDojoRecipeController: RequestHandler = async (req, res) => {
|
||||||
const guild = await getGuildForRequest(req);
|
const guild = await getGuildForRequest(req);
|
||||||
// At this point, we know that a member of the guild is making this request. Assuming they are allowed to start a build.
|
// At this point, we know that a member of the guild is making this request. Assuming they are allowed to start a build.
|
||||||
|
@ -3,6 +3,7 @@ import { getAccountIdForRequest } from "@/src/services/loginService";
|
|||||||
import { getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
import { IStepSequencer } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { IStepSequencer } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
export const stepSequencersController: RequestHandler = async (req, res) => {
|
export const stepSequencersController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
|
@ -3,6 +3,7 @@ import { syndicateSacrifice } from "@/src/services/inventoryService";
|
|||||||
import { ISyndicateSacrifice } from "@/src/types/syndicateTypes";
|
import { ISyndicateSacrifice } from "@/src/types/syndicateTypes";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
const syndicateSacrificeController: RequestHandler = async (request, response) => {
|
const syndicateSacrificeController: RequestHandler = async (request, response) => {
|
||||||
const accountId = await getAccountIdForRequest(request);
|
const accountId = await getAccountIdForRequest(request);
|
||||||
|
@ -4,6 +4,7 @@ import { getAccountIdForRequest } from "@/src/services/loginService";
|
|||||||
import { updateChallengeProgress } from "@/src/services/inventoryService";
|
import { updateChallengeProgress } from "@/src/services/inventoryService";
|
||||||
import { IUpdateChallengeProgressRequest } from "@/src/types/requestTypes";
|
import { IUpdateChallengeProgressRequest } from "@/src/types/requestTypes";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
const updateChallengeProgressController: RequestHandler = async (req, res) => {
|
const updateChallengeProgressController: RequestHandler = async (req, res) => {
|
||||||
const payload: IUpdateChallengeProgressRequest = getJSONfromString(req.body.toString());
|
const payload: IUpdateChallengeProgressRequest = getJSONfromString(req.body.toString());
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
|
@ -5,6 +5,7 @@ import { IMiscItem, TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTy
|
|||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inventoryService";
|
import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inventoryService";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
export const upgradesController: RequestHandler = async (req, res) => {
|
export const upgradesController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const payload = JSON.parse(req.body.toString()) as IUpgradesRequest;
|
const payload = JSON.parse(req.body.toString()) as IUpgradesRequest;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { updateConfig } from "@/src/services/configService";
|
import { updateConfig } from "@/src/services/configService";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
const updateConfigDataController: RequestHandler = async (req, res) => {
|
const updateConfigDataController: RequestHandler = async (req, res) => {
|
||||||
await updateConfig(req.body.toString());
|
await updateConfig(req.body.toString());
|
||||||
res.end();
|
res.end();
|
||||||
|
@ -6,6 +6,7 @@ import { config } from "@/src/services/configService";
|
|||||||
import view from "@/static/fixed_responses/view.json";
|
import view from "@/static/fixed_responses/view.json";
|
||||||
import allScans from "@/static/fixed_responses/allScans.json";
|
import allScans from "@/static/fixed_responses/allScans.json";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
const viewController: RequestHandler = async (req, res) => {
|
const viewController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const inventory = await Inventory.findOne({ accountOwnerId: accountId });
|
const inventory = await Inventory.findOne({ accountOwnerId: accountId });
|
||||||
|
@ -16,6 +16,7 @@ cacheRouter.get(/^\/origin\/[a-zA-Z0-9]+\/[0-9]+\/H\.Cache\.bin.*$/, (_req, res)
|
|||||||
res.sendFile(`static/data/H.Cache_${buildConfig.version}.bin`, { root: "./" });
|
res.sendFile(`static/data/H.Cache_${buildConfig.version}.bin`, { root: "./" });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
cacheRouter.get(/\.bk2!/, async (req, res) => {
|
cacheRouter.get(/\.bk2!/, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const dir = req.path.substr(0, req.path.lastIndexOf("/"));
|
const dir = req.path.substr(0, req.path.lastIndexOf("/"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user