SpaceNinjaServer/src/controllers/api/queueDojoComponentDestructionController.ts

16 lines
619 B
TypeScript
Raw Normal View History

2025-03-06 09:28:20 +01:00
import { config } from "@/src/services/configService";
2025-03-06 09:13:50 +01:00
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;
2025-03-06 09:28:20 +01:00
guild.DojoComponents.id(componentId)!.DestructionTime = new Date(
Date.now() + (config.fastDojoRoomDestruction ? 5_000 : 2 * 3600_000)
);
await guild.save();
2025-03-06 09:13:50 +01:00
res.json(await getDojoClient(guild, 0, componentId));
2024-06-07 14:02:00 +00:00
};