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
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:
parent
b024f19b75
commit
ba9b8cc736
@ -25,5 +25,5 @@ export const getGuildDojoController: RequestHandler = async (req, res) => {
|
|||||||
await guild.save();
|
await guild.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
res.json(getDojoClient(guild));
|
res.json(getDojoClient(guild, 0));
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { getGuildForRequest } from "@/src/services/guildService";
|
import { getDojoClient, getGuildForRequest } from "@/src/services/guildService";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { ExportDojoRecipes } from "warframe-public-export-plus";
|
import { ExportDojoRecipes } from "warframe-public-export-plus";
|
||||||
|
|
||||||
@ -15,7 +15,5 @@ export const queueDojoComponentDestructionController: RequestHandler = async (re
|
|||||||
guild.DojoEnergy -= room.energy;
|
guild.DojoEnergy -= room.energy;
|
||||||
}
|
}
|
||||||
await guild.save();
|
await guild.save();
|
||||||
res.json({
|
res.json(getDojoClient(guild, 1));
|
||||||
DojoRequestStatus: 1
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,7 @@ export const setDojoComponentMessageController: RequestHandler = async (req, res
|
|||||||
component.Message = payload.Message;
|
component.Message = payload.Message;
|
||||||
}
|
}
|
||||||
await guild.save();
|
await guild.save();
|
||||||
res.json(getDojoClient(guild));
|
res.json(getDojoClient(guild, 1));
|
||||||
};
|
};
|
||||||
|
|
||||||
type SetDojoComponentMessageRequest = { Name: string } | { Message: string };
|
type SetDojoComponentMessageRequest = { Name: string } | { Message: string };
|
||||||
|
@ -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 { getGuildForRequest } from "@/src/services/guildService";
|
import { getDojoClient, getGuildForRequest } 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";
|
||||||
|
|
||||||
@ -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.
|
CompletionTime: new Date(Date.now()) // TOOD: Omit this field & handle the "Collecting Materials" state.
|
||||||
});
|
});
|
||||||
await guild.save();
|
await guild.save();
|
||||||
res.json({
|
res.json(getDojoClient(guild, 0));
|
||||||
DojoRequestStatus: 0
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
@ -28,7 +28,7 @@ export const getGuildForRequestEx = async (
|
|||||||
return guild;
|
return guild;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getDojoClient = (guild: TGuildDatabaseDocument): IDojoClient => {
|
export const getDojoClient = (guild: TGuildDatabaseDocument, status: number): IDojoClient => {
|
||||||
const dojo: IDojoClient = {
|
const dojo: IDojoClient = {
|
||||||
_id: { $oid: guild._id.toString() },
|
_id: { $oid: guild._id.toString() },
|
||||||
Name: guild.Name,
|
Name: guild.Name,
|
||||||
@ -38,7 +38,7 @@ export const getDojoClient = (guild: TGuildDatabaseDocument): IDojoClient => {
|
|||||||
RevisionTime: Math.round(Date.now() / 1000),
|
RevisionTime: Math.round(Date.now() / 1000),
|
||||||
Energy: guild.DojoEnergy,
|
Energy: guild.DojoEnergy,
|
||||||
Capacity: guild.DojoCapacity,
|
Capacity: guild.DojoCapacity,
|
||||||
DojoRequestStatus: 1,
|
DojoRequestStatus: status,
|
||||||
DojoComponents: []
|
DojoComponents: []
|
||||||
};
|
};
|
||||||
guild.DojoComponents!.forEach(dojoComponent => {
|
guild.DojoComponents!.forEach(dojoComponent => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user