Skip to content

Commit 00e965b

Browse files
committed
refactor: UUID 36 -> 13자리 토큰으로 변경
1 parent 2ad3bc3 commit 00e965b

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/main/java/com/back/web7_9_codecrete_be/domain/plans/controller/PlanController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,13 @@ public RsData<Void> quitPlan(@PathVariable Long planId) {
244244
}
245245

246246
/**
247-
* 공유 링크 생성 (UUID)
247+
* 공유 링크 생성 (UUID 기반 13자)
248248
*
249249
* @param planId 계획 ID
250250
* @return 공유 링크 정보 (200 OK)
251251
*/
252252
@PostMapping("/{planId}/share/link")
253-
@Operation(summary = "공유 링크 생성", description = "플랜 공유를 위한 UUID 링크를 생성합니다. 계획의 소유자 또는 편집 권한이 있는 사용자만 링크를 생성할 수 있습니다.")
253+
@Operation(summary = "공유 링크 생성", description = "플랜 공유를 위한 UUID 기반 13자 토큰 링크를 생성합니다. 계획의 소유자 또는 편집 권한이 있는 사용자만 링크를 생성할 수 있습니다.")
254254
public RsData<PlanShareLinkResponse> generateShareLink(@PathVariable Long planId) {
255255
User user = rq.getUser();
256256
PlanShareLinkResponse response = planService.generateShareLink(planId, user);
@@ -260,7 +260,7 @@ public RsData<PlanShareLinkResponse> generateShareLink(@PathVariable Long planId
260260
/**
261261
* 공유 링크로 플랜 참가
262262
*
263-
* @param shareToken 공유 토큰 (UUID)
263+
* @param shareToken 공유 토큰 (UUID 기반 13자)
264264
* @return 플랜 상세 정보 (200 OK)
265265
*/
266266
@PostMapping("/share/{shareToken}")

src/main/java/com/back/web7_9_codecrete_be/domain/plans/dto/response/PlanShareLinkResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ public class PlanShareLinkResponse {
1212
@Schema(description = "플랜 ID", example = "1")
1313
private Long planId;
1414

15-
@Schema(description = "공유 토큰 (UUID)", example = "550e8400-e29b-41d4-a716-446655440000")
15+
@Schema(description = "공유 토큰 (UUID 기반 13자)", example = "550e8400-e29b")
1616
private String shareToken;
1717

18-
@Schema(description = "공유 링크", example = "/plans/share/550e8400-e29b-41d4-a716-446655440000")
18+
@Schema(description = "공유 링크", example = "/plans/share/550e8400-e29b")
1919
private String shareLink;
2020
}
2121

src/main/java/com/back/web7_9_codecrete_be/domain/plans/entity/Plan.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class Plan {
5151
@Column(name = "modified_date", nullable = false)
5252
private LocalDateTime modifiedDate;
5353

54-
@Column(name = "share_token", unique = true, length = 36)
54+
@Column(name = "share_token", unique = true, length = 13)
5555
private String shareToken;
5656

5757
@OneToMany(mappedBy = "plan", cascade = CascadeType.ALL, orphanRemoval = true)
@@ -90,7 +90,7 @@ public void addSchedule(Schedule schedule) {
9090
}
9191

9292
public void generateShareToken() {
93-
this.shareToken = UUID.randomUUID().toString();
93+
this.shareToken = UUID.randomUUID().toString().substring(0, 13);
9494
}
9595

9696
public void clearShareToken() {

src/main/java/com/back/web7_9_codecrete_be/domain/plans/service/PlanService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ public void updateParticipantRole(Long planId, Long participantId, User user,
691691
}
692692

693693
/**
694-
* 공유 링크 생성 (UUID)
694+
* 공유 링크 생성 (UUID 기반 13자)
695695
*
696696
* @param planId 계획 ID
697697
* @param user 현재 로그인한 사용자 (권한 체크용)
@@ -719,7 +719,7 @@ public PlanShareLinkResponse generateShareLink(Long planId, User user) {
719719
/**
720720
* 공유 링크로 플랜 참가
721721
*
722-
* @param shareToken 공유 토큰 (UUID)
722+
* @param shareToken 공유 토큰 (UUID 기반 13자)
723723
* @param user 현재 로그인한 사용자
724724
* @return 플랜 상세 정보
725725
* @throws BusinessException 공유 링크가 유효하지 않은 경우, 이미 참가자인 경우

0 commit comments

Comments
 (0)