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

XFESpaceNinjaServer

A simple server for a small space ninja game

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

XFEstudio/XFESpaceNinjaServer

fix: duplicated code in getShipController (#158)

8a6d55e2
Sainan <sainan@calamity.gg>
提交于

代码差异

2 个文件 +2 -11
Modified src/controllers/api/getShipController.ts +1 -10
@@ -2,6 +2,7 @@ import { RequestHandler } from "express";
2 2 import config from "@/config.json";
3 3 import allShipFeatures from "@/static/fixed_responses/allShipFeatures.json";
4 4 import { parseString } from "@/src/helpers/general";
5 import { getPersonalRooms } from "@/src/services/personalRoomsService";
5 6 import { getShip } from "@/src/services/shipService";
6 7 import { PersonalRooms } from "@/src/models/personalRoomsModel";
7 8 import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
@@ -48,13 +49,3 @@ export const getLoadout = async (accountId: string) => {
48 49
49 50 return loadout;
50 51 };
51
52 export const getPersonalRooms = async (accountId: string) => {
53 const personalRooms = await PersonalRooms.findOne({ personalRoomsOwnerId: accountId });
54
55 if (!personalRooms) {
56 logger.error(`personal rooms not found for account ${accountId}`);
57 throw new Error("personal rooms not found");
58 }
59 return personalRooms;
60 };
Modified src/controllers/api/setActiveShipController.ts +1 -1
@@ -1,4 +1,4 @@
1 import { getPersonalRooms } from "@/src/controllers/api/getShipController";
1 import { getPersonalRooms } from "@/src/services/personalRoomsService";
2 2 import { parseString } from "@/src/helpers/general";
3 3 import { RequestHandler } from "express";
4 4 import { Types } from "mongoose";