SpaceNinjaServer/src/controllers/api/setSupportedSyndicateController.ts
Sainan 0d388b4b0f feat: support websocket connections from game client (#2735)
For bootstrapper v0.11.11, out now.

Reviewed-on: OpenWF/SpaceNinjaServer#2735
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
2025-09-10 00:00:09 -07:00

21 lines
645 B
TypeScript

import type { RequestHandler } from "express";
import { getAccountIdForRequest } from "../../services/loginService.ts";
import { Inventory } from "../../models/inventoryModels/inventoryModel.ts";
import { broadcastInventoryUpdate } from "../../services/wsService.ts";
export const setSupportedSyndicateController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req);
await Inventory.updateOne(
{
accountOwnerId: accountId
},
{
SupportedSyndicate: req.query.syndicate as string
}
);
res.end();
broadcastInventoryUpdate(req);
};