forked from OpenWF/SpaceNinjaServer
The only functionally relevant change is that orbiter scenes are now saved via SkinFlavourItem (as of U39?). The rest is cleanup of the types because the ship customization stuff was duplicated all over the place. Reviewed-on: OpenWF/SpaceNinjaServer#2402 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
21 lines
924 B
TypeScript
21 lines
924 B
TypeScript
import { getAccountIdForRequest } from "@/src/services/loginService";
|
|
import { IShipDecorationsRequest } from "@/src/types/personalRoomsTypes";
|
|
import { logger } from "@/src/utils/logger";
|
|
import { RequestHandler } from "express";
|
|
import { handleSetShipDecorations } from "@/src/services/shipCustomizationsService";
|
|
|
|
export const shipDecorationsController: RequestHandler = async (req, res) => {
|
|
const accountId = await getAccountIdForRequest(req);
|
|
const shipDecorationsRequest = JSON.parse(req.body as string) as IShipDecorationsRequest;
|
|
|
|
try {
|
|
const placedDecoration = await handleSetShipDecorations(accountId, shipDecorationsRequest);
|
|
res.send(placedDecoration);
|
|
} catch (error: unknown) {
|
|
if (error instanceof Error) {
|
|
logger.error(`error in shipDecorationsController: ${error.message}`);
|
|
res.status(400).json({ error: error.message });
|
|
}
|
|
}
|
|
};
|