chore: some initial handling of legacy oid format #2033

Merged
Sainan merged 6 commits from legacy-oid into main 2025-05-09 00:20:55 -07:00
Showing only changes of commit e305399ba6 - Show all commits

View File

@ -1,5 +1,6 @@
import { applyClientEquipmentUpdates, getInventory } from "@/src/services/inventoryService"; import { applyClientEquipmentUpdates, getInventory } from "@/src/services/inventoryService";
import { getAccountIdForRequest } from "@/src/services/loginService"; import { getAccountIdForRequest } from "@/src/services/loginService";
import { IOid } from "@/src/types/commonTypes";
import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes"; import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
import { RequestHandler } from "express"; import { RequestHandler } from "express";
@ -11,7 +12,7 @@ export const addXpController: RequestHandler = async (req, res) => {
const request = req.body as IAddXpRequest; const request = req.body as IAddXpRequest;
for (const [category, gear] of Object.entries(request)) { for (const [category, gear] of Object.entries(request)) {
for (const clientItem of gear) { for (const clientItem of gear) {
const dbItem = inventory[category as TEquipmentKey].id(clientItem.ItemId.$oid); const dbItem = inventory[category as TEquipmentKey].id((clientItem.ItemId as IOid).$oid);
if (dbItem) { if (dbItem) {
if (dbItem.ItemType in ExportMisc.uniqueLevelCaps) { if (dbItem.ItemType in ExportMisc.uniqueLevelCaps) {
if ((dbItem.Polarized ?? 0) < 5) { if ((dbItem.Polarized ?? 0) < 5) {