feat: dojo decorations #1079
@ -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;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user