forked from OpenWF/SpaceNinjaServer
		
	chore: use inventory projection for getGuild requests (#1212)
Reviewed-on: OpenWF/SpaceNinjaServer#1212
This commit is contained in:
		
							parent
							
								
									05356af9bd
								
							
						
					
					
						commit
						1d23f2736f
					
				@ -7,7 +7,7 @@ import { createUniqueClanName, getGuildClient } from "@/src/services/guildServic
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const getGuildController: RequestHandler = async (req, res) => {
 | 
					const getGuildController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const accountId = await getAccountIdForRequest(req);
 | 
					    const accountId = await getAccountIdForRequest(req);
 | 
				
			||||||
    const inventory = await getInventory(accountId);
 | 
					    const inventory = await getInventory(accountId, "GuildId");
 | 
				
			||||||
    if (inventory.GuildId) {
 | 
					    if (inventory.GuildId) {
 | 
				
			||||||
        const guild = await Guild.findOne({ _id: inventory.GuildId });
 | 
					        const guild = await Guild.findOne({ _id: inventory.GuildId });
 | 
				
			||||||
        if (guild) {
 | 
					        if (guild) {
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@ import { RequestHandler } from "express";
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export const getGuildLogController: RequestHandler = async (req, res) => {
 | 
					export const getGuildLogController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const accountId = await getAccountIdForRequest(req);
 | 
					    const accountId = await getAccountIdForRequest(req);
 | 
				
			||||||
    const inventory = await getInventory(accountId);
 | 
					    const inventory = await getInventory(accountId, "GuildId");
 | 
				
			||||||
    if (inventory.GuildId) {
 | 
					    if (inventory.GuildId) {
 | 
				
			||||||
        const guild = await Guild.findOne({ _id: inventory.GuildId });
 | 
					        const guild = await Guild.findOne({ _id: inventory.GuildId });
 | 
				
			||||||
        if (guild) {
 | 
					        if (guild) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user