forked from OpenWF/SpaceNinjaServer
		
	feat: more inventory schemas (#131)
This commit is contained in:
		
							parent
							
								
									8156036203
								
							
						
					
					
						commit
						91ced2c75b
					
				
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -11,3 +11,6 @@ yarn.lock
 | 
			
		||||
 | 
			
		||||
# logs
 | 
			
		||||
/logs
 | 
			
		||||
 | 
			
		||||
# MongoDB VSCode extension playground scripts
 | 
			
		||||
/database_scripts
 | 
			
		||||
@ -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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										68
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										68
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -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": {
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -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() } };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -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<ITypeCount>({ ItemType: String, ItemCount: Number }, { _id: false });
 | 
			
		||||
 | 
			
		||||
const focusXPSchema = new Schema<IFocusXP>(
 | 
			
		||||
    {
 | 
			
		||||
        AP_POWER: Number,
 | 
			
		||||
        AP_TACTIC: Number,
 | 
			
		||||
        AP_DEFENSE: Number,
 | 
			
		||||
        AP_ATTACK: Number,
 | 
			
		||||
        AP_WARD: Number
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const focusUpgradesSchema = new Schema<IFocusUpgrades>(
 | 
			
		||||
    {
 | 
			
		||||
        ItemType: String,
 | 
			
		||||
        Level: Number,
 | 
			
		||||
        IsUniversal: Boolean
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const pendingRecipeSchema = new Schema<IPendingRecipeDatabase>(
 | 
			
		||||
    {
 | 
			
		||||
@ -168,10 +217,13 @@ WeaponSchema.set("toJSON", {
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
const BoosterSchema = new Schema<IBooster>({
 | 
			
		||||
const boosterSchema = new Schema<IBooster>(
 | 
			
		||||
    {
 | 
			
		||||
        ExpiryDate: Number,
 | 
			
		||||
        ItemType: String
 | 
			
		||||
});
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const RawUpgrades = new Schema<IRawUpgrade>(
 | 
			
		||||
    {
 | 
			
		||||
@ -194,16 +246,19 @@ RawUpgrades.set("toJSON", {
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
//TODO: find out what this is
 | 
			
		||||
const Upgrade = new Schema({
 | 
			
		||||
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,10 +375,274 @@ DuviriInfoSchema.set("toJSON", {
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
 | 
			
		||||
const GenericItemSchema2 = new Schema<IGenericItem2>({
 | 
			
		||||
    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<ITypeXPItem>(
 | 
			
		||||
    {
 | 
			
		||||
        ItemType: String,
 | 
			
		||||
        XP: Number
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const challengeProgressSchema = new Schema<IChallengeProgress>(
 | 
			
		||||
    {
 | 
			
		||||
        Progress: Number,
 | 
			
		||||
        Name: String,
 | 
			
		||||
        Completed: [String]
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const notePacksSchema = new Schema<INotePacks>(
 | 
			
		||||
    {
 | 
			
		||||
        MELODY: String,
 | 
			
		||||
        BASS: String,
 | 
			
		||||
        PERCUSSION: String
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const StepSequencersSchema = new Schema<IStepSequencer>(
 | 
			
		||||
    {
 | 
			
		||||
        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<IAffiliation>(
 | 
			
		||||
    {
 | 
			
		||||
        Initiated: Boolean,
 | 
			
		||||
        Standing: Number,
 | 
			
		||||
        Title: String,
 | 
			
		||||
        FreeFavorsEarned: [Number],
 | 
			
		||||
        FreeFavorsUsed: [Number],
 | 
			
		||||
        Tag: String
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const shipExteriorSchema = new Schema<IShipExterior>(
 | 
			
		||||
    {
 | 
			
		||||
        SkinFlavourItem: String,
 | 
			
		||||
        Colors: colorSchema, //TODO: perhaps too many colors here
 | 
			
		||||
        ShipAttachments: { HOOD_ORNAMENT: String }
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const shipSchema = new Schema<IShip>({
 | 
			
		||||
    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<ICompletedJobChain>(
 | 
			
		||||
    {
 | 
			
		||||
        LocationTag: String,
 | 
			
		||||
        Jobs: [String]
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const seasonChallengeHistorySchema = new Schema<ISeasonChallengeHistory>(
 | 
			
		||||
    {
 | 
			
		||||
        challenge: String,
 | 
			
		||||
        id: String
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
//TODO: check whether this is complete
 | 
			
		||||
const playerSkillsSchema = new Schema<IPlayerSkills>(
 | 
			
		||||
    {
 | 
			
		||||
        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<ISettings>({
 | 
			
		||||
    FriendInvRestriction: String,
 | 
			
		||||
    GiftMode: String,
 | 
			
		||||
    GuildInvRestriction: String,
 | 
			
		||||
    ShowFriendInvNotifications: Boolean,
 | 
			
		||||
    TradingRulesConfirmed: Boolean
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
const consumedSchuitsSchema = new Schema<IConsumedSuit>({
 | 
			
		||||
    s: String,
 | 
			
		||||
    c: colorSchema
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
const infestedFoundrySchema = new Schema<IInfestedFoundry>({
 | 
			
		||||
    Name: String,
 | 
			
		||||
    Resources: [typeCountSchema],
 | 
			
		||||
    Slots: Number,
 | 
			
		||||
    XP: Number,
 | 
			
		||||
    ConsumedSuits: [consumedSchuitsSchema],
 | 
			
		||||
    InvigorationIndex: Number,
 | 
			
		||||
    InvigorationSuitOfferings: [String],
 | 
			
		||||
    InvigorationsApplied: Number
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
const questProgressSchema = new Schema<IQuestProgress>({
 | 
			
		||||
    c: Number,
 | 
			
		||||
    i: Boolean,
 | 
			
		||||
    m: Boolean,
 | 
			
		||||
    b: []
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
const questKeysSchema = new Schema<IQuestKeyDatabase>(
 | 
			
		||||
    {
 | 
			
		||||
        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<IFusionTreasure>().add(typeCountSchema).add({ Sockets: Number });
 | 
			
		||||
 | 
			
		||||
const spectreLoadoutsSchema = new Schema<ISpectreLoadout>(
 | 
			
		||||
    {
 | 
			
		||||
        LongGuns: String,
 | 
			
		||||
        Melee: String,
 | 
			
		||||
        Pistols: String,
 | 
			
		||||
        PistolsFeatures: Number,
 | 
			
		||||
        PistolsModularParts: [String],
 | 
			
		||||
        Suits: String,
 | 
			
		||||
        ItemType: String
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const weaponSkinsSchema = new Schema<IWeaponSkin>(
 | 
			
		||||
    {
 | 
			
		||||
        ItemType: String
 | 
			
		||||
    },
 | 
			
		||||
    { id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
weaponSkinsSchema.virtual("ItemId").get(function () {
 | 
			
		||||
    return { $oid: this._id.toString() };
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
weaponSkinsSchema.set("toJSON", { virtuals: true });
 | 
			
		||||
 | 
			
		||||
const tauntHistorySchema = new Schema<ITauntHistory>(
 | 
			
		||||
    {
 | 
			
		||||
        node: String,
 | 
			
		||||
        state: String
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const periodicMissionCompletionsSchema = new Schema<IPeriodicMissionCompletionDatabase>(
 | 
			
		||||
    {
 | 
			
		||||
        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<ILoreFragmentScan>(
 | 
			
		||||
    {
 | 
			
		||||
        Progress: Number,
 | 
			
		||||
        Region: String,
 | 
			
		||||
        ItemType: String
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
 | 
			
		||||
    {
 | 
			
		||||
        accountOwnerId: Schema.Types.ObjectId,
 | 
			
		||||
        SubscribedToEmails: Number,
 | 
			
		||||
    Created: Schema.Types.Mixed,
 | 
			
		||||
        Created: Date,
 | 
			
		||||
        RewardSeed: Number,
 | 
			
		||||
 | 
			
		||||
        //Credit
 | 
			
		||||
@ -335,7 +654,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
 | 
			
		||||
        //Endo
 | 
			
		||||
        FusionPoints: Number,
 | 
			
		||||
 | 
			
		||||
    //SlotAny
 | 
			
		||||
        //Slots
 | 
			
		||||
        SuitBin: slotsBinSchema,
 | 
			
		||||
        WeaponBin: slotsBinSchema,
 | 
			
		||||
        SentinelBin: slotsBinSchema,
 | 
			
		||||
@ -357,7 +676,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
 | 
			
		||||
        PendingTrades: [Schema.Types.Mixed],
 | 
			
		||||
 | 
			
		||||
        //Curent Syndicates rank\exp
 | 
			
		||||
    Affiliations: [Schema.Types.Mixed],
 | 
			
		||||
        Affiliations: [affiliationsSchema],
 | 
			
		||||
        //Syndicates Missions complate(Navigation->Syndicate)
 | 
			
		||||
        CompletedSyndicates: [String],
 | 
			
		||||
        //Daily Syndicates Exp
 | 
			
		||||
@ -376,23 +695,23 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
 | 
			
		||||
 | 
			
		||||
        //Daily Focus limit
 | 
			
		||||
        DailyFocus: Number,
 | 
			
		||||
    //you not used Focus
 | 
			
		||||
    FocusXP: Schema.Types.Mixed,
 | 
			
		||||
        //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: [Schema.Types.Mixed],
 | 
			
		||||
        FocusUpgrades: [focusUpgradesSchema],
 | 
			
		||||
 | 
			
		||||
        //Achievement
 | 
			
		||||
    ChallengeProgress: [Schema.Types.Mixed],
 | 
			
		||||
        ChallengeProgress: [challengeProgressSchema],
 | 
			
		||||
 | 
			
		||||
        //Account Item like Ferrite,Form,Kuva etc
 | 
			
		||||
    MiscItems: [Schema.Types.Mixed],
 | 
			
		||||
        MiscItems: [typeCountSchema],
 | 
			
		||||
 | 
			
		||||
        //Non Upgrade Mods Example:I have 999 item WeaponElectricityDamageMod (only "ItemCount"+"ItemType")
 | 
			
		||||
        RawUpgrades: [RawUpgrades],
 | 
			
		||||
        //Upgrade Mods\Riven\Arcane Example:"UpgradeFingerprint"+"ItemType"+""
 | 
			
		||||
    Upgrades: [Upgrade],
 | 
			
		||||
        Upgrades: [upgrqadesSchema],
 | 
			
		||||
 | 
			
		||||
        //Warframe
 | 
			
		||||
        Suits: [suitSchema],
 | 
			
		||||
@ -403,9 +722,9 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
 | 
			
		||||
        //Melee      Weapon
 | 
			
		||||
        Melee: [WeaponSchema],
 | 
			
		||||
        //Ability Weapon like Ultimate Mech\Excalibur\Ivara etc
 | 
			
		||||
    SpecialItems: [Schema.Types.Mixed],
 | 
			
		||||
        SpecialItems: [GenericItemSchema2],
 | 
			
		||||
        //The Mandachord(Octavia) is a step sequencer
 | 
			
		||||
    StepSequencers: [Schema.Types.Mixed],
 | 
			
		||||
        StepSequencers: [StepSequencersSchema],
 | 
			
		||||
 | 
			
		||||
        //Sentinel(like Helios or modular)
 | 
			
		||||
        Sentinels: [Schema.Types.Mixed],
 | 
			
		||||
@ -421,7 +740,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
 | 
			
		||||
        KubrowPetPrints: [Schema.Types.Mixed],
 | 
			
		||||
 | 
			
		||||
        //Item for EquippedGear example:Scaner,LoadoutTechSummon etc
 | 
			
		||||
    Consumables: [Schema.Types.Mixed],
 | 
			
		||||
        Consumables: [typeCountSchema],
 | 
			
		||||
        //Weel Emotes+Gear
 | 
			
		||||
        EquippedEmotes: [String],
 | 
			
		||||
        EquippedGear: [String],
 | 
			
		||||
@ -453,10 +772,10 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
 | 
			
		||||
        //ErsatzHorsePowerSuit
 | 
			
		||||
        Horses: [GenericItemSchema],
 | 
			
		||||
 | 
			
		||||
    //Liset colors skin etc
 | 
			
		||||
    Ships: [Schema.Types.Mixed],
 | 
			
		||||
        //LandingCraft like Liset
 | 
			
		||||
        Ships: [shipSchema],
 | 
			
		||||
        // /Lotus/Types/Items/ShipDecos/
 | 
			
		||||
    ShipDecorations: [Schema.Types.Mixed],
 | 
			
		||||
        ShipDecorations: [typeCountSchema],
 | 
			
		||||
 | 
			
		||||
        //RailJack Setting(Mods,Skin,Weapon,etc)
 | 
			
		||||
        CrewShipHarnesses: [Schema.Types.Mixed],
 | 
			
		||||
@ -465,7 +784,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
 | 
			
		||||
 | 
			
		||||
        //Default RailJack
 | 
			
		||||
        CrewShips: [Schema.Types.Mixed],
 | 
			
		||||
    CrewShipAmmo: [Schema.Types.Mixed],
 | 
			
		||||
        CrewShipAmmo: [typeCountSchema],
 | 
			
		||||
        CrewShipWeapons: [Schema.Types.Mixed],
 | 
			
		||||
        CrewShipWeaponSkins: [Schema.Types.Mixed],
 | 
			
		||||
 | 
			
		||||
@ -476,7 +795,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
 | 
			
		||||
 | 
			
		||||
        //Complete Mission\Quests
 | 
			
		||||
        Missions: [Schema.Types.Mixed],
 | 
			
		||||
    QuestKeys: [Schema.Types.Mixed],
 | 
			
		||||
        QuestKeys: [questKeysSchema],
 | 
			
		||||
        //item like DojoKey or Boss missions key
 | 
			
		||||
        LevelKeys: [Schema.Types.Mixed],
 | 
			
		||||
        //Active quests
 | 
			
		||||
@ -491,8 +810,8 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
 | 
			
		||||
        //Mastery Rank*(Need item XPInfo to rank up)
 | 
			
		||||
        PlayerLevel: Number,
 | 
			
		||||
        //Item Mastery Rank exp
 | 
			
		||||
    XPInfo: [Schema.Types.Mixed],
 | 
			
		||||
    //24h timer rank up
 | 
			
		||||
        XPInfo: [TypeXPItemSchema],
 | 
			
		||||
        //Mastery Rank next availability
 | 
			
		||||
        TrainingDate: Date,
 | 
			
		||||
        //Retries rank up(3 time)
 | 
			
		||||
        TrainingRetriesLeft: Number,
 | 
			
		||||
@ -500,18 +819,18 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
 | 
			
		||||
        //you saw last played Region when you opened the star map
 | 
			
		||||
        LastRegionPlayed: String,
 | 
			
		||||
 | 
			
		||||
    //Blueprint
 | 
			
		||||
    Recipes: [Schema.Types.Mixed],
 | 
			
		||||
        //Blueprints for Foundry
 | 
			
		||||
        Recipes: [typeCountSchema],
 | 
			
		||||
        //Crafting Blueprint(Item Name + CompletionDate)
 | 
			
		||||
        PendingRecipes: [pendingRecipeSchema],
 | 
			
		||||
 | 
			
		||||
    //warframe\Weapon skins
 | 
			
		||||
    WeaponSkins: [Schema.Types.Mixed],
 | 
			
		||||
        //Skins for Suits, Weapons etc.
 | 
			
		||||
        WeaponSkins: [weaponSkinsSchema],
 | 
			
		||||
 | 
			
		||||
        //Ayatan Item
 | 
			
		||||
    FusionTreasures: [Schema.Types.Mixed],
 | 
			
		||||
        FusionTreasures: [fusionTreasuresSchema],
 | 
			
		||||
        //"node": "TreasureTutorial", "state": "TS_COMPLETED"
 | 
			
		||||
    TauntHistory: [Schema.Types.Mixed],
 | 
			
		||||
        TauntHistory: [tauntHistorySchema],
 | 
			
		||||
 | 
			
		||||
        //noShow2FA,VisitPrimeVault etc
 | 
			
		||||
        WebFlags: Schema.Types.Mixed,
 | 
			
		||||
@ -522,14 +841,14 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
 | 
			
		||||
        StoryModeChoice: String,
 | 
			
		||||
 | 
			
		||||
        //Alert->Kuva Siphon
 | 
			
		||||
    PeriodicMissionCompletions: [Schema.Types.Mixed],
 | 
			
		||||
        PeriodicMissionCompletions: [periodicMissionCompletionsSchema],
 | 
			
		||||
 | 
			
		||||
        //Codex->LoreFragment
 | 
			
		||||
    LoreFragmentScans: [Schema.Types.Mixed],
 | 
			
		||||
        LoreFragmentScans: [loreFragmentScansSchema],
 | 
			
		||||
 | 
			
		||||
        //Resource,Credit,Affinity etc or Bless any boosters
 | 
			
		||||
    Boosters: [BoosterSchema],
 | 
			
		||||
    BlessingCooldown: Schema.Types.Mixed,
 | 
			
		||||
        Boosters: [boosterSchema],
 | 
			
		||||
        BlessingCooldown: Date, // Date convert to IMongoDate
 | 
			
		||||
 | 
			
		||||
        //the color your clan requests like Items/Research/DojoColors/DojoColorPlainsB
 | 
			
		||||
        ActiveDojoColorResearch: String,
 | 
			
		||||
@ -541,13 +860,12 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
 | 
			
		||||
 | 
			
		||||
        //Have only Suit+Pistols+LongGuns+Melee+ItemType(BronzeSpectre,GoldSpectre,PlatinumSpectreArmy,SilverSpectreArmy)
 | 
			
		||||
        //"/Lotus/Types/Game/SpectreArmies/BronzeSpectreArmy": "Vapor Specter Regiment",
 | 
			
		||||
    SpectreLoadouts: [Schema.Types.Mixed],
 | 
			
		||||
        SpectreLoadouts: [spectreLoadoutsSchema],
 | 
			
		||||
        //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],
 | 
			
		||||
        //New Quest Email
 | 
			
		||||
        EmailItems: [TypeXPItemSchema],
 | 
			
		||||
 | 
			
		||||
        //Profile->Wishlist
 | 
			
		||||
        Wishlist: [String],
 | 
			
		||||
@ -588,9 +906,9 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
 | 
			
		||||
 | 
			
		||||
        //https://warframe.fandom.com/wiki/Heist
 | 
			
		||||
        //ProfitTaker(1-4) Example:"LocationTag": "EudicoHeists", "Jobs":Mission name
 | 
			
		||||
    CompletedJobChains: [Schema.Types.Mixed],
 | 
			
		||||
        CompletedJobChains: [completedJobChainsSchema],
 | 
			
		||||
        //Night Wave Challenge
 | 
			
		||||
    SeasonChallengeHistory: [Schema.Types.Mixed],
 | 
			
		||||
        SeasonChallengeHistory: [seasonChallengeHistorySchema],
 | 
			
		||||
 | 
			
		||||
        //Cephalon Simaris Entries Example:"TargetType"+"Scans"(1-10)+"Completed": true|false
 | 
			
		||||
        LibraryPersonalProgress: [Schema.Types.Mixed],
 | 
			
		||||
@ -610,7 +928,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
 | 
			
		||||
        LastNemesisAllySpawnTime: Schema.Types.Mixed,
 | 
			
		||||
 | 
			
		||||
        //TradingRulesConfirmed,ShowFriendInvNotifications(Option->Social)
 | 
			
		||||
    Settings: Schema.Types.Mixed,
 | 
			
		||||
        Settings: settingsSchema,
 | 
			
		||||
 | 
			
		||||
        //Railjack craft
 | 
			
		||||
        //https://warframe.fandom.com/wiki/Rising_Tide
 | 
			
		||||
@ -618,14 +936,15 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
 | 
			
		||||
 | 
			
		||||
        //Modulars lvl and exp(Railjack|Duviri)
 | 
			
		||||
        //https://warframe.fandom.com/wiki/Intrinsics
 | 
			
		||||
    PlayerSkills: Schema.Types.Mixed,
 | 
			
		||||
        PlayerSkills: playerSkillsSchema,
 | 
			
		||||
 | 
			
		||||
        //TradeBannedUntil data
 | 
			
		||||
        TradeBannedUntil: Schema.Types.Mixed,
 | 
			
		||||
 | 
			
		||||
        //https://warframe.fandom.com/wiki/Helminth
 | 
			
		||||
    InfestedFoundry: Schema.Types.Mixed,
 | 
			
		||||
    NextRefill: Schema.Types.Mixed,
 | 
			
		||||
        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
 | 
			
		||||
@ -668,23 +987,27 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
 | 
			
		||||
        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()
 | 
			
		||||
        inventoryResponse.TrainingDate = toMongoDate(inventoryDatabase.TrainingDate);
 | 
			
		||||
        inventoryResponse.Created = toMongoDate(inventoryDatabase.Created);
 | 
			
		||||
        if (inventoryResponse.BlessingCooldown) {
 | 
			
		||||
            inventoryResponse.BlessingCooldown = toMongoDate(inventoryDatabase.BlessingCooldown);
 | 
			
		||||
        }
 | 
			
		||||
        } satisfies IMongoDate;
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
// type overwrites for subdocuments/subdocument arrays
 | 
			
		||||
type InventoryDocumentProps = {
 | 
			
		||||
    Suits: Types.DocumentArray<ISuitDatabase>;
 | 
			
		||||
    LongGuns: Types.DocumentArray<IWeaponDatabase>;
 | 
			
		||||
@ -707,6 +1030,4 @@ type InventoryDocumentProps = {
 | 
			
		||||
 | 
			
		||||
type InventoryModelType = Model<IInventoryDatabase, {}, InventoryDocumentProps>;
 | 
			
		||||
 | 
			
		||||
const Inventory = model<IInventoryDatabase, InventoryModelType>("Inventory", inventorySchema);
 | 
			
		||||
 | 
			
		||||
export { Inventory };
 | 
			
		||||
export const Inventory = model<IInventoryDatabase, InventoryModelType>("Inventory", inventorySchema);
 | 
			
		||||
 | 
			
		||||
@ -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<IInventoryResponse, "TrainingDate" | "LoadOutPresets" | "Mailbox" | "PendingRecipes"> {
 | 
			
		||||
    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<IPeriodicMissionCompletionDatabase, "date"> {
 | 
			
		||||
    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<IQuestKeyDatabase, "CompletionDate"> {
 | 
			
		||||
    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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "SubscribedToEmails": 0,
 | 
			
		||||
  "Created": { "$date": { "$numberLong": "1685829131" } },
 | 
			
		||||
  "SubscribedToEmailsPersonalized": 0,
 | 
			
		||||
  "RewardSeed": -5604904486637265640,
 | 
			
		||||
  "CrewMemberBin": { "Slots": 3 },
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user