-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor(MeetingService): UUID 생성 방식을 영어 대소문자, 숫자를 포함하는 8글자 랜덤 문자열로 변경 * refactor(MeetingControllerDocs): 스웨거 문서 예외상황 추가 * refactor(UuidGenerator): UUID 생성 로직을 인터페이스 컴포넌트로 분리하여 코드 개선 * refactor(MeetingService): uuid 생성 시 반복문을 for에서 do-while로 개선
- Loading branch information
1 parent
817b655
commit fc9a753
Showing
9 changed files
with
115 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
backend/src/main/java/kr/momo/domain/meeting/RandomUuidGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package kr.momo.domain.meeting; | ||
|
||
import org.apache.commons.lang3.RandomStringUtils; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class RandomUuidGenerator implements UuidGenerator { | ||
|
||
@Override | ||
public String generateUuid(int length) { | ||
return RandomStringUtils.randomAlphanumeric(length); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
backend/src/main/java/kr/momo/domain/meeting/UuidGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package kr.momo.domain.meeting; | ||
|
||
public interface UuidGenerator { | ||
|
||
String generateUuid(int length); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
backend/src/test/java/kr/momo/domain/meeting/fake/FakeUuidGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package kr.momo.domain.meeting.fake; | ||
|
||
import kr.momo.domain.meeting.UuidGenerator; | ||
|
||
public class FakeUuidGenerator implements UuidGenerator { | ||
|
||
private static final String BASE_FAKE_UUID = "Momo"; | ||
|
||
@Override | ||
public String generateUuid(int length) { | ||
StringBuilder uuid = new StringBuilder(); | ||
while (uuid.length() < length) { | ||
uuid.append(BASE_FAKE_UUID); | ||
} | ||
|
||
return uuid.substring(0, length); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters