Add default value to guild discovery"
This commit is contained in:
		
							parent
							
								
									40f7e7b7d4
								
							
						
					
					
						commit
						2cd210cb7c
					
				| @ -9,11 +9,10 @@ const router = Router(); | ||||
| router.get("/", route({}), async (req: Request, res: Response) => { | ||||
| 	const { limit } = req.params; | ||||
| 	var showAllGuilds = Config.get().guild.showAllGuildsInDiscovery; | ||||
| 
 | ||||
| 	// ! this only works using SQL querys
 | ||||
| 	// TODO: implement this with default typeorm query
 | ||||
| 	// const guilds = await Guild.find({ where: { features: "DISCOVERABLE" } }); //, take: Math.abs(Number(limit)) });
 | ||||
| 	const guilds = showAllGuilds ? await Guild.find({take: Math.abs(Number(limit))}) : await Guild.find({ where: `"features" LIKE '%COMMUNITY%'`, take: Math.abs(Number(limit)) }); | ||||
| 	const guilds = showAllGuilds ? await Guild.find({take: Math.abs(Number(limit || 20))}) : await Guild.find({ where: `"features" LIKE '%COMMUNITY%'`, take: Math.abs(Number(limit || 20)) }); | ||||
| 	res.send({ guilds: guilds }); | ||||
| }); | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 The Arcane Brony
						The Arcane Brony