Apply prettier changes
This commit is contained in:
parent
c908ac7910
commit
91abcffc26
@ -6,7 +6,7 @@ import { config } from "@/src/services/configService";
|
||||
import { getWorldState } from "@/src/services/worldStateService";
|
||||
|
||||
const worldStateController: RequestHandler = async (_req, res) => {
|
||||
let ws: IWorldState = {}
|
||||
let ws: IWorldState = {};
|
||||
if (config.useStaticWorldState) {
|
||||
ws = worldState;
|
||||
ws.BuildLabel = buildConfig.buildLabel;
|
||||
|
@ -1,5 +1,42 @@
|
||||
import { model, Schema } from "mongoose";
|
||||
import { IEvent, IFlashSale, IJob, ILink, IMessage, IPVPChallengeInstance, ICategory, IPVPChallengeInstanceParam, IWorldState, IMission, IAlert, ICountedItems, IReward, IBaseWorldStateObject, ISortie, ILiteSortie, ISortieMission, ISyndicateMission, IActiveMission, IGlobalUpgrade, IInGameMarket, ILandingPage, IInvasion, IInvasionMissionInfo, INodeOverride, IVoidTrader, IVoidTraderItem, IVoidTraderScheduleInfo, IVoidStorm, IPrimeAccessAvailability, IDailyDeal, ILibraryInfo, IEndlessXpChoice, IFeaturedGuild, IActiveChallenge, ISeasonInfo } from "@/src/types/worldStateTypes";
|
||||
import {
|
||||
IEvent,
|
||||
IFlashSale,
|
||||
IJob,
|
||||
ILink,
|
||||
IMessage,
|
||||
IPVPChallengeInstance,
|
||||
ICategory,
|
||||
IPVPChallengeInstanceParam,
|
||||
IWorldState,
|
||||
IMission,
|
||||
IAlert,
|
||||
ICountedItems,
|
||||
IReward,
|
||||
IBaseWorldStateObject,
|
||||
ISortie,
|
||||
ILiteSortie,
|
||||
ISortieMission,
|
||||
ISyndicateMission,
|
||||
IActiveMission,
|
||||
IGlobalUpgrade,
|
||||
IInGameMarket,
|
||||
ILandingPage,
|
||||
IInvasion,
|
||||
IInvasionMissionInfo,
|
||||
INodeOverride,
|
||||
IVoidTrader,
|
||||
IVoidTraderItem,
|
||||
IVoidTraderScheduleInfo,
|
||||
IVoidStorm,
|
||||
IPrimeAccessAvailability,
|
||||
IDailyDeal,
|
||||
ILibraryInfo,
|
||||
IEndlessXpChoice,
|
||||
IFeaturedGuild,
|
||||
IActiveChallenge,
|
||||
ISeasonInfo
|
||||
} from "@/src/types/worldStateTypes";
|
||||
|
||||
const messageSchema = new Schema<IMessage>(
|
||||
{
|
||||
@ -17,8 +54,7 @@ const linkSchema = new Schema<ILink>(
|
||||
{ _id: false }
|
||||
);
|
||||
|
||||
const EventSchema = new Schema<IEvent>(
|
||||
{
|
||||
const EventSchema = new Schema<IEvent>({
|
||||
Messages: [messageSchema],
|
||||
Prop: String,
|
||||
Links: [linkSchema],
|
||||
@ -31,9 +67,7 @@ const EventSchema = new Schema<IEvent>(
|
||||
MobileOnly: Boolean,
|
||||
HideEndDateModifier: Boolean,
|
||||
Community: Boolean
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
EventSchema.set("toJSON", {
|
||||
transform(_document, returnedObject) {
|
||||
@ -54,10 +88,10 @@ const RewardSchema = new Schema<IReward>(
|
||||
credits: Number,
|
||||
xp: Number,
|
||||
items: [String],
|
||||
countedItems: [CountedItemsSchema],
|
||||
countedItems: [CountedItemsSchema]
|
||||
},
|
||||
{ _id: false }
|
||||
)
|
||||
);
|
||||
|
||||
const MissionSchema = new Schema<IMission>(
|
||||
{
|
||||
@ -82,7 +116,7 @@ const MissionSchema = new Schema<IMission>(
|
||||
vipAgent: Boolean,
|
||||
leadersAlwaysAllowed: Boolean,
|
||||
goalTag: String,
|
||||
levelAuras: [String],
|
||||
levelAuras: [String]
|
||||
},
|
||||
{ _id: false }
|
||||
);
|
||||
@ -176,7 +210,6 @@ SyndicateMissionSchema.set("toJSON", {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
const ActiveMissionSchema = new Schema<IActiveMission>({
|
||||
Activation: Date,
|
||||
Expiry: Date,
|
||||
@ -248,7 +281,7 @@ const InGameMarketSchema = new Schema<IInGameMarket>(
|
||||
LandingPage: LandingPageSchema
|
||||
},
|
||||
{ _id: false }
|
||||
)
|
||||
);
|
||||
|
||||
const InvasionMissionInfoSchema = new Schema<IInvasionMissionInfo>(
|
||||
{
|
||||
@ -256,7 +289,7 @@ const InvasionMissionInfoSchema = new Schema<IInvasionMissionInfo>(
|
||||
faction: String
|
||||
},
|
||||
{ _id: false }
|
||||
)
|
||||
);
|
||||
|
||||
const InvasionSchema = new Schema<IInvasion>({
|
||||
Activation: Date,
|
||||
@ -271,7 +304,7 @@ const InvasionSchema = new Schema<IInvasion>({
|
||||
AttackerReward: RewardSchema,
|
||||
AttackerMissionInfo: InvasionMissionInfoSchema,
|
||||
DefenderReward: RewardSchema,
|
||||
DefenderMissionInfo: InvasionMissionInfoSchema,
|
||||
DefenderMissionInfo: InvasionMissionInfoSchema
|
||||
});
|
||||
|
||||
InvasionSchema.set("toJSON", {
|
||||
@ -286,7 +319,7 @@ const NodeOverrideSchema = new Schema<INodeOverride>({
|
||||
Node: String,
|
||||
Faction: String,
|
||||
CustomNpcEncounters: [String],
|
||||
LevelOverride: String,
|
||||
LevelOverride: String
|
||||
});
|
||||
|
||||
NodeOverrideSchema.set("toJSON", {
|
||||
@ -313,8 +346,7 @@ const VoidTraderScheduleInfoSchema = new Schema<IVoidTraderScheduleInfo>(
|
||||
{ _id: false }
|
||||
);
|
||||
|
||||
const VoidTraderSchema = new Schema<IVoidTrader>(
|
||||
{
|
||||
const VoidTraderSchema = new Schema<IVoidTrader>({
|
||||
Activation: Date,
|
||||
Expiry: Date,
|
||||
Character: String,
|
||||
@ -322,9 +354,8 @@ const VoidTraderSchema = new Schema<IVoidTrader>(
|
||||
Completed: Boolean,
|
||||
Manifest: [VoidTraderItemSchema],
|
||||
EvergreenManifest: [VoidTraderItemSchema],
|
||||
ScheduleInfo: [VoidTraderScheduleInfoSchema],
|
||||
}
|
||||
);
|
||||
ScheduleInfo: [VoidTraderScheduleInfoSchema]
|
||||
});
|
||||
|
||||
VoidTraderSchema.set("toJSON", {
|
||||
transform(_document, returnedObject) {
|
||||
@ -381,8 +412,7 @@ const PVPChallengeInstanceParam = new Schema<IPVPChallengeInstanceParam>(
|
||||
{ _id: false }
|
||||
);
|
||||
|
||||
const PVPChallengeInstanceSchema = new Schema<IPVPChallengeInstance>(
|
||||
{
|
||||
const PVPChallengeInstanceSchema = new Schema<IPVPChallengeInstance>({
|
||||
challengeTypeRefID: String,
|
||||
startDate: Date,
|
||||
endDate: Date,
|
||||
@ -391,8 +421,7 @@ const PVPChallengeInstanceSchema = new Schema<IPVPChallengeInstance>(
|
||||
PVPMode: String,
|
||||
subChallenges: [Schema.Types.ObjectId],
|
||||
Category: String
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
PVPChallengeInstanceSchema.set("toJSON", {
|
||||
transform(_document, returnedObject) {
|
||||
@ -442,11 +471,11 @@ const SeasonInfoSchema = new Schema<ISeasonInfo>(
|
||||
Phase: Number,
|
||||
Params: String,
|
||||
ActiveChallenges: [ActiveChallengeSchema]
|
||||
}, { _id: false }
|
||||
},
|
||||
{ _id: false }
|
||||
);
|
||||
|
||||
const WorldStateSchema = new Schema<IWorldState>(
|
||||
{
|
||||
const WorldStateSchema = new Schema<IWorldState>({
|
||||
Events: [EventSchema],
|
||||
// Goals: [GoalSchema],
|
||||
Alerts: [AlertSchema],
|
||||
@ -471,8 +500,7 @@ const WorldStateSchema = new Schema<IWorldState>(
|
||||
FeaturedGuilds: [FeaturedGuildShema],
|
||||
SeasonInfo: SeasonInfoSchema,
|
||||
Tmp: String
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
WorldStateSchema.set("toJSON", {
|
||||
transform(_document, returnedObject) {
|
||||
|
@ -2,10 +2,10 @@ import { WorldState } from "@/src/models/worldStateModel";
|
||||
import buildConfig from "@/static/data/buildConfig.json";
|
||||
|
||||
export const createWorldState = async () => {
|
||||
const worldState = new WorldState()
|
||||
const worldState = new WorldState();
|
||||
await worldState.save();
|
||||
return worldState;
|
||||
}
|
||||
};
|
||||
|
||||
export const getWorldState = async () => {
|
||||
let ws = await WorldState.findOne();
|
||||
|
@ -3,17 +3,17 @@ import { IMongoDate, IOid } from "@/src/types/commonTypes";
|
||||
export interface IMessage {
|
||||
LanguageCode?: string;
|
||||
Message: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ILink {
|
||||
LanguageCode?: string;
|
||||
Link: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface IBaseWorldStateObject {
|
||||
Activation: IMongoDate;
|
||||
Expiry: IMongoDate;
|
||||
_id?: IOid
|
||||
_id?: IOid;
|
||||
}
|
||||
|
||||
export interface IReward {
|
||||
@ -67,7 +67,7 @@ export interface IEvent {
|
||||
HideEndDateModifier?: boolean;
|
||||
Date?: IMongoDate;
|
||||
_id?: IOid;
|
||||
};
|
||||
}
|
||||
|
||||
export interface IGoal extends IBaseWorldStateObject {
|
||||
Node: string;
|
||||
@ -87,7 +87,7 @@ export interface IGoal extends IBaseWorldStateObject {
|
||||
Reward: IReward;
|
||||
InterimGoals: number[];
|
||||
InterimRewards: IReward[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface IAlert extends IBaseWorldStateObject {
|
||||
MissionInfo: IMission;
|
||||
@ -99,7 +99,7 @@ export interface ISortieMission {
|
||||
missionType: string;
|
||||
modifierType?: string;
|
||||
node: string;
|
||||
tileset?: string
|
||||
tileset?: string;
|
||||
}
|
||||
|
||||
export interface ISortie extends Omit<ILiteSortie, "Missions"> {
|
||||
@ -163,7 +163,6 @@ export interface IFlashSale {
|
||||
BogoGet: number;
|
||||
}
|
||||
|
||||
|
||||
export interface IInGameMarket {
|
||||
LandingPage: ILandingPage;
|
||||
}
|
||||
@ -203,8 +202,8 @@ export interface IInvasionMissionInfo {
|
||||
export interface INodeOverride {
|
||||
Activation?: IMongoDate;
|
||||
Expiry?: IMongoDate;
|
||||
Node: string,
|
||||
Faction?: string,
|
||||
Node: string;
|
||||
Faction?: string;
|
||||
CustomNpcEncounters?: string[];
|
||||
LevelOverride?: string;
|
||||
}
|
||||
@ -229,7 +228,6 @@ export interface IVoidTraderScheduleInfo extends Omit<IBaseWorldStateObject, "Ac
|
||||
FeaturedItem?: string;
|
||||
}
|
||||
|
||||
|
||||
export interface IVoidStorm extends IBaseWorldStateObject {
|
||||
Node: string;
|
||||
ActiveMissionTier: string;
|
||||
@ -268,7 +266,6 @@ export interface IPVPChallengeInstanceParam {
|
||||
v: number;
|
||||
}
|
||||
|
||||
|
||||
export interface IEndlessXpChoice {
|
||||
Category: string;
|
||||
Choices: string[];
|
||||
|
Loading…
x
Reference in New Issue
Block a user