fix InfestationDate not being converted to client representation
This commit is contained in:
parent
2a68b8a164
commit
c95a847181
@ -62,7 +62,8 @@ import {
|
|||||||
IOperatorConfigDatabase,
|
IOperatorConfigDatabase,
|
||||||
IPolarity,
|
IPolarity,
|
||||||
IEquipmentDatabase,
|
IEquipmentDatabase,
|
||||||
IArchonCrystalUpgrade
|
IArchonCrystalUpgrade,
|
||||||
|
IEquipmentClient
|
||||||
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||||
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
|
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
|
||||||
import { EquipmentSelectionSchema } from "./loadoutModel";
|
import { EquipmentSelectionSchema } from "./loadoutModel";
|
||||||
@ -260,6 +261,13 @@ EquipmentSchema.set("toJSON", {
|
|||||||
transform(_document, returnedObject) {
|
transform(_document, returnedObject) {
|
||||||
delete returnedObject._id;
|
delete returnedObject._id;
|
||||||
delete returnedObject.__v;
|
delete returnedObject.__v;
|
||||||
|
|
||||||
|
const db = returnedObject as IEquipmentDatabase;
|
||||||
|
const client = returnedObject as IEquipmentClient;
|
||||||
|
|
||||||
|
if (db.InfestationDate) {
|
||||||
|
client.InfestationDate = toMongoDate(db.InfestationDate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user