From fd56203f35fca2f4c0538fa9c00f7567152f5df4 Mon Sep 17 00:00:00 2001 From: Sainan Date: Mon, 6 May 2024 15:38:10 +0200 Subject: [PATCH] feat: implement pledging to syndicate (#162) --- src/controllers/api/setSupportedSyndicateController.ts | 9 +++++++++ src/models/inventoryModels/inventoryModel.ts | 2 ++ src/routes/api.ts | 2 ++ src/types/inventoryTypes/inventoryTypes.ts | 1 + 4 files changed, 14 insertions(+) create mode 100644 src/controllers/api/setSupportedSyndicateController.ts diff --git a/src/controllers/api/setSupportedSyndicateController.ts b/src/controllers/api/setSupportedSyndicateController.ts new file mode 100644 index 000000000..78ef26f37 --- /dev/null +++ b/src/controllers/api/setSupportedSyndicateController.ts @@ -0,0 +1,9 @@ +import { RequestHandler } from "express"; +import { getInventory } from "@/src/services/inventoryService"; + +export const setSupportedSyndicateController: RequestHandler = async (req, res) => { + const inventory = await getInventory(req.query.accountId as string); + inventory.SupportedSyndicate = req.query.syndicate as string; + await inventory.save(); + res.end(); +}; diff --git a/src/models/inventoryModels/inventoryModel.ts b/src/models/inventoryModels/inventoryModel.ts index 287ce62ee..43f15819f 100644 --- a/src/models/inventoryModels/inventoryModel.ts +++ b/src/models/inventoryModels/inventoryModel.ts @@ -645,6 +645,8 @@ const inventorySchema = new Schema( //Curent trade info Giving or Getting items PendingTrades: [Schema.Types.Mixed], + //Syndicate currently being pledged to. + SupportedSyndicate: String, //Curent Syndicates rank\exp Affiliations: [affiliationsSchema], //Syndicates Missions complate(Navigation->Syndicate) diff --git a/src/routes/api.ts b/src/routes/api.ts index c8fa928ed..8212ebc1f 100644 --- a/src/routes/api.ts +++ b/src/routes/api.ts @@ -46,6 +46,7 @@ import { addFriendImageController } from "@/src/controllers/api/addFriendImageCo import { createGuildController } from "@/src/controllers/api/createGuildController"; import { sellController } from "@/src/controllers/api/sellController"; import { upgradesController } from "@/src/controllers/api/upgradesController"; +import { setSupportedSyndicateController } from "@/src/controllers/api/setSupportedSyndicateController"; const apiRouter = express.Router(); @@ -73,6 +74,7 @@ apiRouter.get("/logout.php", logoutController); apiRouter.get("/setBootLocation.php", setBootLocationController); apiRouter.get("/setActiveShip.php", setActiveShipController); apiRouter.get("/getGuild.php", getGuildController); +apiRouter.get("/setSupportedSyndicate.php", setSupportedSyndicateController); // post // eslint-disable-next-line @typescript-eslint/no-misused-promises diff --git a/src/types/inventoryTypes/inventoryTypes.ts b/src/types/inventoryTypes/inventoryTypes.ts index 38a0041fd..5fce938b2 100644 --- a/src/types/inventoryTypes/inventoryTypes.ts +++ b/src/types/inventoryTypes/inventoryTypes.ts @@ -190,6 +190,7 @@ export interface IInventoryResponse { Boosters: IBooster[]; ActiveDojoColorResearch: string; SentientSpawnChanceBoosters: ISentientSpawnChanceBoosters; + SupportedSyndicate?: string; Affiliations: IAffiliation[]; QualifyingInvasions: any[]; FactionScores: number[];