[Feat] #657 - 솝탬프 유저 앱잼 모드 닉네임 정책 도입 및 upsert 로직 리팩터링 #668
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related issue 🛠
Work Description ✏️
개요
상세 변경 내용
1) 앱잼 모드 플래그 및 upsert 분기 (SoptampUserService)
false(기본값): NORMAL 시즌 모드
true: APPJAM 모드
NORMAL → upsertSoptampUserNormal
APPJAM → upsertSoptampUserForAppjam
NORMAL 모드 동작
최신 활동의 part 기준으로 SoptPart.getShortedPartName() + 이름 형태 닉네임 생성.
createNewSoptampUser로 유저 생성, 포인트 0, createNewRank 호출.
DB에 저장된 generation과 profile.lastGeneration이 다를 때만 업데이트.
닉네임 재생성(generatePartBasedUniqueNickname), 포인트 0으로 초기화.
랭킹 캐시 제거 후(removeRank) 재생성(createNewRank).
APPJAM 모드 동작
AppjamUser 존재: teamName + name (예: 비트황혜린)
미참여: lastGeneration + "기" + name (예: 37기황혜린)
위 규칙으로 base 닉네임 생성 후, 전역 중복 검사(generateUniqueNicknameInternal)를 통해 필요한 경우 A, B 등의 접미사 추가.
포인트 0으로 초기화하고 신규 유저 생성, createNewRank 호출.
닉네임이 비어있거나, 어떤 SoptPart.getShortedPartName()으로 시작하면 → 파트 기반 시즌 닉네임으로 간주 → 마이그레이션 수행.
그렇지 않으면(예: 비트황혜린, 37기황혜린, 비트황혜린A) → 이미 앱잼 스타일 닉네임으로 간주 → 업데이트 스킵.
base 닉네임(teamName+이름 또는 기수+기+이름) 기준으로 닉네임 다시 생성 + 유니크 보장.
포인트 0으로 초기화.
랭킹 캐시를 현재 상태로 덮어쓰기(updateCachedUserInfo).
2) 닉네임 유니크 체크 개선 (SoptampUserRepository)
동일 유저의 기존 닉네임은 중복으로 보지 않고, 다른 유저들이 같은 닉을 쓰고 있는지만 체크 가능.
generateUniqueNicknameInternal에서 사용하여:
기존 유저가 닉네임 업데이트 시에도 자기 자신 때문에 중복 판정되지 않도록 개선.
동명이인/팀 내 중복 조건에서만 접미사 부여.
3) 관리자 초기화 파사드 및 컨트롤러 (AdminSoptampFacade, AdminSoptampController)
initAllMissionAndStampAndPoints(): 스탬프/미션 전체 삭제 + 포인트 전체 초기화.
initPoints(): 포인트만 전체 초기화.
initRankCache(): DB 기준으로 랭킹 캐시 재빌드.
DELETE /api/v2/admin/soptamp/stamp
DELETE /api/v2/admin/soptamp/point
DELETE /api/v2/admin/soptamp/cache
4) 단위 테스트 추가 (SoptampUserServiceTest)
신규 유저 생성 (파트 기반 / 팀명 기반 / 기수 기반).
동일 기수에서의 no-op.
기수 변경 시 닉네임 재생성 + 포인트 초기화.
파트 기반 닉네임 → 앱잼 규칙 닉네임 1회 마이그레이션.
이미 앱잼 스타일 닉네임인 경우 no-op.
닉네임 충돌 시 접미사 A 부여.
-> NORMAL/APPJAM 모드별 upsert 시나리오 전부 통과 확인.
Trouble Shooting ⚽️
Related ScreenShot 📷
Uncompleted Tasks 😅
To Reviewers 📢