1
0
forked from baron/baron-sso

동기화 기초구조 마련

This commit is contained in:
2026-05-12 12:25:31 +09:00
parent 3063450ee0
commit 5e649c279f
33 changed files with 3364 additions and 408 deletions

View File

@@ -10,6 +10,10 @@ import {
fetchUsers,
} from "../../../lib/adminApi";
import { type TenantNode, buildTenantFullTree } from "../../../lib/tenantTree";
import {
orderHanmacFamilyChildren,
orderHanmacFamilyTenants,
} from "../hanmacFamilyOrder";
import { filterTenantsByVisibility, getOrgUnitType } from "../tenantVisibility";
import { getOrgChartUserDisplayName, getUserOrgProfile } from "../userDisplay";
@@ -565,7 +569,10 @@ function buildOrgNode(
? 0
: inheritedCompanyColorDepth + 1;
const members = usersMap.get(slug) || [];
const children = tenantNode.children.map((child) =>
const children = orderHanmacFamilyChildren(
tenantNode,
tenantNode.children,
).map((child) =>
buildOrgNode(
child,
usersMap,
@@ -1018,33 +1025,14 @@ function collectOrgSelectionDescendants(
]);
}
function getOrgSelectionPolicyRank(node: TenantNode) {
const text = `${node.slug} ${node.name}`.toLowerCase();
if (text.includes("gpdtdc") || text.includes("총괄기획")) return 1;
if (text.includes("saman") || text.includes("삼안")) return 2;
if (
(text.includes("hanmac") || text.includes("한맥기술")) &&
!text.includes("hanmac-family")
) {
return 3;
}
if (text.includes("baron") || text.includes("바론")) return 4;
return 100;
}
export function buildOrgSelectionOptions(
familyRoot: TenantNode | null,
): OrgSelectionOption[] {
return (familyRoot?.children ?? [])
.filter((node) =>
return orderHanmacFamilyTenants(
(familyRoot?.children ?? []).filter((node) =>
["COMPANY_GROUP", "COMPANY", "ORGANIZATION"].includes(node.type),
)
.sort((a, b) => {
const rankDiff =
getOrgSelectionPolicyRank(a) - getOrgSelectionPolicyRank(b);
if (rankDiff !== 0) return rankDiff;
return a.name.localeCompare(b.name);
})
),
)
.map((node) => ({
descendants: collectOrgSelectionDescendants(node, 2),
id: node.id,