SpaceNinjaServerOnlyGit/src/controllers/api/queueDojoComponentDestructionController.ts
Sainan 77aa1caa8f feat: dojo room destruction stage (#1089)
Closes #1074

Based on what I could find, apparently only rooms need 2 hours to destroy and decos are removed instantly.

Reviewed-on: OpenWF/SpaceNinjaServer#1089
2025-03-06 07:19:01 -08:00

16 lines
619 B
TypeScript

import { config } from "@/src/services/configService";
import { getDojoClient, getGuildForRequest } from "@/src/services/guildService";
import { RequestHandler } from "express";
export const queueDojoComponentDestructionController: RequestHandler = async (req, res) => {
const guild = await getGuildForRequest(req);
const componentId = req.query.componentId as string;
guild.DojoComponents.id(componentId)!.DestructionTime = new Date(
Date.now() + (config.fastDojoRoomDestruction ? 5_000 : 2 * 3600_000)
);
await guild.save();
res.json(await getDojoClient(guild, 0, componentId));
};