2025-08-25 13:37:14 -07:00
|
|
|
import { toOid } from "../../helpers/inventoryHelpers.ts";
|
|
|
|
|
import { Account, Ignore } from "../../models/loginModel.ts";
|
|
|
|
|
import { getAccountIdForRequest } from "../../services/loginService.ts";
|
|
|
|
|
import type { IFriendInfo } from "../../types/friendTypes.ts";
|
|
|
|
|
import { parallelForeach } from "../../utils/async-utils.ts";
|
2025-08-24 21:41:20 -07:00
|
|
|
import type { RequestHandler } from "express";
|
2023-05-19 15:22:48 -03:00
|
|
|
|
2025-04-18 11:16:43 -07:00
|
|
|
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 + ""
|
|
|
|
|
});
|
2023-05-23 20:42:06 -04:00
|
|
|
});
|
2025-04-18 11:16:43 -07:00
|
|
|
res.json({ IgnoredUsers: ignoredUsers });
|
2023-05-19 15:22:48 -03:00
|
|
|
};
|