更新 src/controllers/api/startDojoRecipeController.ts

This commit is contained in:
Master 2025-03-11 20:36:50 -07:00
parent ee9bf5b1a9
commit e600cb17e3

View File

@ -1,6 +1,6 @@
import { RequestHandler } from "express";
import { IDojoComponentClient } from "@/src/types/guildTypes";
import { getDojoClient, getGuildForRequest, processDojoBuildMaterialsGathered } from "@/src/services/guildService";
import { getDojoClient, getGuildForRequest, getGuildLogForRequest, processDojoBuildMaterialsGathered } from "@/src/services/guildService";
import { Types } from "mongoose";
import { ExportDojoRecipes } from "warframe-public-export-plus";
import { config } from "@/src/services/configService";
@ -12,6 +12,7 @@ interface IStartDojoRecipeRequest {
export const startDojoRecipeController: RequestHandler = async (req, res) => {
const guild = await getGuildForRequest(req);
const guildLog = await getGuildLogForRequest(req);
// At this point, we know that a member of the guild is making this request. Assuming they are allowed to start a build.
const request = JSON.parse(String(req.body)) as IStartDojoRecipeRequest;
@ -33,6 +34,12 @@ export const startDojoRecipeController: RequestHandler = async (req, res) => {
DecoCapacity: room?.decoCapacity
}) - 1
];
guildLog.RoomChanges.push({
dateTime: new Date(Date.now()),
entryType: 2,
details: request.PlacedComponent.pf
});
await guildLog.save();
if (config.noDojoRoomBuildStage) {
component.CompletionTime = new Date(Date.now());
if (room) {