File tree Expand file tree Collapse file tree
src/main/java/com/thinkeep/domain/user Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import com .thinkeep .domain .badge .dto .UserBadgeResponse ;
44import com .thinkeep .domain .user .dto .CreateRequest ;
55import com .thinkeep .domain .user .dto .Response ;
6+ import com .thinkeep .domain .user .dto .StreakCountResponse ;
67import com .thinkeep .domain .user .dto .UpdateRequest ;
8+ import com .thinkeep .domain .user .entity .User ;
9+ import com .thinkeep .domain .user .repository .UserRepository ;
710import com .thinkeep .domain .user .service .UserService ;
811import io .swagger .v3 .oas .annotations .Operation ;
912import io .swagger .v3 .oas .annotations .Parameter ;
2629public class UserController {
2730
2831 private final UserService userService ;
32+ private final UserRepository userRepository ;
2933
3034 /**
3135 * 사용자 생성 (회원가입)
@@ -155,4 +159,12 @@ public ResponseEntity<UserBadgeResponse> increaseStreakCount(@PathVariable Long
155159 }
156160 }
157161
162+ @ Operation (summary = "사용자 스트릭 수 조회" , description = "사용자의 현재 streakCount를 반환합니다." )
163+ @ GetMapping ("/{userNo}/streak" )
164+ public ResponseEntity <StreakCountResponse > getStreakCount (@ PathVariable Long userNo ) {
165+ User user = userRepository .findById (userNo )
166+ .orElseThrow (() -> new IllegalArgumentException ("해당 사용자가 존재하지 않습니다." ));
167+ return ResponseEntity .ok (new StreakCountResponse (user .getUserNo (), user .getStreakCount ()));
168+ }
169+
158170}
Original file line number Diff line number Diff line change 1+ package com .thinkeep .domain .user .dto ;
2+
3+ import lombok .AllArgsConstructor ;
4+ import lombok .Getter ;
5+
6+ @ Getter
7+ @ AllArgsConstructor
8+ public class StreakCountResponse {
9+ private Long userNo ;
10+ private int streakCount ;
11+ }
You can’t perform that action at this time.
0 commit comments