fix: address some client warnings about malformed inventory.php response #840

Merged
Sainan merged 5 commits from inventory-fix into main 2025-01-24 05:17:53 -08:00
Showing only changes of commit c95a847181 - Show all commits

View File

@ -62,7 +62,8 @@ import {
IOperatorConfigDatabase,
IPolarity,
IEquipmentDatabase,
IArchonCrystalUpgrade
IArchonCrystalUpgrade,
IEquipmentClient
} from "@/src/types/inventoryTypes/commonInventoryTypes";
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
import { EquipmentSelectionSchema } from "./loadoutModel";
@ -260,6 +261,13 @@ EquipmentSchema.set("toJSON", {
transform(_document, returnedObject) {
delete returnedObject._id;
delete returnedObject.__v;
const db = returnedObject as IEquipmentDatabase;
const client = returnedObject as IEquipmentClient;
if (db.InfestationDate) {
client.InfestationDate = toMongoDate(db.InfestationDate);
}
}
});