fix: duplicated code in getShipController (#158)
This commit is contained in:
parent
b9c7daf4f6
commit
8a6d55e22e
@ -2,6 +2,7 @@ import { RequestHandler } from "express";
|
|||||||
import config from "@/config.json";
|
import config from "@/config.json";
|
||||||
import allShipFeatures from "@/static/fixed_responses/allShipFeatures.json";
|
import allShipFeatures from "@/static/fixed_responses/allShipFeatures.json";
|
||||||
import { parseString } from "@/src/helpers/general";
|
import { parseString } from "@/src/helpers/general";
|
||||||
|
import { getPersonalRooms } from "@/src/services/personalRoomsService";
|
||||||
import { getShip } from "@/src/services/shipService";
|
import { getShip } from "@/src/services/shipService";
|
||||||
import { PersonalRooms } from "@/src/models/personalRoomsModel";
|
import { PersonalRooms } from "@/src/models/personalRoomsModel";
|
||||||
import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
|
import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
|
||||||
@ -48,13 +49,3 @@ export const getLoadout = async (accountId: string) => {
|
|||||||
|
|
||||||
return loadout;
|
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;
|
|
||||||
};
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { getPersonalRooms } from "@/src/controllers/api/getShipController";
|
import { getPersonalRooms } from "@/src/services/personalRoomsService";
|
||||||
import { parseString } from "@/src/helpers/general";
|
import { parseString } from "@/src/helpers/general";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user