feat: clan members #1143
@ -3,11 +3,10 @@ import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
 | 
			
		||||
import { Guild, GuildMember } from "@/src/models/guildModel";
 | 
			
		||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
			
		||||
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
 | 
			
		||||
import { getGuildVault } from "@/src/services/guildService";
 | 
			
		||||
import { fillInInventoryDataForGuildMember, getGuildVault } from "@/src/services/guildService";
 | 
			
		||||
import { logger } from "@/src/utils/logger";
 | 
			
		||||
import { IGuildMemberClient } from "@/src/types/guildTypes";
 | 
			
		||||
import { Account } from "@/src/models/loginModel";
 | 
			
		||||
import { config } from "@/src/services/configService";
 | 
			
		||||
 | 
			
		||||
const getGuildController: RequestHandler = async (req, res) => {
 | 
			
		||||
    const accountId = await getAccountIdForRequest(req);
 | 
			
		||||
@ -45,15 +44,7 @@ const getGuildController: RequestHandler = async (req, res) => {
 | 
			
		||||
                        },
 | 
			
		||||
                        "DisplayName"
 | 
			
		||||
                    ))!.DisplayName;
 | 
			
		||||
                    const inventory = (await Inventory.findOne(
 | 
			
		||||
                        {
 | 
			
		||||
                            accountOwnerId: guildMember.accountId
 | 
			
		||||
                        },
 | 
			
		||||
                        "PlayerLevel ActiveAvatarImageType"
 | 
			
		||||
                    ))!;
 | 
			
		||||
                    member.PlayerLevel =
 | 
			
		||||
                        config.spoofMasteryRank == -1 ? inventory.PlayerLevel : config.spoofMasteryRank;
 | 
			
		||||
                    member.ActiveAvatarImageType = inventory.ActiveAvatarImageType;
 | 
			
		||||
                    await fillInInventoryDataForGuildMember(member);
 | 
			
		||||
                }
 | 
			
		||||
                members.push(member);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -2,18 +2,20 @@ import { Request } from "express";
 | 
			
		||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
			
		||||
import { getInventory } from "@/src/services/inventoryService";
 | 
			
		||||
import { Guild, TGuildDatabaseDocument } from "@/src/models/guildModel";
 | 
			
		||||
import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
 | 
			
		||||
import { Inventory, TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
 | 
			
		||||
import {
 | 
			
		||||
    IDojoClient,
 | 
			
		||||
    IDojoComponentClient,
 | 
			
		||||
    IDojoContributable,
 | 
			
		||||
    IDojoDecoClient,
 | 
			
		||||
    IGuildMemberClient,
 | 
			
		||||
    IGuildVault
 | 
			
		||||
} from "@/src/types/guildTypes";
 | 
			
		||||
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
 | 
			
		||||
import { Types } from "mongoose";
 | 
			
		||||
import { ExportDojoRecipes, IDojoBuild } from "warframe-public-export-plus";
 | 
			
		||||
import { logger } from "../utils/logger";
 | 
			
		||||
import { config } from "./configService";
 | 
			
		||||
 | 
			
		||||
export const getGuildForRequest = async (req: Request): Promise<TGuildDatabaseDocument> => {
 | 
			
		||||
    const accountId = await getAccountIdForRequest(req);
 | 
			
		||||
@ -192,3 +194,14 @@ export const processDojoBuildMaterialsGathered = (guild: TGuildDatabaseDocument,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const fillInInventoryDataForGuildMember = async (member: IGuildMemberClient): Promise<void> => {
 | 
			
		||||
    const inventory = (await Inventory.findOne(
 | 
			
		||||
        {
 | 
			
		||||
            accountOwnerId: member._id.$oid
 | 
			
		||||
        },
 | 
			
		||||
        "PlayerLevel ActiveAvatarImageType"
 | 
			
		||||
    ))!;
 | 
			
		||||
    member.PlayerLevel = config.spoofMasteryRank == -1 ? inventory.PlayerLevel : config.spoofMasteryRank;
 | 
			
		||||
    member.ActiveAvatarImageType = inventory.ActiveAvatarImageType;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user