XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

refactor: reorganize imports

f253a0b5
Alan Morel <alan@alanmorel.com>
提交于

代码差异

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