feat: implement startDojoRecipeController to place new rooms in Dojo #273

Merged
Sainan merged 6 commits from dojo-ii into main 2024-06-06 07:55:37 -07:00
5 changed files with 69 additions and 10 deletions
Showing only changes of commit 6dbfa27c14 - Show all commits

View File

@ -1,7 +1,7 @@
import { RequestHandler } from "express"; import { RequestHandler } from "express";
import { Types } from "mongoose"; import { Types } from "mongoose";
import { Guild } from "@/src/models/guildModel"; import { Guild } from "@/src/models/guildModel";
import { IDojoClient } from "@/src/types/guildTypes"; import { IDojoClient, IDojoComponentClient } from "@/src/types/guildTypes";
import { toOid, toMongoDate } from "@/src/helpers/inventoryHelpers"; import { toOid, toMongoDate } from "@/src/helpers/inventoryHelpers";
export const getGuildDojoController: RequestHandler = async (req, res) => { export const getGuildDojoController: RequestHandler = async (req, res) => {
@ -39,13 +39,21 @@ export const getGuildDojoController: RequestHandler = async (req, res) => {
DojoComponents: [] DojoComponents: []
}; };
guild.DojoComponents.forEach(dojoComponent => { guild.DojoComponents.forEach(dojoComponent => {
dojo.DojoComponents.push({ let clientComponent: IDojoComponentClient = {
id: toOid(dojoComponent._id), id: toOid(dojoComponent._id),
pf: dojoComponent.pf, pf: dojoComponent.pf,
ppf: dojoComponent.ppf, ppf: dojoComponent.ppf,
CompletionTime: toMongoDate(dojoComponent.CompletionTime),
DecoCapacity: 600 DecoCapacity: 600
}); };
if (dojoComponent.pi) {
clientComponent.pi = toOid(dojoComponent.pi);
clientComponent.op = dojoComponent.op!;
clientComponent.pp = dojoComponent.pp!;
}
if (dojoComponent.CompletionTime) {
clientComponent.CompletionTime = toMongoDate(dojoComponent.CompletionTime);
}
dojo.DojoComponents.push(clientComponent);
}); });
res.json(dojo); res.json(dojo);
}; };

View File

@ -0,0 +1,41 @@
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
import { RequestHandler } from "express";
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
import { IDojoComponentClient } from "@/src/types/guildTypes";
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
import { getAccountIdForRequest } from "@/src/services/loginService";
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
import { Guild } from "@/src/models/guildModel";
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
import { Types } from "mongoose";
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
interface IStartDojoRecipeRequest {
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
PlacedComponent: IDojoComponentClient;
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
Revision: number;
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
}
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
export const startDojoRecipeController: RequestHandler = async (req, res) => {
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
const accountId = await getAccountIdForRequest(req);
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
const inventory = await Inventory.findOne({ accountOwnerId: accountId });
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
if (!inventory) {
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
res.status(400).end();
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
return;
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
}
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
const guildId = req.query.guildId as string;
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
if (!inventory.GuildId || inventory.GuildId.toString() != guildId) {
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
res.status(400).end();
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
return;
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
}
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
// Verified that a member of the guild is making this request. Assuming they are allowed to start a build.
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
const guild = (await Guild.findOne({ _id: guildId }))!;
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
const request = JSON.parse(req.body.toString()) as IStartDojoRecipeRequest;
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
guild.DojoComponents!.push({
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
_id: new Types.ObjectId(),
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
pf: request.PlacedComponent.pf,
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
ppf: request.PlacedComponent.ppf,
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
pi: new Types.ObjectId(request.PlacedComponent.pi!.$oid),
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
op: request.PlacedComponent.op,
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
pp: request.PlacedComponent.pp,
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
CompletionTime: new Date(Date.now()) // TOOD: Omit this field & handle the "Collecting Materials" state.
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
});
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
await guild.save();
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
res.json({
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
DojoRequestStatus: 0
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
});
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed
};
OrdisPrime commented 2024-06-06 05:27:58 -07:00 (Migrated from github.com)
Review

