0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 09:50:43 -05:00
server/project/src/routers/item_events/NoteItemEventRouter.ts

39 lines
1.3 KiB
TypeScript
Raw Normal View History

2023-03-03 15:23:46 +00:00
import { inject, injectable } from "tsyringe";
import { NoteCallbacks } from "../../callbacks/NoteCallbacks";
import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router";
import { IPmcData } from "../../models/eft/common/IPmcData";
import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse";
@injectable()
export class NoteItemEventRouter extends ItemEventRouterDefinition
{
constructor(
@inject("NoteCallbacks") protected noteCallbacks: NoteCallbacks // TODO: delay required
)
{
super();
}
public override getHandledRoutes(): HandledRoute[]
{
return [
new HandledRoute("AddNote", false),
new HandledRoute("EditNote", false),
new HandledRoute("DeleteNote", false)
];
}
public override handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse
{
switch (url)
{
case "AddNote":
return this.noteCallbacks.addNote(pmcData, body, sessionID);
case "EditNote":
return this.noteCallbacks.editNote(pmcData, body, sessionID);
case "DeleteNote":
return this.noteCallbacks.deleteNote(pmcData, body, sessionID);
}
}
}