forked from baron/baron-sso
이슈 #868: 총괄기획실 우선순위 적용 및 슬러그 유추 로직 강화
This commit is contained in:
@@ -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, "");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user