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 { getInventory } from "@/src/services/inventoryService";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
const addFriendImageController: RequestHandler = async (req, res) => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
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 { ICreateGuildRequest } from "@/src/types/guildTypes";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
const createGuildController: RequestHandler = async (req, res) => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
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 baseFocusPointCosts from "@/static/json/baseFocusPointCosts.json";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
export const focusController: RequestHandler = async (req, res) => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
switch (req.query.op) {
|
||||
|
@ -4,6 +4,7 @@ import { Guild } from "@/src/models/guildModel";
|
||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||
import { toOid } from "@/src/helpers/inventoryHelpers";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
const getGuildController: RequestHandler = async (req, res) => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
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 { toOid, toMongoDate } from "@/src/helpers/inventoryHelpers";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
export const getGuildDojoController: RequestHandler = async (req, res) => {
|
||||
const guildId = req.query.guildId as string;
|
||||
|
||||
|
@ -4,6 +4,7 @@ import { createNewSession } from "@/src/managers/sessionManager";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { ISession } from "@/src/types/session";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
const hostSessionController: RequestHandler = async (req, res) => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
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 { IOid } from "@/src/types/commonTypes";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
export const infestedFoundryController: RequestHandler = async (req, res) => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
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 { toInventoryResponse } from "@/src/helpers/inventoryHelpers";
|
||||
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
|
||||
import { Request, RequestHandler, Response } from "express";
|
||||
import { config } from "@/src/services/configService";
|
||||
import allMissions from "@/static/fixed_responses/allMissions.json";
|
||||
import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes";
|
||||
import { IShipInventory } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
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;
|
||||
try {
|
||||
accountId = await getAccountIdForRequest(request);
|
||||
|
@ -2,6 +2,7 @@ import { RequestHandler } from "express";
|
||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||
import { Account } from "@/src/models/loginModel";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
const logoutController: RequestHandler = async (req, res) => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
const account = await Account.findOne({ _id: accountId });
|
||||
|
@ -18,6 +18,7 @@ interface IModularCraftRequest {
|
||||
Parts: string[];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
export const modularWeaponCraftingController: RequestHandler = async (req, res) => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
const data: IModularCraftRequest = getJSONfromString(req.body.toString());
|
||||
|
@ -8,6 +8,7 @@ interface INameWeaponRequest {
|
||||
ItemName: string;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
export const nameWeaponController: RequestHandler = async (req, res) => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
const inventory = await getInventory(accountId);
|
||||
|
@ -1,9 +1,10 @@
|
||||
import { RequestHandler } from "express";
|
||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||
import { toPurchaseRequest } from "@/src/helpers/purchaseHelpers";
|
||||
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 accountId = await getAccountIdForRequest(req);
|
||||
const response = await handlePurchase(purchaseRequest, accountId);
|
||||
|
@ -3,6 +3,7 @@ import { ISellRequest } from "@/src/types/sellTypes";
|
||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||
import { getInventory, addMods, addRecipes } from "@/src/services/inventoryService";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
export const sellController: RequestHandler = async (req, res) => {
|
||||
const payload: ISellRequest = JSON.parse(req.body.toString());
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
|
@ -3,6 +3,7 @@ import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||
import { getPersonalRooms } from "@/src/services/personalRoomsService";
|
||||
import { TBootLocation } from "@/src/types/shipTypes";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
export const setBootLocationController: RequestHandler = async (req, res) => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
const personalRooms = await getPersonalRooms(accountId);
|
||||
|
@ -2,6 +2,7 @@ import { RequestHandler } from "express";
|
||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||
import { getInventory } from "@/src/services/inventoryService";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
export const setSupportedSyndicateController: RequestHandler = async (req, res) => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
const inventory = await getInventory(accountId);
|
||||
|
@ -8,6 +8,7 @@ interface IStartDojoRecipeRequest {
|
||||
Revision: number;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
export const startDojoRecipeController: RequestHandler = async (req, res) => {
|
||||
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.
|
||||
|
@ -3,6 +3,7 @@ import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||
import { getInventory } from "@/src/services/inventoryService";
|
||||
import { IStepSequencer } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
export const stepSequencersController: RequestHandler = async (req, res) => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
const inventory = await getInventory(accountId);
|
||||
|
@ -3,6 +3,7 @@ import { syndicateSacrifice } from "@/src/services/inventoryService";
|
||||
import { ISyndicateSacrifice } from "@/src/types/syndicateTypes";
|
||||
import { RequestHandler } from "express";
|
||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
const syndicateSacrificeController: RequestHandler = async (request, response) => {
|
||||
const accountId = await getAccountIdForRequest(request);
|
||||
|
@ -4,6 +4,7 @@ import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||
import { updateChallengeProgress } from "@/src/services/inventoryService";
|
||||
import { IUpdateChallengeProgressRequest } from "@/src/types/requestTypes";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
const updateChallengeProgressController: RequestHandler = async (req, res) => {
|
||||
const payload: IUpdateChallengeProgressRequest = getJSONfromString(req.body.toString());
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
|
@ -5,6 +5,7 @@ import { IMiscItem, TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTy
|
||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||
import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inventoryService";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
export const upgradesController: RequestHandler = async (req, res) => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
const payload = JSON.parse(req.body.toString()) as IUpgradesRequest;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { RequestHandler } from "express";
|
||||
import { updateConfig } from "@/src/services/configService";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
const updateConfigDataController: RequestHandler = async (req, res) => {
|
||||
await updateConfig(req.body.toString());
|
||||
res.end();
|
||||
|
@ -6,6 +6,7 @@ import { config } from "@/src/services/configService";
|
||||
import view from "@/static/fixed_responses/view.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 accountId = await getAccountIdForRequest(req);
|
||||
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: "./" });
|
||||
});
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
cacheRouter.get(/\.bk2!/, async (req, res) => {
|
||||
try {
|
||||
const dir = req.path.substr(0, req.path.lastIndexOf("/"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user