forked from OpenWF/SpaceNinjaServer
		
	Closes #1288 Reviewed-on: OpenWF/SpaceNinjaServer#2004 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
		
			
				
	
	
		
			21 lines
		
	
	
		
			924 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			924 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { toOid } from "@/src/helpers/inventoryHelpers";
 | 
						|
import { Account, Ignore } from "@/src/models/loginModel";
 | 
						|
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
						|
import { IFriendInfo } from "@/src/types/friendTypes";
 | 
						|
import { parallelForeach } from "@/src/utils/async-utils";
 | 
						|
import { RequestHandler } from "express";
 | 
						|
 | 
						|
export const getIgnoredUsersController: RequestHandler = async (req, res) => {
 | 
						|
    const accountId = await getAccountIdForRequest(req);
 | 
						|
    const ignores = await Ignore.find({ ignorer: accountId });
 | 
						|
    const ignoredUsers: IFriendInfo[] = [];
 | 
						|
    await parallelForeach(ignores, async ignore => {
 | 
						|
        const ignoreeAccount = (await Account.findById(ignore.ignoree, "DisplayName"))!;
 | 
						|
        ignoredUsers.push({
 | 
						|
            _id: toOid(ignore.ignoree),
 | 
						|
            DisplayName: ignoreeAccount.DisplayName + ""
 | 
						|
        });
 | 
						|
    });
 | 
						|
    res.json({ IgnoredUsers: ignoredUsers });
 | 
						|
};
 |