remove setSupporedSyndicateController.ts and use getAccountIdForRequest
also added syndicateSacrifice.php to api.ts, forgot to transfer it over from my old codebase.
This commit is contained in:
parent
304529c56d
commit
00740e31dd
@ -1,14 +0,0 @@
|
|||||||
import { updateSyndicate } from "@/src/services/inventoryService";
|
|
||||||
import { RequestHandler } from "express";
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
||||||
const setSupportedSyndicateController: RequestHandler = async (request, response) => {
|
|
||||||
const accountId = request.query.accountId as string;
|
|
||||||
const syndicate = request.query.syndicate as string;
|
|
||||||
|
|
||||||
await updateSyndicate(syndicate, accountId);
|
|
||||||
|
|
||||||
response.json({});
|
|
||||||
};
|
|
||||||
|
|
||||||
export { setSupportedSyndicateController };
|
|
@ -2,11 +2,11 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
|||||||
import { syndicateSacrifice } from "@/src/services/inventoryService";
|
import { syndicateSacrifice } from "@/src/services/inventoryService";
|
||||||
import { ISyndicateSacrifice } from "@/src/types/syndicateTypes";
|
import { ISyndicateSacrifice } from "@/src/types/syndicateTypes";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
const syndicateSacrificeController: RequestHandler = async (request, response) => {
|
const syndicateSacrificeController: RequestHandler = async (request, response) => {
|
||||||
|
|
||||||
const accountId = request.query.accountId as string;
|
const accountId = await getAccountIdForRequest(request);
|
||||||
const body = getJSONfromString(request.body);
|
const body = getJSONfromString(request.body);
|
||||||
let reply = {};
|
let reply = {};
|
||||||
try {
|
try {
|
||||||
|
@ -52,6 +52,7 @@ import { getGuildLogController } from "../controllers/api/getGuildLogController"
|
|||||||
import { guildTechController } from "../controllers/api/guildTechController";
|
import { guildTechController } from "../controllers/api/guildTechController";
|
||||||
import { dojoController } from "@/src/controllers/api/dojoController";
|
import { dojoController } from "@/src/controllers/api/dojoController";
|
||||||
import { getGuildDojoController } from "@/src/controllers/api/getGuildDojoController";
|
import { getGuildDojoController } from "@/src/controllers/api/getGuildDojoController";
|
||||||
|
import { syndicateSacrificeController } from "../controllers/api/syndicateSacrificeController";
|
||||||
|
|
||||||
const apiRouter = express.Router();
|
const apiRouter = express.Router();
|
||||||
|
|
||||||
@ -114,5 +115,6 @@ apiRouter.post("/createGuild.php", createGuildController);
|
|||||||
apiRouter.post("/sell.php", sellController);
|
apiRouter.post("/sell.php", sellController);
|
||||||
apiRouter.post("/upgrades.php", upgradesController);
|
apiRouter.post("/upgrades.php", upgradesController);
|
||||||
apiRouter.post("/guildTech.php", guildTechController);
|
apiRouter.post("/guildTech.php", guildTechController);
|
||||||
|
apiRouter.post("/syndicateSacrifice.php", syndicateSacrificeController);
|
||||||
|
|
||||||
export { apiRouter };
|
export { apiRouter };
|
||||||
|
@ -185,13 +185,6 @@ export const syndicateSacrifice = async (data: ISyndicateSacrifice, accountId: s
|
|||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const updateSyndicate = async (syndicate: string, accountId: string) => {
|
|
||||||
const inventory = await getInventory(accountId);
|
|
||||||
|
|
||||||
inventory.SupportedSyndicate = syndicate;
|
|
||||||
await inventory.save();
|
|
||||||
};
|
|
||||||
|
|
||||||
export const addWeapon = async (
|
export const addWeapon = async (
|
||||||
weaponType: WeaponTypeInternal,
|
weaponType: WeaponTypeInternal,
|
||||||
weaponName: string,
|
weaponName: string,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user