2024-05-21 17:59:04 +00:00
|
|
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
2024-09-24 11:26:45 +01:00
|
|
|
import { INote } from "@spt/models/eft/common/tables/IBotBase";
|
2024-05-21 17:59:04 +00:00
|
|
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
|
|
|
import { INoteActionData } from "@spt/models/eft/notes/INoteActionData";
|
|
|
|
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
2024-07-23 11:12:53 -04:00
|
|
|
import { inject, injectable } from "tsyringe";
|
2023-03-03 15:23:46 +00:00
|
|
|
|
|
|
|
@injectable()
|
2024-07-23 11:12:53 -04:00
|
|
|
export class NoteController {
|
|
|
|
constructor(@inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder) {}
|
2023-03-03 15:23:46 +00:00
|
|
|
|
2024-07-23 11:12:53 -04:00
|
|
|
public addNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse {
|
2024-09-24 11:26:45 +01:00
|
|
|
const newNote: INote = { Time: body.note.Time, Text: body.note.Text };
|
2023-03-03 15:23:46 +00:00
|
|
|
pmcData.Notes.Notes.push(newNote);
|
|
|
|
|
|
|
|
return this.eventOutputHolder.getOutput(sessionID);
|
|
|
|
}
|
|
|
|
|
2024-07-23 11:12:53 -04:00
|
|
|
public editNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse {
|
2024-09-24 11:26:45 +01:00
|
|
|
const noteToEdit: INote = pmcData.Notes.Notes[body.index];
|
2023-03-03 15:23:46 +00:00
|
|
|
noteToEdit.Time = body.note.Time;
|
|
|
|
noteToEdit.Text = body.note.Text;
|
|
|
|
|
|
|
|
return this.eventOutputHolder.getOutput(sessionID);
|
|
|
|
}
|
|
|
|
|
2024-07-23 11:12:53 -04:00
|
|
|
public deleteNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse {
|
2023-03-03 15:23:46 +00:00
|
|
|
pmcData.Notes.Notes.splice(body.index, 1);
|
|
|
|
return this.eventOutputHolder.getOutput(sessionID);
|
|
|
|
}
|
2023-11-15 20:35:05 -05:00
|
|
|
}
|