forked from OpenWF/SpaceNinjaServer
fix: address some client warnings about malformed inventory.php response (#840)
This commit is contained in:
parent
ef2708b510
commit
7716c945d0
@ -16,6 +16,8 @@ import {
|
|||||||
} from "warframe-public-export-plus";
|
} from "warframe-public-export-plus";
|
||||||
import { handleSubsumeCompletion } from "./infestedFoundryController";
|
import { handleSubsumeCompletion } from "./infestedFoundryController";
|
||||||
import { allDailyAffiliationKeys } from "@/src/services/inventoryService";
|
import { allDailyAffiliationKeys } from "@/src/services/inventoryService";
|
||||||
|
import { toOid } from "@/src/helpers/inventoryHelpers";
|
||||||
|
import { Types } from "mongoose";
|
||||||
|
|
||||||
export const inventoryController: RequestHandler = async (request, response) => {
|
export const inventoryController: RequestHandler = async (request, response) => {
|
||||||
const account = await getAccountForRequest(request);
|
const account = await getAccountForRequest(request);
|
||||||
@ -247,6 +249,8 @@ export const inventoryController: RequestHandler = async (request, response) =>
|
|||||||
// This determines if the "void fissures" tab is shown in navigation.
|
// This determines if the "void fissures" tab is shown in navigation.
|
||||||
inventoryResponse.HasOwnedVoidProjectionsPreviously = true;
|
inventoryResponse.HasOwnedVoidProjectionsPreviously = true;
|
||||||
|
|
||||||
|
inventoryResponse.LastInventorySync = toOid(new Types.ObjectId());
|
||||||
|
|
||||||
response.json(inventoryResponse);
|
response.json(inventoryResponse);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -63,7 +63,8 @@ import {
|
|||||||
IOperatorConfigDatabase,
|
IOperatorConfigDatabase,
|
||||||
IPolarity,
|
IPolarity,
|
||||||
IEquipmentDatabase,
|
IEquipmentDatabase,
|
||||||
IArchonCrystalUpgrade
|
IArchonCrystalUpgrade,
|
||||||
|
IEquipmentClient
|
||||||
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||||
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
|
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
|
||||||
import { EquipmentSelectionSchema } from "./loadoutModel";
|
import { EquipmentSelectionSchema } from "./loadoutModel";
|
||||||
@ -121,10 +122,14 @@ const polaritySchema = new Schema<IPolarity>(
|
|||||||
{ _id: false }
|
{ _id: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
const abilityOverrideSchema = new Schema<IAbilityOverride>({
|
const abilityOverrideSchema = new Schema<IAbilityOverride>(
|
||||||
Ability: String,
|
{
|
||||||
Index: Number
|
Ability: String,
|
||||||
});
|
Index: Number
|
||||||
|
},
|
||||||
|
{ _id: false }
|
||||||
|
);
|
||||||
|
|
||||||
export const colorSchema = new Schema<IColor>(
|
export const colorSchema = new Schema<IColor>(
|
||||||
{
|
{
|
||||||
t0: Number,
|
t0: Number,
|
||||||
@ -257,6 +262,13 @@ EquipmentSchema.set("toJSON", {
|
|||||||
transform(_document, returnedObject) {
|
transform(_document, returnedObject) {
|
||||||
delete returnedObject._id;
|
delete returnedObject._id;
|
||||||
delete returnedObject.__v;
|
delete returnedObject.__v;
|
||||||
|
|
||||||
|
const db = returnedObject as IEquipmentDatabase;
|
||||||
|
const client = returnedObject as IEquipmentClient;
|
||||||
|
|
||||||
|
if (db.InfestationDate) {
|
||||||
|
client.InfestationDate = toMongoDate(db.InfestationDate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -959,8 +971,6 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
|||||||
XPInfo: [TypeXPItemSchema],
|
XPInfo: [TypeXPItemSchema],
|
||||||
//Mastery Rank next availability
|
//Mastery Rank next availability
|
||||||
TrainingDate: { type: Date, default: new Date(0) },
|
TrainingDate: { type: Date, default: new Date(0) },
|
||||||
//Retries rank up(3 time)
|
|
||||||
TrainingRetriesLeft: Number,
|
|
||||||
|
|
||||||
//you saw last played Region when you opened the star map
|
//you saw last played Region when you opened the star map
|
||||||
LastRegionPlayed: String,
|
LastRegionPlayed: String,
|
||||||
@ -1111,7 +1121,6 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
|||||||
ChallengesFixVersion: Number,
|
ChallengesFixVersion: Number,
|
||||||
PlayedParkourTutorial: Boolean,
|
PlayedParkourTutorial: Boolean,
|
||||||
SubscribedToEmailsPersonalized: Number,
|
SubscribedToEmailsPersonalized: Number,
|
||||||
LastInventorySync: Schema.Types.Mixed, // this should be Schema.Types.ObjectId, but older inventories may break with that.
|
|
||||||
ActiveLandscapeTraps: [Schema.Types.Mixed],
|
ActiveLandscapeTraps: [Schema.Types.Mixed],
|
||||||
RepVotes: [Schema.Types.Mixed],
|
RepVotes: [Schema.Types.Mixed],
|
||||||
LeagueTickets: [Schema.Types.Mixed],
|
LeagueTickets: [Schema.Types.Mixed],
|
||||||
@ -1141,7 +1150,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
|||||||
|
|
||||||
DialogueHistory: dialogueHistorySchema
|
DialogueHistory: dialogueHistorySchema
|
||||||
},
|
},
|
||||||
{ timestamps: { createdAt: "Created" } }
|
{ timestamps: { createdAt: "Created", updatedAt: false } }
|
||||||
);
|
);
|
||||||
|
|
||||||
inventorySchema.set("toJSON", {
|
inventorySchema.set("toJSON", {
|
||||||
|
@ -209,7 +209,6 @@ export interface IInventoryClient extends IDailyAffiliations {
|
|||||||
QuestKeys: IQuestKeyClient[];
|
QuestKeys: IQuestKeyClient[];
|
||||||
FlavourItems: IFlavourItem[];
|
FlavourItems: IFlavourItem[];
|
||||||
Scoops: IEquipmentDatabase[];
|
Scoops: IEquipmentDatabase[];
|
||||||
TrainingRetriesLeft: number;
|
|
||||||
LoadOutPresets: ILoadOutPresets;
|
LoadOutPresets: ILoadOutPresets;
|
||||||
CurrentLoadOutIds: IOid[]; // we store it in the database using this representation as well :/
|
CurrentLoadOutIds: IOid[]; // we store it in the database using this representation as well :/
|
||||||
Missions: IMission[];
|
Missions: IMission[];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user