refactor: reorganize imports #1
@ -6,14 +6,14 @@ import { requestLogger, unknownEndpointHandler } from "@/src/middleware/middlewa
 | 
				
			|||||||
import { apiRouter } from "@/src/routes/api";
 | 
					import { apiRouter } from "@/src/routes/api";
 | 
				
			||||||
//import { testRouter } from "@/src/routes/test";
 | 
					//import { testRouter } from "@/src/routes/test";
 | 
				
			||||||
import { cacheRouter } from "@/src/routes/cache";
 | 
					import { cacheRouter } from "@/src/routes/cache";
 | 
				
			||||||
import { dynamicController } from "./routes/dynamic";
 | 
					 | 
				
			||||||
import { customRouter } from "./routes/custom";
 | 
					import { customRouter } from "./routes/custom";
 | 
				
			||||||
 | 
					import { dynamicController } from "./routes/dynamic";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import bodyParser from "body-parser";
 | 
					import bodyParser from "body-parser";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { connectDatabase } from "./services/mongoService";
 | 
					 | 
				
			||||||
import morgan from "morgan";
 | 
					import morgan from "morgan";
 | 
				
			||||||
import { steamPacksController } from "./controllers/misc/steamPacksController";
 | 
					import { steamPacksController } from "./controllers/misc/steamPacksController";
 | 
				
			||||||
 | 
					import { connectDatabase } from "./services/mongoService";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void connectDatabase();
 | 
					void connectDatabase();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
