From 36e76a9a8452e03e7a2698fc6b780b61218e6140 Mon Sep 17 00:00:00 2001 From: Ordis <134585663+OrdisPrime@users.noreply.github.com> Date: Sun, 3 Dec 2023 01:58:06 +0100 Subject: [PATCH] loadouts workinhg --- src/models/inventoryModels/loadoutModel.ts | 26 +++++++++++++--------- src/types/saveLoadoutTypes.ts | 1 + 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/models/inventoryModels/loadoutModel.ts b/src/models/inventoryModels/loadoutModel.ts index 3cf647bd..44082497 100644 --- a/src/models/inventoryModels/loadoutModel.ts +++ b/src/models/inventoryModels/loadoutModel.ts @@ -26,17 +26,23 @@ const EquipmentSelectionSchema = new Schema( } ); -const loadoutConfigSchema = new Schema({ - PresetIcon: String, - Favorite: Boolean, - s: EquipmentSelectionSchema, - p: EquipmentSelectionSchema, - l: EquipmentSelectionSchema, - m: EquipmentSelectionSchema -}); +const loadoutConfigSchema = new Schema( + { + PresetIcon: String, + Favorite: Boolean, + n: String, + s: EquipmentSelectionSchema, + p: EquipmentSelectionSchema, + l: EquipmentSelectionSchema, + m: EquipmentSelectionSchema + }, + { + id: false + } +); -loadoutConfigSchema.virtual("ItemId").get(function (): string { - return this._id.toString(); +loadoutConfigSchema.virtual("ItemId").get(function () { + return { $oid: this._id.toString() } satisfies IOid; }); loadoutConfigSchema.set("toJSON", { diff --git a/src/types/saveLoadoutTypes.ts b/src/types/saveLoadoutTypes.ts index 38a9b8e3..92f496e9 100644 --- a/src/types/saveLoadoutTypes.ts +++ b/src/types/saveLoadoutTypes.ts @@ -63,6 +63,7 @@ export interface ILoadoutKey { // for request and response from and to client export interface ILoadoutConfigClient { ItemId: IOid; + n: string; PresetIcon: string; Favorite: boolean; s: IEquipmentSelection;