forked from OpenWF/SpaceNinjaServer
		
	Also moves guild-specific cheats to a switch for each guild Closes #1403 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Reviewed-on: OpenWF/SpaceNinjaServer#2752 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
		
			
				
	
	
		
			17 lines
		
	
	
		
			622 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			622 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { Alliance, Guild } from "../../models/guildModel.ts";
 | 
						|
import { getAllianceClient } from "../../services/guildService.ts";
 | 
						|
import type { RequestHandler } from "express";
 | 
						|
 | 
						|
export const getAllianceController: RequestHandler = async (req, res) => {
 | 
						|
    const guildId = req.query.guildId;
 | 
						|
    if (guildId) {
 | 
						|
        const guild = await Guild.findById(guildId, "Name Tier AllianceId");
 | 
						|
        if (guild && guild.AllianceId) {
 | 
						|
            const alliance = (await Alliance.findById(guild.AllianceId))!;
 | 
						|
            res.json(await getAllianceClient(alliance, guild));
 | 
						|
            return;
 | 
						|
        }
 | 
						|
    }
 | 
						|
    res.end();
 | 
						|
};
 |