fix: BossRoom soft delete → hard delete + 프로필 자동 생성
All checks were successful
Server CI/CD / lint-and-build (push) Successful in 17s
Server CI/CD / deploy (push) Successful in 57s

- BossRoom 삭제 시 Unscoped() hard delete로 변경하여 unique index 충돌 방지
- GetProfile에서 프로필 없으면 기본값으로 자동 생성

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-17 13:09:23 +09:00
parent 2c1e9698d2
commit 82adb37ecb
2 changed files with 8 additions and 3 deletions

View File

@@ -56,12 +56,16 @@ func (s *Service) CreateProfile(userID uint) error {
return s.repo.Create(profile)
}
// GetProfile JWT 인증된 유저의 프로필을 조회한다.
// GetProfile JWT 인증된 유저의 프로필을 조회한다. 없으면 자동 생성.
func (s *Service) GetProfile(userID uint) (*PlayerProfile, error) {
profile, err := s.repo.FindByUserID(userID)
if err != nil {
if err == gorm.ErrRecordNotFound {
return nil, fmt.Errorf("프로필이 존재하지 않습니다")
profile = &PlayerProfile{UserID: userID}
if createErr := s.repo.Create(profile); createErr != nil {
return nil, fmt.Errorf("프로필 자동 생성에 실패했습니다: %w", createErr)
}
return profile, nil
}
return nil, fmt.Errorf("프로필 조회에 실패했습니다")
}