import { RequestHandler } from "express-serve-static-core";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const getAllianceController: RequestHandler = (_req, res) => {
 | 
					const getAllianceController: RequestHandler = (_req, res) => {
 | 
				
			||||||
    res.sendStatus(200);
 | 
					    res.sendStatus(200);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,5 @@
 | 
				
			|||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const hostSessionController: RequestHandler = (_req, res) => {
 | 
					const hostSessionController: RequestHandler = (_req, res) => {
 | 
				
			||||||
    res.json({ sessionId: { $oid: "123123123" }, rewardSeed: 123123123123 });
 | 
					    res.json({ sessionId: { $oid: "123123123" }, rewardSeed: 123123123123 });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,5 @@
 | 
				
			|||||||
import { Request, Response, RequestHandler } from "express";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import inventory from "@/static/fixed_responses/inventory.json";
 | 
					import inventory from "@/static/fixed_responses/inventory.json";
 | 
				
			||||||
 | 
					import { Request, RequestHandler, Response } from "express";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const inventorController: RequestHandler = (request: Request, response: Response) => {
 | 
					const inventorController: RequestHandler = (request: Request, response: Response) => {
 | 
				
			||||||
    console.log(request.query);
 | 
					    console.log(request.query);
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,7 @@ import { toLoginRequest } from "@/src/helpers/loginHelpers";
 | 
				
			|||||||
import { Account } from "@/src/models/loginModel";
 | 
					import { Account } from "@/src/models/loginModel";
 | 
				
			||||||
import { createAccount, isCorrectPassword } from "@/src/services/loginService";
 | 
					import { createAccount, isCorrectPassword } from "@/src/services/loginService";
 | 
				
			||||||
import { ILoginResponse } from "@/src/types/loginTypes";
 | 
					import { ILoginResponse } from "@/src/types/loginTypes";
 | 
				
			||||||
import { DTLS, HUB, IRC, NRS, Nonce, groups, platformCDNs } from "@/static/fixed_responses/login_static";
 | 
					import { DTLS, groups, HUB, IRC, Nonce, NRS, platformCDNs } from "@/static/fixed_responses/login_static";
 | 
				
			||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import config from "../../../config.json";
 | 
					import config from "../../../config.json";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
/* eslint-disable @typescript-eslint/no-misused-promises */
 | 
					/* eslint-disable @typescript-eslint/no-misused-promises */
 | 
				
			||||||
import { toDatabaseAccount, toCreateAccount } from "@/src/helpers/customHelpers";
 | 
					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";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -8,6 +8,7 @@ const createAccountController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
    const databaseAccount = toDatabaseAccount(createAccountData);
 | 
					    const databaseAccount = toDatabaseAccount(createAccountData);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const account = await createAccount(databaseAccount);
 | 
					    const account = await createAccount(databaseAccount);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    res.json(account);
 | 
					    res.json(account);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
import { Request, Response, NextFunction } from "express";
 | 
					import { NextFunction, Request, Response } from "express";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const unknownEndpointHandler = (request: Request, response: Response) => {
 | 
					const unknownEndpointHandler = (request: Request, response: Response) => {
 | 
				
			||||||
    console.error("[ERROR] Unknown Endpoint", request.url);
 | 
					    console.error("[ERROR] Unknown Endpoint", request.url);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,6 @@
 | 
				
			|||||||
import mongoose, { model, Schema, SchemaOptions } from "mongoose";
 | 
					import { model, Schema, SchemaOptions } from "mongoose";
 | 
				
			||||||
import { IDatabaseAccountDocument } from "../types/loginTypes";
 | 
					import { IDatabaseAccountDocument } from "../types/loginTypes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const opts = {
 | 
					const opts = {
 | 
				
			||||||
    toJSON: { virtuals: true },
 | 
					    toJSON: { virtuals: true },
 | 
				
			||||||
    toObject: { virtuals: true }
 | 
					    toObject: { virtuals: true }
 | 
				
			||||||
 | 
				
			|||||||
@ -1,25 +1,23 @@
 | 
				
			|||||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
 | 
					 | 
				
			||||||
import express from "express";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import purchaseController from "@/src/controllers/api/purchaseController";
 | 
					 | 
				
			||||||
import getFriendsController from "@/src/controllers/api/getFriendsController";
 | 
					import getFriendsController from "@/src/controllers/api/getFriendsController";
 | 
				
			||||||
import inventoryController from "@/src/controllers/api/inventoryController";
 | 
					import inventoryController from "@/src/controllers/api/inventoryController";
 | 
				
			||||||
import { marketRecommendationsController } from "../controllers/api/marketRecommendationsController";
 | 
					import purchaseController from "@/src/controllers/api/purchaseController";
 | 
				
			||||||
import { loginController } from "../controllers/api/loginController";
 | 
					import express from "express";
 | 
				
			||||||
import { surveysController } from "../controllers/api/surveysController";
 | 
					 | 
				
			||||||
import { getIgnoredUsersController } from "../controllers/api/getIgnoredUsersController";
 | 
					 | 
				
			||||||
import { dronesController } from "../controllers/api/dronesController";
 | 
					 | 
				
			||||||
import { updateChallengeProgressController } from "../controllers/api/updateChallengeProgressController";
 | 
					 | 
				
			||||||
import { findSessionsController } from "../controllers/api/findSessionsController";
 | 
					 | 
				
			||||||
import { viewController } from "../controllers/api/viewController";
 | 
					 | 
				
			||||||
import { getAllianceController } from "../controllers/api/getAllianceController";
 | 
					 | 
				
			||||||
import { loginRewardsController } from "../controllers/api/loginRewardsController";
 | 
					 | 
				
			||||||
import { checkDailyMissionBonusController } from "../controllers/api/checkDailyMissionBonusController";
 | 
					import { checkDailyMissionBonusController } from "../controllers/api/checkDailyMissionBonusController";
 | 
				
			||||||
import { getShipController } from "../controllers/api/getShipController";
 | 
					import { dronesController } from "../controllers/api/dronesController";
 | 
				
			||||||
import { inboxController } from "../controllers/api/inboxController";
 | 
					import { findSessionsController } from "../controllers/api/findSessionsController";
 | 
				
			||||||
import { hostSessionController } from "../controllers/api/hostSessionController";
 | 
					import { getAllianceController } from "../controllers/api/getAllianceController";
 | 
				
			||||||
 | 
					import { getIgnoredUsersController } from "../controllers/api/getIgnoredUsersController";
 | 
				
			||||||
import { getNewRewardSeedController } from "../controllers/api/getNewRewardSeedController";
 | 
					import { getNewRewardSeedController } from "../controllers/api/getNewRewardSeedController";
 | 
				
			||||||
 | 
					import { getShipController } from "../controllers/api/getShipController";
 | 
				
			||||||
 | 
					import { hostSessionController } from "../controllers/api/hostSessionController";
 | 
				
			||||||
 | 
					import { inboxController } from "../controllers/api/inboxController";
 | 
				
			||||||
 | 
					import { loginController } from "../controllers/api/loginController";
 | 
				
			||||||
 | 
					import { loginRewardsController } from "../controllers/api/loginRewardsController";
 | 
				
			||||||
 | 
					import { marketRecommendationsController } from "../controllers/api/marketRecommendationsController";
 | 
				
			||||||
import { setActiveQuestController } from "../controllers/api/setActiveQuestController";
 | 
					import { setActiveQuestController } from "../controllers/api/setActiveQuestController";
 | 
				
			||||||
 | 
					import { surveysController } from "../controllers/api/surveysController";
 | 
				
			||||||
 | 
					import { updateChallengeProgressController } from "../controllers/api/updateChallengeProgressController";
 | 
				
			||||||
 | 
					import { viewController } from "../controllers/api/viewController";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const apiRouter = express.Router();
 | 
					const apiRouter = express.Router();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
import express from "express";
 | 
					import express from "express";
 | 
				
			||||||
import { worldStateController } from "../controllers/dynamic/worldStateController";
 | 
					 | 
				
			||||||
import { aggregateSessionsController } from "../controllers/dynamic/aggregateSessionsController";
 | 
					import { aggregateSessionsController } from "../controllers/dynamic/aggregateSessionsController";
 | 
				
			||||||
 | 
					import { worldStateController } from "../controllers/dynamic/worldStateController";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const dynamicController = express.Router();
 | 
					const dynamicController = express.Router();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,3 @@
 | 
				
			|||||||
import { Document } from "mongoose";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export interface ILoginResponse extends Omit<IDatabaseAccountDocument, "email" | "password"> {
 | 
					export interface ILoginResponse extends Omit<IDatabaseAccountDocument, "email" | "password"> {
 | 
				
			||||||
    Groups: IGroup[];
 | 
					    Groups: IGroup[];
 | 
				
			||||||
    Nonce: number;
 | 
					    Nonce: number;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user