fix: duplicated code in getShipController (#158)

This commit is contained in:
Sainan 2024-05-09 16:07:19 +02:00 committed by GitHub
parent b9c7daf4f6
commit 8a6d55e22e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 11 deletions

View File

@ -2,6 +2,7 @@ import { RequestHandler } from "express";
import config from "@/config.json";
import allShipFeatures from "@/static/fixed_responses/allShipFeatures.json";
import { parseString } from "@/src/helpers/general";
import { getPersonalRooms } from "@/src/services/personalRoomsService";
import { getShip } from "@/src/services/shipService";
import { PersonalRooms } from "@/src/models/personalRoomsModel";
import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
@ -48,13 +49,3 @@ export const getLoadout = async (accountId: string) => {
return loadout;
};
export const getPersonalRooms = async (accountId: string) => {
const personalRooms = await PersonalRooms.findOne({ personalRoomsOwnerId: accountId });
if (!personalRooms) {
logger.error(`personal rooms not found for account ${accountId}`);
throw new Error("personal rooms not found");
}
return personalRooms;
};

View File

@ -1,4 +1,4 @@
import { getPersonalRooms } from "@/src/controllers/api/getShipController";
import { getPersonalRooms } from "@/src/services/personalRoomsService";
import { parseString } from "@/src/helpers/general";
import { RequestHandler } from "express";
import { Types } from "mongoose";