feat: getShip import #2627

Merged
Sainan merged 4 commits from AMelonInsideLemon/SpaceNinjaServer:getShip-import into main 2025-08-15 15:13:36 -07:00
Showing only changes of commit 1c6d4b1ac1 - Show all commits

View File

@ -58,8 +58,7 @@ import {
IPlanterClient, IPlanterClient,
IPlanterDatabase, IPlanterDatabase,
ITailorShop, ITailorShop,
ITailorShopDatabase, ITailorShopDatabase
TPersonalRoomsDatabaseDocument
} from "@/src/types/personalRoomsTypes"; } from "@/src/types/personalRoomsTypes";
const convertDate = (value: IMongoDate): Date => { const convertDate = (value: IMongoDate): Date => {
@ -450,12 +449,10 @@ export const importLoadOutPresets = (db: ILoadoutDatabase, client: ILoadOutPrese
const convertShip = (client: IOrbiterClient): IOrbiterDatabase => { const convertShip = (client: IOrbiterClient): IOrbiterDatabase => {
return { return {
...client, ...client,
ShipInterior: client.ShipInterior ShipInterior: {
? { ...client.ShipInterior,
...client.ShipInterior, Colors: Array.isArray(client.ShipInterior.Colors) ? {} : client.ShipInterior.Colors
Colors: Array.isArray(client.ShipInterior.Colors) ? {} : client.ShipInterior.Colors },
}
: undefined,
FavouriteLoadoutId: client.FavouriteLoadoutId ? new Types.ObjectId(client.FavouriteLoadoutId.$oid) : undefined FavouriteLoadoutId: client.FavouriteLoadoutId ? new Types.ObjectId(client.FavouriteLoadoutId.$oid) : undefined
}; };
}; };
@ -484,8 +481,8 @@ const convertFavouriteLoadout = (client: IFavouriteLoadout): IFavouriteLoadoutDa
const convertApartment = (client: IApartmentClient): IApartmentDatabase => { const convertApartment = (client: IApartmentClient): IApartmentDatabase => {
return { return {
...client, ...client,
Gardening: client.Gardening ? { Planters: client.Gardening.Planters.map(convertPlanter) } : { Planters: [] }, Gardening: { Planters: client.Gardening.Planters.map(convertPlanter) },
FavouriteLoadouts: client.FavouriteLoadouts ? client.FavouriteLoadouts.map(convertFavouriteLoadout) : [] FavouriteLoadouts: client.FavouriteLoadouts.map(convertFavouriteLoadout)
}; };
}; };
@ -493,7 +490,7 @@ const convertTailorShop = (client: ITailorShop): ITailorShopDatabase => {
return { return {
...client, ...client,
Colors: Array.isArray(client.Colors) ? {} : client.Colors, Colors: Array.isArray(client.Colors) ? {} : client.Colors,
FavouriteLoadouts: client.FavouriteLoadouts ? client.FavouriteLoadouts.map(convertFavouriteLoadout) : [] FavouriteLoadouts: client.FavouriteLoadouts.map(convertFavouriteLoadout)
}; };
}; };