Server/project/src/callbacks/BuildsCallbacks.ts
Refringe 50c7a26a58
ESLint Pass
This is the first pass of ESLint on the codebase.

ESLint formatting is less strict when it comes to line-length and line-breaks then dprint/biome, so if you see formatting that you don't like... fix it! It shouldn't require a configuration change.

- This should merge clean into master (when the time comes).
- This will not merge clean into `3.9.0-DEV`, but the conflicts aren't that bad.
2024-05-07 23:57:08 -04:00

74 lines
2.8 KiB
TypeScript

import { inject, injectable } from "tsyringe";
import { BuildController } from "@spt-aki/controllers/BuildController";
import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData";
import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData";
import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
@injectable()
export class BuildsCallbacks
{
constructor(
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
@inject("BuildController") protected buildController: BuildController,
)
{}
/**
* Handle client/builds/list
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IUserBuilds>
{
return this.httpResponse.getBody(this.buildController.getUserBuilds(sessionID));
}
/**
* Handle client/builds/magazine/save
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData
{
this.buildController.createMagazineTemplate(sessionID, request);
return this.httpResponse.nullResponse();
}
/**
* Handle client/builds/weapon/save
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData
{
this.buildController.saveWeaponBuild(sessionID, info);
return this.httpResponse.nullResponse();
}
/**
* Handle client/builds/equipment/save
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData
{
this.buildController.saveEquipmentBuild(sessionID, info);
return this.httpResponse.nullResponse();
}
/**
* Handle client/builds/delete
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData
{
this.buildController.removeBuild(sessionID, info);
return this.httpResponse.nullResponse();
}
}