Server/project/src/callbacks/BuildsCallbacks.ts

74 lines
2.7 KiB
TypeScript
Raw Normal View History

import { inject, injectable } from "tsyringe";
import { BuildController } from "@spt/controllers/BuildController";
import { ISetMagazineRequest } from "@spt/models/eft/builds/ISetMagazineRequest";
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
import { IPresetBuildActionRequestData } from "@spt/models/eft/presetBuild/IPresetBuildActionRequestData";
import { IRemoveBuildRequestData } from "@spt/models/eft/presetBuild/IRemoveBuildRequestData";
import { IUserBuilds } from "@spt/models/eft/profile/ISptProfile";
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
2023-12-27 16:05:07 +01:00
@injectable()
export class BuildsCallbacks
{
constructor(
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
2023-12-27 21:19:17 +01:00
@inject("BuildController") protected buildController: BuildController,
2023-12-27 16:05:07 +01:00
)
{}
/**
* Handle client/builds/list
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2023-12-27 21:19:17 +01:00
public getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IUserBuilds>
2023-12-27 16:05:07 +01:00
{
2023-12-27 21:19:17 +01:00
return this.httpResponse.getBody(this.buildController.getUserBuilds(sessionID));
2023-12-27 16:05:07 +01:00
}
/**
* Handle client/builds/magazine/save
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2023-12-28 13:19:52 +01:00
public createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData
2023-12-27 16:05:07 +01:00
{
this.buildController.createMagazineTemplate(sessionID, request);
2023-12-28 13:02:37 +01:00
2023-12-28 13:19:52 +01:00
return this.httpResponse.nullResponse();
2023-12-27 16:05:07 +01:00
}
/**
* Handle client/builds/weapon/save
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData
2023-12-27 16:05:07 +01:00
{
this.buildController.saveWeaponBuild(sessionID, info);
return this.httpResponse.nullResponse();
2023-12-27 16:05:07 +01:00
}
/**
* Handle client/builds/equipment/save
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData
2023-12-27 16:05:07 +01:00
{
this.buildController.saveEquipmentBuild(sessionID, info);
return this.httpResponse.nullResponse();
2023-12-27 16:05:07 +01:00
}
/**
* Handle client/builds/delete
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData
2023-12-27 16:05:07 +01:00
{
this.buildController.removeBuild(sessionID, info);
return this.httpResponse.nullResponse();
2023-12-27 16:05:07 +01:00
}
2023-12-27 21:22:53 +01:00
}