返回提交历史
Modified
src/controllers/custom/importController.ts
+5
-1
Modified
src/services/importService.ts
+1
-1
XFEstudio/XFESpaceNinjaServer
fix(import): handle ship features being in inventory (#2688)
Closes #2686 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2688 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
ffcbbb48
代码差异
2 个文件
+6
-2
@@ -21,7 +21,11 @@ export const importController: RequestHandler = async (req, res) => {
21
21
await loadout.save();
22
22
}
23
23
24
if ("Ship" in request.inventory || "Apartment" in request.inventory || "TailorShop" in request.inventory) {
24
if (
25
request.inventory.Ship?.Rooms || // very old accounts may have Ship with { Features: [ ... ] }
26
"Apartment" in request.inventory ||
27
"TailorShop" in request.inventory
28
) {
25
29
const personalRooms = await getPersonalRooms(accountId);
26
30
importPersonalRooms(personalRooms, request.inventory);
27
31
await personalRooms.save();
@@ -570,7 +570,7 @@ const convertTailorShop = (client: ITailorShop): ITailorShopDatabase => {
570
570
};
571
571
572
572
export const importPersonalRooms = (db: IPersonalRoomsDatabase, client: Partial<IGetShipResponse>): void => {
573
if (client.Ship !== undefined) db.Ship = convertShip(client.Ship);
573
if (client.Ship?.Rooms) db.Ship = convertShip(client.Ship);
574
574
if (client.Apartment !== undefined) db.Apartment = convertApartment(client.Apartment);
575
575
if (client.TailorShop !== undefined) db.TailorShop = convertTailorShop(client.TailorShop);
576
576
};