use getDojoClient for all responses to avoid double-reloading
All checks were successful
Build / build (18) (push) Successful in 38s
Build / build (22) (push) Successful in 55s
Build / build (20) (push) Successful in 1m17s
Build / build (18) (pull_request) Successful in 39s
Build / build (20) (pull_request) Successful in 56s
Build / build (22) (pull_request) Successful in 1m32s

This commit is contained in:
Sainan 2025-02-12 04:57:43 +01:00
parent b024f19b75
commit ba9b8cc736
5 changed files with 8 additions and 12 deletions

View File

@ -25,5 +25,5 @@ export const getGuildDojoController: RequestHandler = async (req, res) => {
await guild.save();
}
res.json(getDojoClient(guild));
res.json(getDojoClient(guild, 0));
};

View File

@ -1,4 +1,4 @@
import { getGuildForRequest } from "@/src/services/guildService";
import { getDojoClient, getGuildForRequest } from "@/src/services/guildService";
import { RequestHandler } from "express";
import { ExportDojoRecipes } from "warframe-public-export-plus";
@ -15,7 +15,5 @@ export const queueDojoComponentDestructionController: RequestHandler = async (re
guild.DojoEnergy -= room.energy;
}
await guild.save();
res.json({
DojoRequestStatus: 1
});
res.json(getDojoClient(guild, 1));
};

View File

@ -12,7 +12,7 @@ export const setDojoComponentMessageController: RequestHandler = async (req, res
component.Message = payload.Message;
}
await guild.save();
res.json(getDojoClient(guild));
res.json(getDojoClient(guild, 1));
};
type SetDojoComponentMessageRequest = { Name: string } | { Message: string };

View File

@ -1,6 +1,6 @@
import { RequestHandler } from "express";
import { IDojoComponentClient } from "@/src/types/guildTypes";
import { getGuildForRequest } from "@/src/services/guildService";
import { getDojoClient, getGuildForRequest } from "@/src/services/guildService";
import { Types } from "mongoose";
import { ExportDojoRecipes } from "warframe-public-export-plus";
@ -30,7 +30,5 @@ export const startDojoRecipeController: RequestHandler = async (req, res) => {
CompletionTime: new Date(Date.now()) // TOOD: Omit this field & handle the "Collecting Materials" state.
});
await guild.save();
res.json({
DojoRequestStatus: 0
});
res.json(getDojoClient(guild, 0));
};

View File

@ -28,7 +28,7 @@ export const getGuildForRequestEx = async (
return guild;
};
export const getDojoClient = (guild: TGuildDatabaseDocument): IDojoClient => {
export const getDojoClient = (guild: TGuildDatabaseDocument, status: number): IDojoClient => {
const dojo: IDojoClient = {
_id: { $oid: guild._id.toString() },
Name: guild.Name,
@ -38,7 +38,7 @@ export const getDojoClient = (guild: TGuildDatabaseDocument): IDojoClient => {
RevisionTime: Math.round(Date.now() / 1000),
Energy: guild.DojoEnergy,
Capacity: guild.DojoCapacity,
DojoRequestStatus: 1,
DojoRequestStatus: status,
DojoComponents: []
};
guild.DojoComponents!.forEach(dojoComponent => {