1
0
forked from baron/baron-sso

이슈 #868: 총괄기획실 우선순위 적용 및 슬러그 유추 로직 강화

This commit is contained in:
2026-05-26 17:06:32 +09:00
parent e481ae2821
commit 57d92fa748
2 changed files with 109 additions and 5 deletions

View File

@@ -579,10 +579,37 @@ function suggestUniqueTenantSlug(value: string, tenants: TenantSummary[]) {
}
function slugify(value: string) {
return value
.trim()
// 한글 조직명을 영어로 유추하거나 정규화하는 맵 (자주 쓰이는 단어)
const commonMappings: Record<string, string> = {
: "gpd",
: "tdc",
: "planning",
: "sales",
: "infra",
: "construction",
: "ops",
: "env",
: "biz",
: "hq",
: "dept",
: "team",
: "support",
};
let result = value.trim();
// 1. 전체 매칭 확인
if (commonMappings[result]) {
return commonMappings[result];
}
// 2. 부분 단어 치환 및 정규화
return result
.toLowerCase()
.replace(/[^a-z0-9가-힣ㄱ-ㅎㅏ-ㅣ]+/g, "-")
.replace(/[^a-z0-9가-힣ㄱ-ㅎㅏ-ㅣ]+/g, "-") // 특수문자 제거
.split("-")
.map((part) => commonMappings[part] || part) // 부분 단어 변환
.join("-")
.replace(/^-+|-+$/g, "");
}