feat: setDojoComponentMessage
All checks were successful
Build / build (18) (push) Successful in 57s
Build / build (20) (push) Successful in 34s
Build / build (20) (pull_request) Successful in 33s
Build / build (18) (pull_request) Successful in 55s
Build / build (22) (push) Successful in 1m17s
Build / build (22) (pull_request) Successful in 33s
All checks were successful
Build / build (18) (push) Successful in 57s
Build / build (20) (push) Successful in 34s
Build / build (20) (pull_request) Successful in 33s
Build / build (18) (pull_request) Successful in 55s
Build / build (22) (push) Successful in 1m17s
Build / build (22) (pull_request) Successful in 33s
This commit is contained in:
parent
dc4d592b5a
commit
8b76eaffe8
@ -43,6 +43,8 @@ export const getGuildDojoController: RequestHandler = async (req, res) => {
|
||||
id: toOid(dojoComponent._id),
|
||||
pf: dojoComponent.pf,
|
||||
ppf: dojoComponent.ppf,
|
||||
Name: dojoComponent.Name,
|
||||
Message: dojoComponent.Message,
|
||||
DecoCapacity: 600
|
||||
};
|
||||
if (dojoComponent.pi) {
|
||||
|
20
src/controllers/api/setDojoComponentMessageController.ts
Normal file
20
src/controllers/api/setDojoComponentMessageController.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { RequestHandler } from "express";
|
||||
import { getGuildForRequest } from "@/src/services/guildService";
|
||||
|
||||
export const setDojoComponentMessageController: RequestHandler = async (req, res) => {
|
||||
const guild = await getGuildForRequest(req);
|
||||
// At this point, we know that a member of the guild is making this request. Assuming they are allowed to change the message.
|
||||
const component = guild.DojoComponents!.find(x => x._id.equals(req.query.componentId as string))!;
|
||||
const payload = JSON.parse(String(req.body)) as SetDojoComponentMessageRequest;
|
||||
if ("Name" in payload) {
|
||||
component.Name = payload.Name;
|
||||
} else {
|
||||
component.Message = payload.Message;
|
||||
}
|
||||
await guild.save();
|
||||
res.json({
|
||||
DojoRequestStatus: 1
|
||||
});
|
||||
};
|
||||
|
||||
type SetDojoComponentMessageRequest = { Name: string } | { Message: string };
|
@ -14,6 +14,8 @@ const dojoComponentSchema = new Schema<IDojoComponentDatabase>({
|
||||
pi: Schema.Types.ObjectId,
|
||||
op: String,
|
||||
pp: String,
|
||||
Name: String,
|
||||
Message: String,
|
||||
CompletionTime: Date
|
||||
});
|
||||
|
||||
|
@ -62,6 +62,7 @@ import { sellController } from "@/src/controllers/api/sellController";
|
||||
import { setActiveQuestController } from "@/src/controllers/api/setActiveQuestController";
|
||||
import { setActiveShipController } from "@/src/controllers/api/setActiveShipController";
|
||||
import { setBootLocationController } from "@/src/controllers/api/setBootLocationController";
|
||||
import { setDojoComponentMessageController } from "@/src/controllers/api/setDojoComponentMessageController";
|
||||
import { setEquippedInstrumentController } from "@/src/controllers/api/setEquippedInstrumentController";
|
||||
import { setPlacedDecoInfoController } from "@/src/controllers/api/setPlacedDecoInfoController";
|
||||
import { setShipCustomizationsController } from "@/src/controllers/api/setShipCustomizationsController";
|
||||
@ -158,6 +159,7 @@ apiRouter.post("/rerollRandomMod.php", rerollRandomModController);
|
||||
apiRouter.post("/saveDialogue.php", saveDialogueController);
|
||||
apiRouter.post("/saveLoadout.php", saveLoadoutController);
|
||||
apiRouter.post("/sell.php", sellController);
|
||||
apiRouter.post("/setDojoComponentMessage.php", setDojoComponentMessageController);
|
||||
apiRouter.post("/setEquippedInstrument.php", setEquippedInstrumentController);
|
||||
apiRouter.post("/setPlacedDecoInfo.php", setPlacedDecoInfoController);
|
||||
apiRouter.post("/setShipCustomizations.php", setShipCustomizationsController);
|
||||
|
@ -34,6 +34,8 @@ export interface IDojoComponentClient {
|
||||
pi?: IOid; // Parent ID. N/A to root.
|
||||
op?: string; // "Open Portal"? N/A to root.
|
||||
pp?: string; // "Parent Portal"? N/A to root.
|
||||
Name?: string;
|
||||
Message?: string;
|
||||
RegularCredits?: number; // "Collecting Materials" state: Number of credits that were donated.
|
||||
MiscItems?: IMiscItem[]; // "Collecting Materials" state: Resources that were donated.
|
||||
CompletionTime?: IMongoDate;
|
||||
|
Loading…
x
Reference in New Issue
Block a user