Goal Schema
This commit is contained in:
parent
d771f1a6b8
commit
f79767d71a
@ -51,7 +51,7 @@ import {
|
||||
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
|
||||
|
||||
const typeCountSchema = new Schema<ITypeCount>({ ItemType: String, ItemCount: Number }, { _id: false });
|
||||
export const typeCountSchema = new Schema<ITypeCount>({ ItemType: String, ItemCount: Number }, { _id: false });
|
||||
|
||||
const focusXPSchema = new Schema<IFocusXP>(
|
||||
{
|
||||
|
@ -3,7 +3,7 @@ import { IEquipmentSelection } from "@/src/types/inventoryTypes/commonInventoryT
|
||||
import { ILoadoutConfigDatabase, ILoadoutDatabase } from "@/src/types/saveLoadoutTypes";
|
||||
import { Model, Schema, Types, model } from "mongoose";
|
||||
|
||||
const oidSchema = new Schema<IOid>(
|
||||
export const oidSchema = new Schema<IOid>(
|
||||
{
|
||||
$oid: String
|
||||
},
|
||||
|
@ -10,7 +10,6 @@ import {
|
||||
IPVPChallengeInstanceParam,
|
||||
IMission,
|
||||
IAlert,
|
||||
ICountedItems,
|
||||
IReward,
|
||||
ISortie,
|
||||
ILiteSortie,
|
||||
@ -34,8 +33,11 @@ import {
|
||||
IFeaturedGuild,
|
||||
IActiveChallenge,
|
||||
ISeasonInfo,
|
||||
IWorldStateDocument
|
||||
IWorldStateDocument,
|
||||
IGoal
|
||||
} from "@/src/types/worldStateTypes";
|
||||
import { oidSchema } from "@/src/models/inventoryModels/loadoutModel";
|
||||
import { typeCountSchema } from "@/src/models/inventoryModels/inventoryModel";
|
||||
|
||||
const messageSchema = new Schema<IMessage>(
|
||||
{
|
||||
@ -78,20 +80,12 @@ EventSchema.set("toJSON", {
|
||||
}
|
||||
});
|
||||
|
||||
const CountedItemsSchema = new Schema<ICountedItems>(
|
||||
{
|
||||
ItemType: String,
|
||||
ItemCount: Number
|
||||
},
|
||||
{ _id: false }
|
||||
);
|
||||
|
||||
const RewardSchema = new Schema<IReward>(
|
||||
{
|
||||
credits: Number,
|
||||
xp: Number,
|
||||
items: [String],
|
||||
countedItems: [CountedItemsSchema]
|
||||
countedItems: [typeCountSchema]
|
||||
},
|
||||
{ _id: false }
|
||||
);
|
||||
@ -105,6 +99,7 @@ const MissionSchema = new Schema<IMission>(
|
||||
missionReward: RewardSchema,
|
||||
levelOverride: String,
|
||||
enemySpec: String,
|
||||
extraEnemySpec: String,
|
||||
minEnemyLevel: Number,
|
||||
maxEnemyLevel: Number,
|
||||
descText: String,
|
||||
@ -119,15 +114,59 @@ const MissionSchema = new Schema<IMission>(
|
||||
vipAgent: Boolean,
|
||||
leadersAlwaysAllowed: Boolean,
|
||||
goalTag: String,
|
||||
questReq: String,
|
||||
levelAuras: [String]
|
||||
},
|
||||
{ _id: false }
|
||||
);
|
||||
|
||||
const GoalSchema = new Schema<IGoal>({
|
||||
Activation: Number,
|
||||
Expiry: Number,
|
||||
|
||||
Regions: [Number],
|
||||
OptionalInMission: Boolean,
|
||||
UpgradeIds: [oidSchema],
|
||||
|
||||
Node: String,
|
||||
MissionKeyName: String,
|
||||
Faction: String,
|
||||
|
||||
Icon: String,
|
||||
ToolTip: String,
|
||||
Desc: String,
|
||||
|
||||
Tag: String,
|
||||
ScoreLocTag: String,
|
||||
ScoreVar: String,
|
||||
|
||||
Reward: RewardSchema,
|
||||
InterimRewards: [RewardSchema],
|
||||
|
||||
Goal: Number,
|
||||
InterimGoals: [Number],
|
||||
ClanGoal: [Number],
|
||||
HealthPct: Number,
|
||||
Count: Number,
|
||||
ItemType: String,
|
||||
|
||||
Personal: Boolean,
|
||||
Community: Boolean
|
||||
});
|
||||
|
||||
GoalSchema.set("toJSON", {
|
||||
transform(_document, returnedObject) {
|
||||
returnedObject._id = { $oid: returnedObject._id.toString() };
|
||||
returnedObject.Activation = { $date: { $numberLong: returnedObject.Activation.toString() } };
|
||||
returnedObject.Expiry = { $date: { $numberLong: returnedObject.Expiry.toString() } };
|
||||
}
|
||||
});
|
||||
|
||||
const AlertSchema = new Schema<IAlert>({
|
||||
Activation: Number,
|
||||
Expiry: Number,
|
||||
MissionInfo: MissionSchema,
|
||||
Icon: String,
|
||||
ForceUnlock: Boolean,
|
||||
Tag: String
|
||||
});
|
||||
@ -539,7 +578,7 @@ SeasonInfoSchema.set("toJSON", {
|
||||
|
||||
const WorldStateSchema = new Schema<IWorldStateDocument>({
|
||||
Events: [EventSchema],
|
||||
// Goals: [GoalSchema],
|
||||
Goals: [GoalSchema],
|
||||
Alerts: [AlertSchema],
|
||||
Sorties: [SortieSchema],
|
||||
LiteSorties: [LiteSortieSchema],
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { IOid } from "@/src/types/commonTypes";
|
||||
import { Document, ObjectId } from "mongoose";
|
||||
import { ITypeCount } from "./inventoryTypes/inventoryTypes";
|
||||
|
||||
export interface IMessage {
|
||||
LanguageCode?: string;
|
||||
@ -21,12 +22,7 @@ export interface IReward {
|
||||
credits?: number;
|
||||
xp?: number;
|
||||
items?: string[];
|
||||
countedItems?: ICountedItems[];
|
||||
}
|
||||
|
||||
export interface ICountedItems {
|
||||
ItemType: string;
|
||||
ItemCount: number;
|
||||
countedItems?: ITypeCount[];
|
||||
}
|
||||
|
||||
export interface IMission {
|
||||
@ -37,6 +33,7 @@ export interface IMission {
|
||||
missionReward: IReward;
|
||||
levelOverride: string;
|
||||
enemySpec: string;
|
||||
extraEnemySpec?: string;
|
||||
minEnemyLevel: number;
|
||||
maxEnemyLevel: number;
|
||||
descText: string;
|
||||
@ -51,11 +48,12 @@ export interface IMission {
|
||||
vipAgent?: boolean;
|
||||
leadersAlwaysAllowed?: boolean;
|
||||
goalTag?: string;
|
||||
questReq?: string;
|
||||
levelAuras?: string[];
|
||||
}
|
||||
|
||||
export interface IEvent {
|
||||
Messages: IMessage[];
|
||||
Messages?: IMessage[];
|
||||
Msg?: string;
|
||||
Prop?: string;
|
||||
ImageUrl?: string;
|
||||
@ -71,28 +69,40 @@ export interface IEvent {
|
||||
}
|
||||
|
||||
export interface IGoal extends IBaseWorldStateObject {
|
||||
Regions?: number[];
|
||||
OptionalInMission?: boolean;
|
||||
UpgradeIds?: IOid[];
|
||||
|
||||
Node: string;
|
||||
ScoreVar: string;
|
||||
ScoreLocTag: string;
|
||||
Count: number;
|
||||
HealthPct: number;
|
||||
Regions: number[];
|
||||
Desc: string;
|
||||
MissionKeyName?: string;
|
||||
Faction?: string;
|
||||
|
||||
Icon: string;
|
||||
ToolTip: string;
|
||||
OptionalInMission: boolean;
|
||||
Tag: string;
|
||||
UpgradeIds: IOid[];
|
||||
Desc: string;
|
||||
|
||||
Tag?: string;
|
||||
ScoreLocTag: string;
|
||||
ScoreVar?: string;
|
||||
|
||||
Reward: IReward;
|
||||
InterimRewards?: IReward[];
|
||||
|
||||
Goal: number;
|
||||
InterimGoals?: number[];
|
||||
ClanGoal?: number[];
|
||||
HealthPct: number;
|
||||
Count: number;
|
||||
ItemType?: string;
|
||||
|
||||
Personal: boolean;
|
||||
Community: boolean;
|
||||
Goal: number;
|
||||
Reward: IReward;
|
||||
InterimGoals: number[];
|
||||
InterimRewards: IReward[];
|
||||
}
|
||||
|
||||
export interface IAlert extends IBaseWorldStateObject {
|
||||
MissionInfo: IMission;
|
||||
ForceUnlock: boolean;
|
||||
ForceUnlock?: boolean;
|
||||
Icon?: string;
|
||||
Tag: string;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user