From 91ced2c75bf109c1b8c3a9064ff35a233d341446 Mon Sep 17 00:00:00 2001 From: OrdisPrime <134585663+OrdisPrime@users.noreply.github.com> Date: Mon, 12 Feb 2024 14:31:28 +0100 Subject: [PATCH] feat: more inventory schemas (#131) --- .gitignore | 5 +- config.json | 4 +- package-lock.json | 68 +- src/controllers/api/inventoryController.ts | 8 +- src/helpers/inventoryHelpers.ts | 4 + src/models/inventoryModels/inventoryModel.ts | 1065 +++++++++++------ src/types/inventoryTypes/inventoryTypes.ts | 132 +- .../{testMissions.json => allMissions.json} | 0 .../{testQuestKeys.json => allQuestKeys.json} | 0 .../postTutorialInventory.json | 1 - 10 files changed, 823 insertions(+), 464 deletions(-) rename static/fixed_responses/{testMissions.json => allMissions.json} (100%) rename static/fixed_responses/{testQuestKeys.json => allQuestKeys.json} (100%) diff --git a/.gitignore b/.gitignore index 7e1fa4a4e..316e4fed5 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,7 @@ yarn.lock .idea/ # logs -/logs \ No newline at end of file +/logs + +# MongoDB VSCode extension playground scripts +/database_scripts \ No newline at end of file diff --git a/config.json b/config.json index fc70a2920..9dd254d5b 100644 --- a/config.json +++ b/config.json @@ -6,7 +6,7 @@ "worldSeed": "qihVmIIyYXz0E4+01UjY+ROEiAB7x3k40ZaCUtVLEF17u9TXVita+jHZRuMLB6OT8GOfX8C+kqkyrT26AJEHFV0IDUkoZ1bntDSBL6wN36tq+ttsN/8NIcy1eGIyLzHn1Cosbtp8ykPhIaFKWlWP6v0QUBObIT11xLXF8fd+7cAEUcPygnS6WK048KEjMldK5bXIkkg9NV7ZXWLhNfTVG0mN0VluNUKDlc/JCiYRkxvparpn7xKwFpxqZJIeYhOz/zaktlEcVFxxB6ewd/X+XNq7+SkPUw5btQKQeYax1AxBZHzCk0XF1ihRQKPdMeVzXIRq43Yf/8emu8siIC4dFA==", "skipStoryModeChoice": true, "skipTutorial": true, - "testMission": true, - "testQuestKey": true, + "unlockAllMissions": true, + "unlockAllQuests": false, "infiniteResources": true } diff --git a/package-lock.json b/package-lock.json index 873314d5d..52e6e3b8d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -235,9 +235,9 @@ } }, "node_modules/@mongodb-js/saslprep": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.1.tgz", - "integrity": "sha512-t7c5K033joZZMspnHg/gWPE4kandgc2OxE74aYOtGKfgB9VPuVJPix0H6fhmm2erj5PBJ21mqcx34lpIGtUCsQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.4.tgz", + "integrity": "sha512-8zJ8N1x51xo9hwPh6AWnKdLGEC5N3lDa6kms1YHmFBoRhTpJR6HG8wWk0td1MVCu9cD4YBrvjZEtd5Obw0Fbnw==", "dependencies": { "sparse-bitfield": "^3.0.3" } @@ -394,7 +394,8 @@ "node_modules/@types/node": { "version": "18.16.3", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.3.tgz", - "integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==" + "integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==", + "dev": true }, "node_modules/@types/qs": { "version": "6.9.7", @@ -457,11 +458,10 @@ "integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==" }, "node_modules/@types/whatwg-url": { - "version": "8.2.2", - "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz", - "integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==", + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-11.0.4.tgz", + "integrity": "sha512-lXCmTWSHJvf0TRSO58nm978b8HJ/EdsSsEKLd3ODHFjo+3VGAyyTp4v50nWvwtzBxSMQrVOK7tcuN0zGPLICMw==", "dependencies": { - "@types/node": "*", "@types/webidl-conversions": "*" } }, @@ -1178,9 +1178,9 @@ } }, "node_modules/bson": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/bson/-/bson-6.2.0.tgz", - "integrity": "sha512-ID1cI+7bazPDyL9wYy9GaQ8gEEohWvcUl/Yf0dIdutJxnmInEEyCsb4awy/OiBfall7zBA179Pahi3vCdFze3Q==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/bson/-/bson-6.3.0.tgz", + "integrity": "sha512-balJfqwwTBddxfnidJZagCBPP/f48zj9Sdp3OJswREOgsJzHiQSaOIAtApSgDQFYgHqAvFkp53AFSqjMDZoTFw==", "engines": { "node": ">=16.20.1" } @@ -2639,13 +2639,13 @@ } }, "node_modules/mongodb": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.2.0.tgz", - "integrity": "sha512-d7OSuGjGWDZ5usZPqfvb36laQ9CPhnWkAGHT61x5P95p/8nMVeH8asloMwW6GcYFeB0Vj4CB/1wOTDG2RA9BFA==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.3.0.tgz", + "integrity": "sha512-tt0KuGjGtLUhLoU263+xvQmPHEGTw5LbcNC73EoFRYgSHwZt5tsoJC110hDyO1kjQzpgNrpdcSza9PknWN4LrA==", "dependencies": { "@mongodb-js/saslprep": "^1.1.0", "bson": "^6.2.0", - "mongodb-connection-string-url": "^2.6.0" + "mongodb-connection-string-url": "^3.0.0" }, "engines": { "node": ">=16.20.1" @@ -2684,22 +2684,22 @@ } }, "node_modules/mongodb-connection-string-url": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz", - "integrity": "sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.0.tgz", + "integrity": "sha512-t1Vf+m1I5hC2M5RJx/7AtxgABy1cZmIPQRMXw+gEIPn/cZNF3Oiy+l0UIypUwVB5trcWHq3crg2g3uAR9aAwsQ==", "dependencies": { - "@types/whatwg-url": "^8.2.1", - "whatwg-url": "^11.0.0" + "@types/whatwg-url": "^11.0.2", + "whatwg-url": "^13.0.0" } }, "node_modules/mongoose": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.0.2.tgz", - "integrity": "sha512-Vsi9GzTXjdBVzheT1HZOZ2jHNzzR9Xwb5OyLz/FvDEAhlwrRnXnuqJf0QHINUOQSm7aoyvnPks0q85HJkd6yDw==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.1.1.tgz", + "integrity": "sha512-DbLb0NsiEXmaqLOpEz+AtAsgwhRw6f25gwa1dF5R7jj6lS1D8X6uTdhBSC8GDVtOwe5Tfw2EL7nTn6hiJT3Bgg==", "dependencies": { "bson": "^6.2.0", "kareem": "2.5.1", - "mongodb": "6.2.0", + "mongodb": "6.3.0", "mpath": "0.9.0", "mquery": "5.0.0", "ms": "2.1.3", @@ -3701,14 +3701,14 @@ } }, "node_modules/tr46": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", - "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz", + "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==", "dependencies": { - "punycode": "^2.1.1" + "punycode": "^2.3.0" }, "engines": { - "node": ">=12" + "node": ">=14" } }, "node_modules/tree-kill": { @@ -3986,15 +3986,15 @@ } }, "node_modules/whatwg-url": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", - "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-13.0.0.tgz", + "integrity": "sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig==", "dependencies": { - "tr46": "^3.0.0", + "tr46": "^4.1.1", "webidl-conversions": "^7.0.0" }, "engines": { - "node": ">=12" + "node": ">=16" } }, "node_modules/which": { diff --git a/src/controllers/api/inventoryController.ts b/src/controllers/api/inventoryController.ts index bfdad3548..8f2170716 100644 --- a/src/controllers/api/inventoryController.ts +++ b/src/controllers/api/inventoryController.ts @@ -3,8 +3,8 @@ import { toInventoryResponse } from "@/src/helpers/inventoryHelpers"; import { Inventory } from "@/src/models/inventoryModels/inventoryModel"; import { Request, RequestHandler, Response } from "express"; import config from "@/config.json"; -import testMissions from "@/static/fixed_responses/testMissions.json"; -import testQuestKeys from "@/static/fixed_responses/testQuestKeys.json"; +import allMissions from "@/static/fixed_responses/allMissions.json"; +import allQuestKeys from "@/static/fixed_responses/allQuestKeys.json"; import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes"; const inventoryController: RequestHandler = async (request: Request, response: Response) => { @@ -29,8 +29,8 @@ const inventoryController: RequestHandler = async (request: Request, response: R const inventoryResponse = toInventoryResponse(inventoryJSON); - if (config.testMission) inventoryResponse.Missions = testMissions; - if (config.testQuestKey) inventoryResponse.QuestKeys = testQuestKeys; + if (config.unlockAllMissions) inventoryResponse.Missions = allMissions; + if (config.unlockAllQuests) inventoryResponse.QuestKeys = allQuestKeys; response.json(inventoryResponse); }; diff --git a/src/helpers/inventoryHelpers.ts b/src/helpers/inventoryHelpers.ts index 92c1726f7..0955ed39e 100644 --- a/src/helpers/inventoryHelpers.ts +++ b/src/helpers/inventoryHelpers.ts @@ -12,3 +12,7 @@ export const toInventoryResponse = (inventoryDatabase: IInventoryDatabase): IInv export const toOid = (objectId: Types.ObjectId) => { return { $oid: objectId.toString() } satisfies IOid; }; + +export const toMongoDate = (date: Date) => { + return { $date: { $numberLong: date.getTime().toString() } }; +}; diff --git a/src/models/inventoryModels/inventoryModel.ts b/src/models/inventoryModels/inventoryModel.ts index 91386abea..52283fd7a 100644 --- a/src/models/inventoryModels/inventoryModel.ts +++ b/src/models/inventoryModels/inventoryModel.ts @@ -1,4 +1,4 @@ -import { HydratedDocument, Model, Schema, Types, model } from "mongoose"; +import { Model, Schema, Types, model } from "mongoose"; import { IFlavourItem, IRawUpgrade, @@ -12,7 +12,34 @@ import { IMailbox, IDuviriInfo, IPendingRecipe as IPendingRecipeDatabase, - IPendingRecipeResponse + IPendingRecipeResponse, + ITypeCount, + IFocusXP, + IFocusUpgrades, + IGenericItem2, + ITypeXPItem, + IChallengeProgress, + IStepSequencer, + IAffiliation, + IShip, + INotePacks, + IShipExterior, + ICompletedJobChain, + ISeasonChallengeHistory, + IPlayerSkills, + ISettings, + IInfestedFoundry, + IConsumedSuit, + IQuestProgress, + IQuestKeyDatabase, + IQuestKeyResponse, + IFusionTreasure, + ISpectreLoadout, + IWeaponSkin, + ITauntHistory, + IPeriodicMissionCompletionDatabase, + IPeriodicMissionCompletionResponse, + ILoreFragmentScan } from "../../types/inventoryTypes/inventoryTypes"; import { IMongoDate, IOid } from "../../types/commonTypes"; import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes"; @@ -25,7 +52,29 @@ import { IOperatorConfigDatabase, IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; -import { toOid } from "@/src/helpers/inventoryHelpers"; +import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers"; + +const typeCountSchema = new Schema({ ItemType: String, ItemCount: Number }, { _id: false }); + +const focusXPSchema = new Schema( + { + AP_POWER: Number, + AP_TACTIC: Number, + AP_DEFENSE: Number, + AP_ATTACK: Number, + AP_WARD: Number + }, + { _id: false } +); + +const focusUpgradesSchema = new Schema( + { + ItemType: String, + Level: Number, + IsUniversal: Boolean + }, + { _id: false } +); const pendingRecipeSchema = new Schema( { @@ -168,10 +217,13 @@ WeaponSchema.set("toJSON", { } }); -const BoosterSchema = new Schema({ - ExpiryDate: Number, - ItemType: String -}); +const boosterSchema = new Schema( + { + ExpiryDate: Number, + ItemType: String + }, + { _id: false } +); const RawUpgrades = new Schema( { @@ -194,16 +246,19 @@ RawUpgrades.set("toJSON", { }); //TODO: find out what this is -const Upgrade = new Schema({ - UpgradeFingerprint: String, - ItemType: String +const upgrqadesSchema = new Schema( + { + UpgradeFingerprint: String, + ItemType: String + }, + { id: false } +); + +upgrqadesSchema.virtual("ItemId").get(function () { + return toOid(this._id); }); -Upgrade.virtual("ItemId").get(function () { - return { $oid: this._id.toString() } satisfies IOid; -}); - -Upgrade.set("toJSON", { +upgrqadesSchema.set("toJSON", { virtuals: true, transform(_document, returnedObject) { delete returnedObject._id; @@ -320,371 +375,639 @@ DuviriInfoSchema.set("toJSON", { } }); -const inventorySchema = new Schema({ - accountOwnerId: Schema.Types.ObjectId, - SubscribedToEmails: Number, - Created: Schema.Types.Mixed, - RewardSeed: Number, - - //Credit - RegularCredits: Number, - //Platinum - PremiumCredits: Number, - //Gift Platinum(Non trade) - PremiumCreditsFree: Number, - //Endo - FusionPoints: Number, - - //SlotAny - SuitBin: slotsBinSchema, - WeaponBin: slotsBinSchema, - SentinelBin: slotsBinSchema, - SpaceSuitBin: slotsBinSchema, - SpaceWeaponBin: slotsBinSchema, - PvpBonusLoadoutBin: slotsBinSchema, - PveBonusLoadoutBin: slotsBinSchema, - RandomModBin: slotsBinSchema, - OperatorAmpBin: slotsBinSchema, - CrewShipSalvageBin: slotsBinSchema, - MechBin: slotsBinSchema, - CrewMemberBin: slotsBinSchema, - - //How many trades do you have left - TradesRemaining: Number, - //How many Gift do you have left*(gift spends the trade) - GiftsRemaining: Number, - //Curent trade info Giving or Getting items - PendingTrades: [Schema.Types.Mixed], - - //Curent Syndicates rank\exp - Affiliations: [Schema.Types.Mixed], - //Syndicates Missions complate(Navigation->Syndicate) - CompletedSyndicates: [String], - //Daily Syndicates Exp - DailyAffiliation: Number, - DailyAffiliationPvp: Number, - DailyAffiliationLibrary: Number, - DailyAffiliationCetus: Number, - DailyAffiliationQuills: Number, - DailyAffiliationSolaris: Number, - DailyAffiliationVentkids: Number, - DailyAffiliationVox: Number, - DailyAffiliationEntrati: Number, - DailyAffiliationNecraloid: Number, - DailyAffiliationZariman: Number, - DailyAffiliationKahl: Number, - - //Daily Focus limit - DailyFocus: Number, - //you not used Focus - FocusXP: Schema.Types.Mixed, - //Curent active like Active school focuses is = "Zenurik" - FocusAbility: String, - //The treeways of the Focus school.(Active and passive Ability) - FocusUpgrades: [Schema.Types.Mixed], - - //Achievement - ChallengeProgress: [Schema.Types.Mixed], - - //Account Item like Ferrite,Form,Kuva etc - MiscItems: [Schema.Types.Mixed], - - //Non Upgrade Mods Example:I have 999 item WeaponElectricityDamageMod (only "ItemCount"+"ItemType") - RawUpgrades: [RawUpgrades], - //Upgrade Mods\Riven\Arcane Example:"UpgradeFingerprint"+"ItemType"+"" - Upgrades: [Upgrade], - - //Warframe - Suits: [suitSchema], - //Primary Weapon - LongGuns: [WeaponSchema], - //Secondary Weapon - Pistols: [WeaponSchema], - //Melee Weapon - Melee: [WeaponSchema], - //Ability Weapon like Ultimate Mech\Excalibur\Ivara etc - SpecialItems: [Schema.Types.Mixed], - //The Mandachord(Octavia) is a step sequencer - StepSequencers: [Schema.Types.Mixed], - - //Sentinel(like Helios or modular) - Sentinels: [Schema.Types.Mixed], - //Any /Sentinels/SentinelWeapons/ (like warframe weapon) - SentinelWeapons: [Schema.Types.Mixed], - //Modular Pets - MoaPets: [Schema.Types.Mixed], - - KubrowPetEggs: [Schema.Types.Mixed], - //Like PowerSuit Cat\Kubrow or etc Pets - KubrowPets: [Schema.Types.Mixed], - //Prints Cat(3 Prints)\Kubrow(2 Prints) Pets - KubrowPetPrints: [Schema.Types.Mixed], - - //Item for EquippedGear example:Scaner,LoadoutTechSummon etc - Consumables: [Schema.Types.Mixed], - //Weel Emotes+Gear - EquippedEmotes: [String], - EquippedGear: [String], - //Equipped Shawzin - EquippedInstrument: String, - ReceivedStartingGear: Boolean, - - //to use add SummonItem to Consumables+EquippedGear - //Archwing need Suits+Melee+Guns - SpaceSuits: [GenericItemSchema], - SpaceMelee: [GenericItemSchema], - SpaceGuns: [Schema.Types.Mixed], - ArchwingEnabled: Boolean, - //Mech need Suits+SpaceGuns+SpecialItem - MechSuits: [suitSchema], - ///Restoratives/HoverboardSummon (like Suit) - Hoverboards: [Schema.Types.Mixed], - - //Use Operator\Drifter - UseAdultOperatorLoadout: Boolean, - //Operator\Drifter Weapon - OperatorAmps: [Schema.Types.Mixed], - //Operator - OperatorLoadOuts: [operatorConfigSchema], - //Drifter - AdultOperatorLoadOuts: [operatorConfigSchema], - DrifterMelee: [GenericItemSchema], - DrifterGuns: [GenericItemSchema], - //ErsatzHorsePowerSuit - Horses: [GenericItemSchema], - - //Liset colors skin etc - Ships: [Schema.Types.Mixed], - // /Lotus/Types/Items/ShipDecos/ - ShipDecorations: [Schema.Types.Mixed], - - //RailJack Setting(Mods,Skin,Weapon,etc) - CrewShipHarnesses: [Schema.Types.Mixed], - //Railjack/Components(https://warframe.fandom.com/wiki/Railjack/Components) - CrewShipRawSalvage: [Schema.Types.Mixed], - - //Default RailJack - CrewShips: [Schema.Types.Mixed], - CrewShipAmmo: [Schema.Types.Mixed], - CrewShipWeapons: [Schema.Types.Mixed], - CrewShipWeaponSkins: [Schema.Types.Mixed], - - //NPC Crew and weapon - CrewMembers: [Schema.Types.Mixed], - CrewShipSalvagedWeaponSkins: [Schema.Types.Mixed], - CrewShipSalvagedWeapons: [Schema.Types.Mixed], - - //Complete Mission\Quests - Missions: [Schema.Types.Mixed], - QuestKeys: [Schema.Types.Mixed], - //item like DojoKey or Boss missions key - LevelKeys: [Schema.Types.Mixed], - //Active quests - Quests: [Schema.Types.Mixed], - - //Cosmetics like profile glyphs\Kavasa Prime Kubrow Collar\Game Theme etc - FlavourItems: [FlavourItemSchema], - - //Lunaro Weapon - Scoops: [GenericItemSchema], - - //Mastery Rank*(Need item XPInfo to rank up) - PlayerLevel: Number, - //Item Mastery Rank exp - XPInfo: [Schema.Types.Mixed], - //24h timer rank up - TrainingDate: Date, - //Retries rank up(3 time) - TrainingRetriesLeft: Number, - - //you saw last played Region when you opened the star map - LastRegionPlayed: String, - - //Blueprint - Recipes: [Schema.Types.Mixed], - //Crafting Blueprint(Item Name + CompletionDate) - PendingRecipes: [pendingRecipeSchema], - - //warframe\Weapon skins - WeaponSkins: [Schema.Types.Mixed], - - //Ayatan Item - FusionTreasures: [Schema.Types.Mixed], - //"node": "TreasureTutorial", "state": "TS_COMPLETED" - TauntHistory: [Schema.Types.Mixed], - - //noShow2FA,VisitPrimeVault etc - WebFlags: Schema.Types.Mixed, - //Id CompletedAlerts - CompletedAlerts: [String], - - //Warframe\Duviri - StoryModeChoice: String, - - //Alert->Kuva Siphon - PeriodicMissionCompletions: [Schema.Types.Mixed], - - //Codex->LoreFragment - LoreFragmentScans: [Schema.Types.Mixed], - - //Resource,Credit,Affinity etc or Bless any boosters - Boosters: [BoosterSchema], - BlessingCooldown: Schema.Types.Mixed, - - //the color your clan requests like Items/Research/DojoColors/DojoColorPlainsB - ActiveDojoColorResearch: String, - - SentientSpawnChanceBoosters: Schema.Types.Mixed, - - QualifyingInvasions: [Schema.Types.Mixed], - FactionScores: [Number], - - //Have only Suit+Pistols+LongGuns+Melee+ItemType(BronzeSpectre,GoldSpectre,PlatinumSpectreArmy,SilverSpectreArmy) - //"/Lotus/Types/Game/SpectreArmies/BronzeSpectreArmy": "Vapor Specter Regiment", - SpectreLoadouts: [Schema.Types.Mixed], - //If you want change Spectre Gear id - PendingSpectreLoadouts: [Schema.Types.Mixed], - - //New quest Email spam - //example:"ItemType": "/Lotus/Types/Keys/RailJackBuildQuest/RailjackBuildQuestEmailItem", - EmailItems: [Schema.Types.Mixed], - - //Profile->Wishlist - Wishlist: [String], - - //https://warframe.fandom.com/wiki/Alignment - //like "Alignment": { "Wisdom": 9, "Alignment": 1 }, - Alignment: Schema.Types.Mixed, - AlignmentReplay: Schema.Types.Mixed, - - //https://warframe.fandom.com/wiki/Sortie - CompletedSorties: [String], - LastSortieReward: [Schema.Types.Mixed], - - //Resource_Drone[Uselees stuff] - Drones: [Schema.Types.Mixed], - - //Active profile ico - ActiveAvatarImageType: String, - - // open location store like EidolonPlainsDiscoverable or OrbVallisCaveDiscoverable - DiscoveredMarkers: [Schema.Types.Mixed], - //Open location mission like "JobId" + "StageCompletions" - CompletedJobs: [Schema.Types.Mixed], - - //Game mission\ivent score example "Tag": "WaterFight", "Best": 170, "Count": 1258, - PersonalGoalProgress: [Schema.Types.Mixed], - - //Setting interface Style - ThemeStyle: String, - ThemeBackground: String, - ThemeSounds: String, - - //Daily LoginRewards - LoginMilestoneRewards: [String], - - //You first Dialog with NPC or use new Item - NodeIntrosCompleted: [String], - - //https://warframe.fandom.com/wiki/Heist - //ProfitTaker(1-4) Example:"LocationTag": "EudicoHeists", "Jobs":Mission name - CompletedJobChains: [Schema.Types.Mixed], - //Night Wave Challenge - SeasonChallengeHistory: [Schema.Types.Mixed], - - //Cephalon Simaris Entries Example:"TargetType"+"Scans"(1-10)+"Completed": true|false - LibraryPersonalProgress: [Schema.Types.Mixed], - //Cephalon Simaris Daily Task - LibraryAvailableDailyTaskInfo: Schema.Types.Mixed, - - //https://warframe.fandom.com/wiki/Invasion - InvasionChainProgress: [Schema.Types.Mixed], - - //https://warframe.fandom.com/wiki/Parazon - DataKnives: [GenericItemSchema], - - //CorpusLich or GrineerLich - NemesisAbandonedRewards: [String], - //CorpusLich\KuvaLich - NemesisHistory: [Schema.Types.Mixed], - LastNemesisAllySpawnTime: Schema.Types.Mixed, - - //TradingRulesConfirmed,ShowFriendInvNotifications(Option->Social) - Settings: Schema.Types.Mixed, - - //Railjack craft - //https://warframe.fandom.com/wiki/Rising_Tide - PersonalTechProjects: [Schema.Types.Mixed], - - //Modulars lvl and exp(Railjack|Duviri) - //https://warframe.fandom.com/wiki/Intrinsics - PlayerSkills: Schema.Types.Mixed, - - //TradeBannedUntil data - TradeBannedUntil: Schema.Types.Mixed, - - //https://warframe.fandom.com/wiki/Helminth - InfestedFoundry: Schema.Types.Mixed, - NextRefill: Schema.Types.Mixed, - - //Purchase this new permanent skin from the Lotus customization options in Personal Quarters located in your Orbiter. - //https://warframe.fandom.com/wiki/Lotus#The_New_War - LotusCustomization: Schema.Types.Mixed, - - //Progress+Rank+ItemType(ZarimanPumpShotgun) - //https://warframe.fandom.com/wiki/Incarnon - EvolutionProgress: [Schema.Types.Mixed], - - //Unknown and system - DuviriInfo: DuviriInfoSchema, - Mailbox: MailboxSchema, - KahlLoadOuts: [Schema.Types.Mixed], - HandlerPoints: Number, - ChallengesFixVersion: Number, - PlayedParkourTutorial: Boolean, - SubscribedToEmailsPersonalized: Number, - LastInventorySync: Schema.Types.Mixed, - ActiveLandscapeTraps: [Schema.Types.Mixed], - RepVotes: [Schema.Types.Mixed], - LeagueTickets: [Schema.Types.Mixed], - HasContributedToDojo: Boolean, - HWIDProtectEnabled: Boolean, - LoadOutPresets: { type: Schema.Types.ObjectId, ref: "Loadout" }, - CurrentLoadOutIds: [Schema.Types.Mixed], - RandomUpgradesIdentified: Number, - BountyScore: Number, - ChallengeInstanceStates: [Schema.Types.Mixed], - RecentVendorPurchases: [Schema.Types.Mixed], - Robotics: [Schema.Types.Mixed], - UsedDailyDeals: [Schema.Types.Mixed], - CollectibleSeries: [Schema.Types.Mixed], - HasResetAccount: Boolean, - - //Discount Coupon - PendingCoupon: Schema.Types.Mixed, - //Like BossAladV,BossCaptainVor come for you on missions % chance - DeathMarks: [String], - //Zanuka - Harvestable: Boolean, - //Grustag three - DeathSquadable: Boolean +const GenericItemSchema2 = new Schema({ + ItemType: String, + ItemName: String, + XP: Number, + UpgradeVer: Number, //this is probably __v + Features: Number, + Polarized: Number, + CustomizationSlotPurchases: Number, + ModSlotPurchases: Number, + FocusLens: String, + Expiry: Date, //TODO: needs conversion + Polarity: [polaritySchema], + Configs: [ItemConfigSchema], + ModularParts: [String], + SkillTree: String, + UpgradeType: String, + UpgradeFingerprint: String, + OffensiveUpgrade: String, + DefensiveUpgrade: String, + UpgradesExpiry: Date, //TODO: needs conversion + ArchonCrystalUpgrades: [] }); +const TypeXPItemSchema = new Schema( + { + ItemType: String, + XP: Number + }, + { _id: false } +); + +const challengeProgressSchema = new Schema( + { + Progress: Number, + Name: String, + Completed: [String] + }, + { _id: false } +); + +const notePacksSchema = new Schema( + { + MELODY: String, + BASS: String, + PERCUSSION: String + }, + { _id: false } +); + +const StepSequencersSchema = new Schema( + { + NotePacks: notePacksSchema, + FingerPrint: String, + Name: String + }, + { id: false } +); + +StepSequencersSchema.virtual("ItemId").get(function () { + return { $oid: this._id.toString() } satisfies IOid; +}); + +StepSequencersSchema.set("toJSON", { + virtuals: true, + transform(_document, returnedObject) { + delete returnedObject._id; + delete returnedObject.__v; + } +}); + +const affiliationsSchema = new Schema( + { + Initiated: Boolean, + Standing: Number, + Title: String, + FreeFavorsEarned: [Number], + FreeFavorsUsed: [Number], + Tag: String + }, + { _id: false } +); + +const shipExteriorSchema = new Schema( + { + SkinFlavourItem: String, + Colors: colorSchema, //TODO: perhaps too many colors here + ShipAttachments: { HOOD_ORNAMENT: String } + }, + { _id: false } +); + +const shipSchema = new Schema({ + ItemType: String, + ShipExterior: shipExteriorSchema, + AirSupportPower: String +}); + +shipSchema.virtual("ItemId").get(function () { + return { $oid: this._id.toString() }; +}); + +shipSchema.set("toJSON", { + virtuals: true, + transform(_document, returnedObject) { + delete returnedObject._id; + delete returnedObject.__v; + } +}); + +const completedJobChainsSchema = new Schema( + { + LocationTag: String, + Jobs: [String] + }, + { _id: false } +); + +const seasonChallengeHistorySchema = new Schema( + { + challenge: String, + id: String + }, + { _id: false } +); + +//TODO: check whether this is complete +const playerSkillsSchema = new Schema( + { + LPP_SPACE: Number, + LPP_DRIFTER: Number, + LPS_NONE: Number, + LPS_PILOTING: Number, + LPS_GUNNERY: Number, + LPS_TACTICAL: Number, + LPS_ENGINEERING: Number, + LPS_COMMAND: Number, + LPS_DRIFT_COMBAT: Number, + LPS_DRIFT_RIDING: Number, + LPS_DRIFT_OPPORTUNITY: Number, + LPS_DRIFT_ENDURANCE: Number + }, + { _id: false } +); + +const settingsSchema = new Schema({ + FriendInvRestriction: String, + GiftMode: String, + GuildInvRestriction: String, + ShowFriendInvNotifications: Boolean, + TradingRulesConfirmed: Boolean +}); + +const consumedSchuitsSchema = new Schema({ + s: String, + c: colorSchema +}); + +const infestedFoundrySchema = new Schema({ + Name: String, + Resources: [typeCountSchema], + Slots: Number, + XP: Number, + ConsumedSuits: [consumedSchuitsSchema], + InvigorationIndex: Number, + InvigorationSuitOfferings: [String], + InvigorationsApplied: Number +}); + +const questProgressSchema = new Schema({ + c: Number, + i: Boolean, + m: Boolean, + b: [] +}); + +const questKeysSchema = new Schema( + { + Progress: [questProgressSchema], + unlock: Boolean, + Completed: Boolean, + //CustomData: Schema.Types.Mixed, + CompletionDate: Date, + ItemType: String + }, + { + _id: false + } +); + +questKeysSchema.set("toJSON", { + transform(_doc, ret, _options) { + const questKeysDatabase = ret as IQuestKeyDatabase; + + if (questKeysDatabase.CompletionDate) { + (questKeysDatabase as IQuestKeyResponse).CompletionDate = toMongoDate(questKeysDatabase.CompletionDate); + } + } +}); + +const fusionTreasuresSchema = new Schema().add(typeCountSchema).add({ Sockets: Number }); + +const spectreLoadoutsSchema = new Schema( + { + LongGuns: String, + Melee: String, + Pistols: String, + PistolsFeatures: Number, + PistolsModularParts: [String], + Suits: String, + ItemType: String + }, + { _id: false } +); + +const weaponSkinsSchema = new Schema( + { + ItemType: String + }, + { id: false } +); + +weaponSkinsSchema.virtual("ItemId").get(function () { + return { $oid: this._id.toString() }; +}); + +weaponSkinsSchema.set("toJSON", { virtuals: true }); + +const tauntHistorySchema = new Schema( + { + node: String, + state: String + }, + { _id: false } +); + +const periodicMissionCompletionsSchema = new Schema( + { + date: Date, + tag: String, + count: Number + }, + { _id: false } +); + +periodicMissionCompletionsSchema.set("toJSON", { + transform(_doc, ret, _options) { + const periodicMissionCompletionDatabase = ret as IPeriodicMissionCompletionDatabase; + + (periodicMissionCompletionDatabase as unknown as IPeriodicMissionCompletionResponse).date = toMongoDate( + periodicMissionCompletionDatabase.date + ); + } +}); + +const loreFragmentScansSchema = new Schema( + { + Progress: Number, + Region: String, + ItemType: String + }, + { _id: false } +); + +const inventorySchema = new Schema( + { + accountOwnerId: Schema.Types.ObjectId, + SubscribedToEmails: Number, + Created: Date, + RewardSeed: Number, + + //Credit + RegularCredits: Number, + //Platinum + PremiumCredits: Number, + //Gift Platinum(Non trade) + PremiumCreditsFree: Number, + //Endo + FusionPoints: Number, + + //Slots + SuitBin: slotsBinSchema, + WeaponBin: slotsBinSchema, + SentinelBin: slotsBinSchema, + SpaceSuitBin: slotsBinSchema, + SpaceWeaponBin: slotsBinSchema, + PvpBonusLoadoutBin: slotsBinSchema, + PveBonusLoadoutBin: slotsBinSchema, + RandomModBin: slotsBinSchema, + OperatorAmpBin: slotsBinSchema, + CrewShipSalvageBin: slotsBinSchema, + MechBin: slotsBinSchema, + CrewMemberBin: slotsBinSchema, + + //How many trades do you have left + TradesRemaining: Number, + //How many Gift do you have left*(gift spends the trade) + GiftsRemaining: Number, + //Curent trade info Giving or Getting items + PendingTrades: [Schema.Types.Mixed], + + //Curent Syndicates rank\exp + Affiliations: [affiliationsSchema], + //Syndicates Missions complate(Navigation->Syndicate) + CompletedSyndicates: [String], + //Daily Syndicates Exp + DailyAffiliation: Number, + DailyAffiliationPvp: Number, + DailyAffiliationLibrary: Number, + DailyAffiliationCetus: Number, + DailyAffiliationQuills: Number, + DailyAffiliationSolaris: Number, + DailyAffiliationVentkids: Number, + DailyAffiliationVox: Number, + DailyAffiliationEntrati: Number, + DailyAffiliationNecraloid: Number, + DailyAffiliationZariman: Number, + DailyAffiliationKahl: Number, + + //Daily Focus limit + DailyFocus: Number, + //Focus XP per School + FocusXP: focusXPSchema, + //Curent active like Active school focuses is = "Zenurik" + FocusAbility: String, + //The treeways of the Focus school.(Active and passive Ability) + FocusUpgrades: [focusUpgradesSchema], + + //Achievement + ChallengeProgress: [challengeProgressSchema], + + //Account Item like Ferrite,Form,Kuva etc + MiscItems: [typeCountSchema], + + //Non Upgrade Mods Example:I have 999 item WeaponElectricityDamageMod (only "ItemCount"+"ItemType") + RawUpgrades: [RawUpgrades], + //Upgrade Mods\Riven\Arcane Example:"UpgradeFingerprint"+"ItemType"+"" + Upgrades: [upgrqadesSchema], + + //Warframe + Suits: [suitSchema], + //Primary Weapon + LongGuns: [WeaponSchema], + //Secondary Weapon + Pistols: [WeaponSchema], + //Melee Weapon + Melee: [WeaponSchema], + //Ability Weapon like Ultimate Mech\Excalibur\Ivara etc + SpecialItems: [GenericItemSchema2], + //The Mandachord(Octavia) is a step sequencer + StepSequencers: [StepSequencersSchema], + + //Sentinel(like Helios or modular) + Sentinels: [Schema.Types.Mixed], + //Any /Sentinels/SentinelWeapons/ (like warframe weapon) + SentinelWeapons: [Schema.Types.Mixed], + //Modular Pets + MoaPets: [Schema.Types.Mixed], + + KubrowPetEggs: [Schema.Types.Mixed], + //Like PowerSuit Cat\Kubrow or etc Pets + KubrowPets: [Schema.Types.Mixed], + //Prints Cat(3 Prints)\Kubrow(2 Prints) Pets + KubrowPetPrints: [Schema.Types.Mixed], + + //Item for EquippedGear example:Scaner,LoadoutTechSummon etc + Consumables: [typeCountSchema], + //Weel Emotes+Gear + EquippedEmotes: [String], + EquippedGear: [String], + //Equipped Shawzin + EquippedInstrument: String, + ReceivedStartingGear: Boolean, + + //to use add SummonItem to Consumables+EquippedGear + //Archwing need Suits+Melee+Guns + SpaceSuits: [GenericItemSchema], + SpaceMelee: [GenericItemSchema], + SpaceGuns: [Schema.Types.Mixed], + ArchwingEnabled: Boolean, + //Mech need Suits+SpaceGuns+SpecialItem + MechSuits: [suitSchema], + ///Restoratives/HoverboardSummon (like Suit) + Hoverboards: [Schema.Types.Mixed], + + //Use Operator\Drifter + UseAdultOperatorLoadout: Boolean, + //Operator\Drifter Weapon + OperatorAmps: [Schema.Types.Mixed], + //Operator + OperatorLoadOuts: [operatorConfigSchema], + //Drifter + AdultOperatorLoadOuts: [operatorConfigSchema], + DrifterMelee: [GenericItemSchema], + DrifterGuns: [GenericItemSchema], + //ErsatzHorsePowerSuit + Horses: [GenericItemSchema], + + //LandingCraft like Liset + Ships: [shipSchema], + // /Lotus/Types/Items/ShipDecos/ + ShipDecorations: [typeCountSchema], + + //RailJack Setting(Mods,Skin,Weapon,etc) + CrewShipHarnesses: [Schema.Types.Mixed], + //Railjack/Components(https://warframe.fandom.com/wiki/Railjack/Components) + CrewShipRawSalvage: [Schema.Types.Mixed], + + //Default RailJack + CrewShips: [Schema.Types.Mixed], + CrewShipAmmo: [typeCountSchema], + CrewShipWeapons: [Schema.Types.Mixed], + CrewShipWeaponSkins: [Schema.Types.Mixed], + + //NPC Crew and weapon + CrewMembers: [Schema.Types.Mixed], + CrewShipSalvagedWeaponSkins: [Schema.Types.Mixed], + CrewShipSalvagedWeapons: [Schema.Types.Mixed], + + //Complete Mission\Quests + Missions: [Schema.Types.Mixed], + QuestKeys: [questKeysSchema], + //item like DojoKey or Boss missions key + LevelKeys: [Schema.Types.Mixed], + //Active quests + Quests: [Schema.Types.Mixed], + + //Cosmetics like profile glyphs\Kavasa Prime Kubrow Collar\Game Theme etc + FlavourItems: [FlavourItemSchema], + + //Lunaro Weapon + Scoops: [GenericItemSchema], + + //Mastery Rank*(Need item XPInfo to rank up) + PlayerLevel: Number, + //Item Mastery Rank exp + XPInfo: [TypeXPItemSchema], + //Mastery Rank next availability + TrainingDate: Date, + //Retries rank up(3 time) + TrainingRetriesLeft: Number, + + //you saw last played Region when you opened the star map + LastRegionPlayed: String, + + //Blueprints for Foundry + Recipes: [typeCountSchema], + //Crafting Blueprint(Item Name + CompletionDate) + PendingRecipes: [pendingRecipeSchema], + + //Skins for Suits, Weapons etc. + WeaponSkins: [weaponSkinsSchema], + + //Ayatan Item + FusionTreasures: [fusionTreasuresSchema], + //"node": "TreasureTutorial", "state": "TS_COMPLETED" + TauntHistory: [tauntHistorySchema], + + //noShow2FA,VisitPrimeVault etc + WebFlags: Schema.Types.Mixed, + //Id CompletedAlerts + CompletedAlerts: [String], + + //Warframe\Duviri + StoryModeChoice: String, + + //Alert->Kuva Siphon + PeriodicMissionCompletions: [periodicMissionCompletionsSchema], + + //Codex->LoreFragment + LoreFragmentScans: [loreFragmentScansSchema], + + //Resource,Credit,Affinity etc or Bless any boosters + Boosters: [boosterSchema], + BlessingCooldown: Date, // Date convert to IMongoDate + + //the color your clan requests like Items/Research/DojoColors/DojoColorPlainsB + ActiveDojoColorResearch: String, + + SentientSpawnChanceBoosters: Schema.Types.Mixed, + + QualifyingInvasions: [Schema.Types.Mixed], + FactionScores: [Number], + + //Have only Suit+Pistols+LongGuns+Melee+ItemType(BronzeSpectre,GoldSpectre,PlatinumSpectreArmy,SilverSpectreArmy) + //"/Lotus/Types/Game/SpectreArmies/BronzeSpectreArmy": "Vapor Specter Regiment", + SpectreLoadouts: [spectreLoadoutsSchema], + //If you want change Spectre Gear id + PendingSpectreLoadouts: [Schema.Types.Mixed], + + //New Quest Email + EmailItems: [TypeXPItemSchema], + + //Profile->Wishlist + Wishlist: [String], + + //https://warframe.fandom.com/wiki/Alignment + //like "Alignment": { "Wisdom": 9, "Alignment": 1 }, + Alignment: Schema.Types.Mixed, + AlignmentReplay: Schema.Types.Mixed, + + //https://warframe.fandom.com/wiki/Sortie + CompletedSorties: [String], + LastSortieReward: [Schema.Types.Mixed], + + //Resource_Drone[Uselees stuff] + Drones: [Schema.Types.Mixed], + + //Active profile ico + ActiveAvatarImageType: String, + + // open location store like EidolonPlainsDiscoverable or OrbVallisCaveDiscoverable + DiscoveredMarkers: [Schema.Types.Mixed], + //Open location mission like "JobId" + "StageCompletions" + CompletedJobs: [Schema.Types.Mixed], + + //Game mission\ivent score example "Tag": "WaterFight", "Best": 170, "Count": 1258, + PersonalGoalProgress: [Schema.Types.Mixed], + + //Setting interface Style + ThemeStyle: String, + ThemeBackground: String, + ThemeSounds: String, + + //Daily LoginRewards + LoginMilestoneRewards: [String], + + //You first Dialog with NPC or use new Item + NodeIntrosCompleted: [String], + + //https://warframe.fandom.com/wiki/Heist + //ProfitTaker(1-4) Example:"LocationTag": "EudicoHeists", "Jobs":Mission name + CompletedJobChains: [completedJobChainsSchema], + //Night Wave Challenge + SeasonChallengeHistory: [seasonChallengeHistorySchema], + + //Cephalon Simaris Entries Example:"TargetType"+"Scans"(1-10)+"Completed": true|false + LibraryPersonalProgress: [Schema.Types.Mixed], + //Cephalon Simaris Daily Task + LibraryAvailableDailyTaskInfo: Schema.Types.Mixed, + + //https://warframe.fandom.com/wiki/Invasion + InvasionChainProgress: [Schema.Types.Mixed], + + //https://warframe.fandom.com/wiki/Parazon + DataKnives: [GenericItemSchema], + + //CorpusLich or GrineerLich + NemesisAbandonedRewards: [String], + //CorpusLich\KuvaLich + NemesisHistory: [Schema.Types.Mixed], + LastNemesisAllySpawnTime: Schema.Types.Mixed, + + //TradingRulesConfirmed,ShowFriendInvNotifications(Option->Social) + Settings: settingsSchema, + + //Railjack craft + //https://warframe.fandom.com/wiki/Rising_Tide + PersonalTechProjects: [Schema.Types.Mixed], + + //Modulars lvl and exp(Railjack|Duviri) + //https://warframe.fandom.com/wiki/Intrinsics + PlayerSkills: playerSkillsSchema, + + //TradeBannedUntil data + TradeBannedUntil: Schema.Types.Mixed, + + //https://warframe.fandom.com/wiki/Helminth + InfestedFoundry: infestedFoundrySchema, + + NextRefill: Schema.Types.Mixed, // Date, convert to IMongoDate + + //Purchase this new permanent skin from the Lotus customization options in Personal Quarters located in your Orbiter. + //https://warframe.fandom.com/wiki/Lotus#The_New_War + LotusCustomization: Schema.Types.Mixed, + + //Progress+Rank+ItemType(ZarimanPumpShotgun) + //https://warframe.fandom.com/wiki/Incarnon + EvolutionProgress: [Schema.Types.Mixed], + + //Unknown and system + DuviriInfo: DuviriInfoSchema, + Mailbox: MailboxSchema, + KahlLoadOuts: [Schema.Types.Mixed], + HandlerPoints: Number, + ChallengesFixVersion: Number, + PlayedParkourTutorial: Boolean, + SubscribedToEmailsPersonalized: Number, + LastInventorySync: Schema.Types.Mixed, + ActiveLandscapeTraps: [Schema.Types.Mixed], + RepVotes: [Schema.Types.Mixed], + LeagueTickets: [Schema.Types.Mixed], + HasContributedToDojo: Boolean, + HWIDProtectEnabled: Boolean, + LoadOutPresets: { type: Schema.Types.ObjectId, ref: "Loadout" }, + CurrentLoadOutIds: [Schema.Types.Mixed], + RandomUpgradesIdentified: Number, + BountyScore: Number, + ChallengeInstanceStates: [Schema.Types.Mixed], + RecentVendorPurchases: [Schema.Types.Mixed], + Robotics: [Schema.Types.Mixed], + UsedDailyDeals: [Schema.Types.Mixed], + CollectibleSeries: [Schema.Types.Mixed], + HasResetAccount: Boolean, + + //Discount Coupon + PendingCoupon: Schema.Types.Mixed, + //Like BossAladV,BossCaptainVor come for you on missions % chance + DeathMarks: [String], + //Zanuka + Harvestable: Boolean, + //Grustag three + DeathSquadable: Boolean + }, + { timestamps: { createdAt: "Created", updatedAt: "LastInventorySync" } } +); + inventorySchema.set("toJSON", { transform(_document, returnedObject) { delete returnedObject._id; delete returnedObject.__v; - const trainingDate = (returnedObject as IInventoryDatabaseDocument).TrainingDate; + const inventoryDatabase = returnedObject as IInventoryDatabase; + const inventoryResponse = returnedObject as IInventoryResponse; - (returnedObject as IInventoryResponse).TrainingDate = { - $date: { - $numberLong: trainingDate.getTime().toString() - } - } satisfies IMongoDate; + inventoryResponse.TrainingDate = toMongoDate(inventoryDatabase.TrainingDate); + inventoryResponse.Created = toMongoDate(inventoryDatabase.Created); + if (inventoryResponse.BlessingCooldown) { + inventoryResponse.BlessingCooldown = toMongoDate(inventoryDatabase.BlessingCooldown); + } } }); +// type overwrites for subdocuments/subdocument arrays type InventoryDocumentProps = { Suits: Types.DocumentArray; LongGuns: Types.DocumentArray; @@ -707,6 +1030,4 @@ type InventoryDocumentProps = { type InventoryModelType = Model; -const Inventory = model("Inventory", inventorySchema); - -export { Inventory }; +export const Inventory = model("Inventory", inventorySchema); diff --git a/src/types/inventoryTypes/inventoryTypes.ts b/src/types/inventoryTypes/inventoryTypes.ts index 924c373cd..b7b5f1fa2 100644 --- a/src/types/inventoryTypes/inventoryTypes.ts +++ b/src/types/inventoryTypes/inventoryTypes.ts @@ -15,16 +15,66 @@ import { IOperatorLoadOutSigcol, IWeaponDatabase } from "@/src/types/inventoryTy //Document extends will be deleted soon. TODO: delete and migrate uses to ... export interface IInventoryDatabaseDocument extends IInventoryDatabase, Document {} export interface IInventoryDatabase - extends Omit { + extends Omit< + IInventoryResponse, + "TrainingDate" | "LoadOutPresets" | "Mailbox" | "PendingRecipes" | "Created" | "QuestKeys" | "BlessingCooldown" + > { accountOwnerId: Types.ObjectId; + Created: Date; TrainingDate: Date; // TrainingDate changed from IMongoDate to Date LoadOutPresets: Types.ObjectId; // LoadOutPresets changed from ILoadOutPresets to Types.ObjectId for population Mailbox: Types.ObjectId; // Mailbox changed from IMailbox to Types.ObjectId PendingRecipes: IPendingRecipe[]; + QuestKeys: IQuestKeyDatabase[]; + BlessingCooldown: Date; } export interface IInventoryResponseDocument extends IInventoryResponse, Document {} +export interface IQuestKeyDatabase { + Progress?: IQuestProgress[]; + unlock?: boolean; + Completed?: boolean; + CustomData?: string; //TODO: check whether this actually exists + ItemType: string; + CompletionDate?: Date; +} + +export interface IFocusUpgrades { + ItemType: string; + Level: number; + IsUniversal: boolean; +} + +export interface ITypeCount { + ItemType: string; + ItemCount: number; +} + +export interface IGenericItem2 { + ItemType: string; + ItemName: string; + ItemId: IOid; + XP: number; + UpgradeVer: number; + Features: number; + Polarized: number; + CustomizationSlotPurchases: number; + ModSlotPurchases: number; + FocusLens: string; + Expiry: IMongoDate; + Polarity: IPolarity[]; + Configs: IItemConfig[]; + ModularParts: string[]; + SkillTree: string; + UpgradeType: string; + UpgradeFingerprint: string; + OffensiveUpgrade: string; + DefensiveUpgrade: string; + UpgradesExpiry: IMongoDate; + ArchonCrystalUpgrades: []; +} + export interface IGenericItem { ItemType: string; XP?: number; @@ -91,7 +141,7 @@ export interface IInventoryResponse { Pistols: IWeaponDatabase[]; Melee: IWeaponDatabase[]; Ships: IShip[]; - QuestKeys: IQuestKey[]; + QuestKeys: IQuestKeyResponse[]; FlavourItems: IFlavourItem[]; Scoops: IGenericItem[]; TrainingRetriesLeft: number; @@ -100,8 +150,8 @@ export interface IInventoryResponse { Missions: IMission[]; RandomUpgradesIdentified: number; LastRegionPlayed: string; - XPInfo: IEmailItem[]; - Recipes: IConsumable[]; + XPInfo: ITypeXPItem[]; + Recipes: ITypeCount[]; WeaponSkins: IWeaponSkin[]; PendingRecipes: IPendingRecipeResponse[]; TrainingDate: IMongoDate; @@ -116,7 +166,7 @@ export interface IInventoryResponse { LevelKeys: IConsumable[]; TauntHistory: ITauntHistory[]; StoryModeChoice: string; - PeriodicMissionCompletions: IPeriodicMissionCompletion[]; + PeriodicMissionCompletions: IPeriodicMissionCompletionDatabase[]; KubrowPetEggs: IKubrowPetEgg[]; LoreFragmentScans: ILoreFragmentScan[]; EquippedEmotes: string[]; @@ -135,7 +185,7 @@ export interface IInventoryResponse { SpectreLoadouts: ISpectreLoadout[]; SentinelWeapons: IWeaponDatabase[]; Sentinels: IWeaponDatabase[]; - EmailItems: IEmailItem[]; + EmailItems: ITypeXPItem[]; CompletedSyndicates: string[]; FocusXP: IFocusXP; Wishlist: string[]; @@ -160,7 +210,7 @@ export interface IInventoryResponse { AlignmentReplay: IAlignment; PersonalGoalProgress: IPersonalGoalProgress[]; DailyAffiliationSolaris: number; - SpecialItems: ISpecialItem[]; + SpecialItems: IGenericItem2[]; ThemeStyle: string; ThemeBackground: string; ThemeSounds: string; @@ -395,17 +445,27 @@ export interface ISlot { } export interface ICustomization { - CrewshipInterior: ITerior; + CrewshipInterior: IShipExterior; } -export interface ITerior { +export interface IShipExterior { SkinFlavourItem: string; - Colors: IColor; + Colors: IShipExteriorColors; ShipAttachments?: IShipAttachments; } +//TODO: check whether it makes sense to use this specifity of color. +export interface IShipExteriorColors { + t0: number; + t1: number; + t2: number; + t3: number; + m0: number; + en: number; +} + export interface IShipAttachments { - HOOD_ORNAMENT: string; + HOOD_ORNAMENT: string; //TODO: Others are probably possible } export interface IFlavourItem { @@ -452,7 +512,7 @@ export interface IDrone { RepairStart?: IMongoDate; } -export interface IEmailItem { +export interface ITypeXPItem { ItemType: string; XP: number; } @@ -511,7 +571,7 @@ export interface ISigcol { export interface IInfestedFoundry { Name: string; - Resources: IResource[]; + Resources: ITypeCount[]; Slots: number; XP: number; ConsumedSuits: IConsumedSuit[]; @@ -525,11 +585,6 @@ export interface IConsumedSuit { c?: IColor; } -export interface IResource { - ItemType: string; - Count: number; -} - export interface IInvasionChainProgress { id: IOid; count: number; @@ -881,12 +936,16 @@ export enum GivingSlotOrderInfo { LotusUpgradesModsPistolDualStatElectEventPistolMod = "/Lotus/Upgrades/Mods/Pistol/DualStat/ElectEventPistolMod" } -export interface IPeriodicMissionCompletion { - date: IMongoDate; +export interface IPeriodicMissionCompletionDatabase { + date: Date; tag: string; count?: number; } +export interface IPeriodicMissionCompletionResponse extends Omit { + date: IMongoDate; +} + export interface IPersonalGoalProgress { Count: number; Tag: string; @@ -923,16 +982,11 @@ export interface IPlayerSkills { LPS_DRIFT_ENDURANCE: number; } -export interface IQuestKey { - Progress?: IProgress[]; - unlock?: boolean; - Completed?: boolean; - CustomData?: string; - ItemType: string; +export interface IQuestKeyResponse extends Omit { CompletionDate?: IMongoDate; } -export interface IProgress { +export interface IQuestProgress { c: number; i: boolean; m: boolean; @@ -964,7 +1018,7 @@ export interface ISettings { export interface IShip { ItemType: string; - ShipExterior: ITerior; + ShipExterior: IShipExterior; AirSupportPower: string; ItemId: IOid; } @@ -989,28 +1043,6 @@ export interface ISpaceGunConfig { Upgrades?: string[]; } -export interface ISpecialItem { - ItemType: string; - Configs: ISpecialItemConfig[]; - XP?: number; - UpgradeVer?: number; - Features: number; - ItemId: IOid; - Polarized?: number; - Polarity?: IPolarity[]; - ModSlotPurchases?: number; -} - -export interface ISpecialItemConfig { - Upgrades?: string[]; - pricol?: IColor; - Skins?: string[]; - attcol?: IColor; - eyecol?: IPurpleCol; - sigcol?: IPurpleCol; - Name?: string; -} - export interface IPurpleCol { en: number; } diff --git a/static/fixed_responses/testMissions.json b/static/fixed_responses/allMissions.json similarity index 100% rename from static/fixed_responses/testMissions.json rename to static/fixed_responses/allMissions.json diff --git a/static/fixed_responses/testQuestKeys.json b/static/fixed_responses/allQuestKeys.json similarity index 100% rename from static/fixed_responses/testQuestKeys.json rename to static/fixed_responses/allQuestKeys.json diff --git a/static/fixed_responses/postTutorialInventory.json b/static/fixed_responses/postTutorialInventory.json index 9bcab784e..53af63936 100644 --- a/static/fixed_responses/postTutorialInventory.json +++ b/static/fixed_responses/postTutorialInventory.json @@ -1,6 +1,5 @@ { "SubscribedToEmails": 0, - "Created": { "$date": { "$numberLong": "1685829131" } }, "SubscribedToEmailsPersonalized": 0, "RewardSeed": -5604904486637265640, "CrewMemberBin": { "Slots": 3 },