更新 src/controllers/api/startDojoRecipeController.ts
This commit is contained in:
parent
ee9bf5b1a9
commit
e600cb17e3
@ -1,6 +1,6 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { IDojoComponentClient } from "@/src/types/guildTypes";
|
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 { Types } from "mongoose";
|
||||||
import { ExportDojoRecipes } from "warframe-public-export-plus";
|
import { ExportDojoRecipes } from "warframe-public-export-plus";
|
||||||
import { config } from "@/src/services/configService";
|
import { config } from "@/src/services/configService";
|
||||||
@ -12,6 +12,7 @@ interface IStartDojoRecipeRequest {
|
|||||||
|
|
||||||
export const startDojoRecipeController: RequestHandler = async (req, res) => {
|
export const startDojoRecipeController: RequestHandler = async (req, res) => {
|
||||||
const guild = await getGuildForRequest(req);
|
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.
|
// 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;
|
const request = JSON.parse(String(req.body)) as IStartDojoRecipeRequest;
|
||||||
|
|
||||||
@ -33,6 +34,12 @@ export const startDojoRecipeController: RequestHandler = async (req, res) => {
|
|||||||
DecoCapacity: room?.decoCapacity
|
DecoCapacity: room?.decoCapacity
|
||||||
}) - 1
|
}) - 1
|
||||||
];
|
];
|
||||||
|
guildLog.RoomChanges.push({
|
||||||
|
dateTime: new Date(Date.now()),
|
||||||
|
entryType: 2,
|
||||||
|
details: request.PlacedComponent.pf
|
||||||
|
});
|
||||||
|
await guildLog.save();
|
||||||
if (config.noDojoRoomBuildStage) {
|
if (config.noDojoRoomBuildStage) {
|
||||||
component.CompletionTime = new Date(Date.now());
|
component.CompletionTime = new Date(Date.now());
|
||||||
if (room) {
|
if (room) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user