feat: dojo decorations #1079

Merged
Sainan merged 13 commits from dojo-decos into main 2025-03-05 23:54:48 -08:00
Showing only changes of commit 4ac0f848ac - Show all commits

View File

@ -9,11 +9,19 @@ export const abortDojoComponentController: RequestHandler = async (req, res) =>
const guild = await getGuildForRequestEx(req, inventory); const guild = await getGuildForRequestEx(req, inventory);
const request = JSON.parse(String(req.body)) as IAbortDojoComponentRequest; const request = JSON.parse(String(req.body)) as IAbortDojoComponentRequest;
// TODO: Move already-contributed credits & items to the clan vault // TODO: Move already-contributed credits & items to the clan vault
if (request.DecoId) {
const component = guild.DojoComponents.id(request.ComponentId)!;
const decoIndex = component.Decos!.findIndex(x => x._id.equals(request.DecoId));
component.Decos!.splice(decoIndex, 1);
} else {
guild.DojoComponents.pull({ _id: request.ComponentId }); guild.DojoComponents.pull({ _id: request.ComponentId });
}
await guild.save(); await guild.save();
res.json(getDojoClient(guild, 0)); res.json(getDojoClient(guild, 0));
}; };
export interface IAbortDojoComponentRequest { interface IAbortDojoComponentRequest {
DecoType?: string;
ComponentId: string; ComponentId: string;
DecoId?: string;
} }