feat: abort building of a deco
All checks were successful
Build / build (22) (push) Successful in 36s
Build / build (20) (push) Successful in 51s
Build / build (18) (pull_request) Successful in 40s
Build / build (20) (pull_request) Successful in 52s
Build / build (22) (pull_request) Successful in 1m0s
Build / build (18) (push) Successful in 1m10s
All checks were successful
Build / build (22) (push) Successful in 36s
Build / build (20) (push) Successful in 51s
Build / build (18) (pull_request) Successful in 40s
Build / build (20) (pull_request) Successful in 52s
Build / build (22) (pull_request) Successful in 1m0s
Build / build (18) (push) Successful in 1m10s
This commit is contained in:
parent
e279a9369f
commit
4ac0f848ac
@ -9,11 +9,19 @@ export const abortDojoComponentController: RequestHandler = async (req, res) =>
|
||||
const guild = await getGuildForRequestEx(req, inventory);
|
||||
const request = JSON.parse(String(req.body)) as IAbortDojoComponentRequest;
|
||||
// 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 });
|
||||
}
|
||||
await guild.save();
|
||||
res.json(getDojoClient(guild, 0));
|
||||
};
|
||||
|
||||
export interface IAbortDojoComponentRequest {
|
||||
interface IAbortDojoComponentRequest {
|
||||
DecoType?: string;
|
||||
ComponentId: string;
|
||||
DecoId?: string;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user