could use getInventory()

could use getInventory()
OrdisPrime commented 2024-06-06 05:29:34 -07:00 (Migrated from github.com)
Review

perhaps this could be a getGuild() function, seems like we would need that often

perhaps this could be a getGuild() function, seems like we would need that often
OrdisPrime commented 2024-06-06 05:30:11 -07:00 (Migrated from github.com)
Review

i dont like the non-null assertion operator here.
I would prefer coding it such that it is checked before null before, so this is not needed

i dont like the non-null assertion operator here. I would prefer coding it such that it is checked before null before, so this is not needed

View File

@ -4,6 +4,9 @@ import { model, Schema } from "mongoose";
const dojoComponentSchema = new Schema<IDojoComponentDatabase>({ const dojoComponentSchema = new Schema<IDojoComponentDatabase>({
pf: { type: String, required: true }, pf: { type: String, required: true },
ppf: String, ppf: String,
pi: Schema.Types.ObjectId,
op: String,
pp: String,
CompletionTime: Date CompletionTime: Date
}); });

View File

@ -53,6 +53,7 @@ import { guildTechController } from "../controllers/api/guildTechController";
import { dojoController } from "@/src/controllers/api/dojoController"; import { dojoController } from "@/src/controllers/api/dojoController";
import { getGuildDojoController } from "@/src/controllers/api/getGuildDojoController"; import { getGuildDojoController } from "@/src/controllers/api/getGuildDojoController";
import { syndicateSacrificeController } from "../controllers/api/syndicateSacrificeController"; import { syndicateSacrificeController } from "../controllers/api/syndicateSacrificeController";
import { startDojoRecipeController } from "@/src/controllers/api/startDojoRecipeController";
const apiRouter = express.Router(); const apiRouter = express.Router();
@ -116,5 +117,6 @@ apiRouter.post("/sell.php", sellController);
apiRouter.post("/upgrades.php", upgradesController); apiRouter.post("/upgrades.php", upgradesController);
apiRouter.post("/guildTech.php", guildTechController); apiRouter.post("/guildTech.php", guildTechController);
apiRouter.post("/syndicateSacrifice.php", syndicateSacrificeController); apiRouter.post("/syndicateSacrifice.php", syndicateSacrificeController);
apiRouter.post("/startDojoRecipe.php", startDojoRecipeController);
export { apiRouter }; export { apiRouter };

View File

@ -1,5 +1,6 @@
import { Types } from "mongoose"; import { Types } from "mongoose";
import { IOid, IMongoDate } from "@/src/types/commonTypes"; import { IOid, IMongoDate } from "@/src/types/commonTypes";
import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes";
export interface IGuild { export interface IGuild {
Name: string; Name: string;
@ -31,13 +32,17 @@ export interface IDojoComponentClient {
id: IOid; id: IOid;
pf: string; pf: string;
ppf: string; ppf: string;
CompletionTime: IMongoDate; pi?: IOid; // Parent ID. N/A to root.
DecoCapacity: number; op?: string; // "Open Portal"? N/A to root.
pp?: string; // "Parent Portal"? N/A to root.
RegularCredits?: number; // "Collecting Materials" state: Number of credits that were donated.
MiscItems?: IMiscItem[]; // "Collecting Materials" state: Resources that were donated.
CompletionTime?: IMongoDate;
DecoCapacity?: number;
} }
export interface IDojoComponentDatabase { export interface IDojoComponentDatabase extends Omit<IDojoComponentClient, "id" | "pi" | "CompletionTime" | "DecoCapacity"> {
_id: Types.ObjectId; _id: Types.ObjectId;
pf: string; pi?: Types.ObjectId;
ppf: string; CompletionTime?: Date;
CompletionTime: Date;
} }