2023-12-27 15:05:07 +00:00
|
|
|
import { inject, injectable } from "tsyringe";
|
2024-05-21 17:59:04 +00:00
|
|
|
import { BuildsCallbacks } from "@spt/callbacks/BuildsCallbacks";
|
|
|
|
import { RouteAction, StaticRouter } from "@spt/di/Router";
|
|
|
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
|
|
|
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
|
|
|
|
import { IUserBuilds } from "@spt/models/eft/profile/ISptProfile";
|
2023-12-27 15:05:07 +00:00
|
|
|
|
|
|
|
@injectable()
|
|
|
|
export class BuildsStaticRouter extends StaticRouter
|
|
|
|
{
|
|
|
|
constructor(@inject("BuildsCallbacks") protected buildsCallbacks: BuildsCallbacks)
|
|
|
|
{
|
|
|
|
super([
|
|
|
|
new RouteAction(
|
|
|
|
"/client/builds/list",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (
|
|
|
|
url: string,
|
|
|
|
info: any,
|
|
|
|
sessionID: string,
|
|
|
|
output: string,
|
|
|
|
): Promise<IGetBodyResponseData<IUserBuilds>> =>
|
2023-12-27 15:05:07 +00:00
|
|
|
{
|
|
|
|
return this.buildsCallbacks.getBuilds(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/client/builds/magazine/save",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
2023-12-27 15:05:07 +00:00
|
|
|
{
|
2023-12-28 12:02:37 +00:00
|
|
|
return this.buildsCallbacks.createMagazineTemplate(url, info, sessionID);
|
2023-12-27 15:05:07 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/client/builds/weapon/save",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
2023-12-27 15:05:07 +00:00
|
|
|
{
|
|
|
|
return this.buildsCallbacks.setWeapon(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/client/builds/equipment/save",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
2023-12-27 15:05:07 +00:00
|
|
|
{
|
|
|
|
return this.buildsCallbacks.setEquipment(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/client/builds/delete",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
2023-12-27 15:05:07 +00:00
|
|
|
{
|
|
|
|
return this.buildsCallbacks.deleteBuild(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|