fix: unequipping weapons doesn't save

also improved the types and models
This commit is contained in:
Sainan 2024-05-04 20:37:58 +02:00
parent 477f678244
commit da272735cf
3 changed files with 15 additions and 13 deletions

View File

@ -19,7 +19,8 @@ const EquipmentSelectionSchema = new Schema<IEquipmentSelection>(
default: { $oid: "000000000000000000000000" } default: { $oid: "000000000000000000000000" }
}, },
mod: Number, mod: Number,
cus: Number cus: Number,
hide: Boolean
}, },
{ {
_id: false _id: false

View File

@ -106,8 +106,7 @@ export const handleInventoryItemConfigChange = async (
throw new Error("loadout index not found"); throw new Error("loadout index not found");
} }
//perhaps .overwrite() is better loadout[loadoutSlot][loadoutIndex].overwrite(loadoutConfig);
loadout[loadoutSlot][loadoutIndex].set(loadoutConfig);
} }
} }
await loadout.save(); await loadout.save();

View File

@ -76,17 +76,19 @@ export interface ILoadoutConfigDatabase extends Omit<ILoadoutConfigClient, "Item
// for request and response from and to client // for request and response from and to client
export interface ILoadoutConfigClient { export interface ILoadoutConfigClient {
ItemId: IOid; ItemId: IOid;
n: string; n?: string;
PresetIcon: string; PresetIcon?: string;
Favorite: boolean; Favorite?: boolean;
s: IEquipmentSelection; s?: IEquipmentSelection;
p: IEquipmentSelection; p?: IEquipmentSelection;
l: IEquipmentSelection; l?: IEquipmentSelection;
m: IEquipmentSelection; m?: IEquipmentSelection;
Remove?: boolean;
} }
export interface IEquipmentSelection { export interface IEquipmentSelection {
ItemId: IOid; ItemId?: IOid;
mod: number; mod?: number;
cus: number; cus?: number;
hide?: boolean;
} }