-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #153 from gloddy-dev/feat/internal-user-get
[Feat]: User Internal Preview 조회 API 구현
- Loading branch information
Showing
12 changed files
with
102 additions
and
24 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
26 changes: 26 additions & 0 deletions
26
src/main/java/com/gloddy/server/user/api/intenal/UserInternalQueryController.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,26 @@ | ||
package com.gloddy.server.user.api.intenal; | ||
|
||
|
||
import com.gloddy.server.core.response.ApiResponse; | ||
import com.gloddy.server.user.application.internal.UserInternalQueryService; | ||
import com.gloddy.server.user.application.internal.dto.UserPreviewResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/api/internal/payload") | ||
@RequiredArgsConstructor | ||
public class UserInternalQueryController { | ||
|
||
private final UserInternalQueryService userInternalQueryService; | ||
|
||
@GetMapping("/users/{userId}") | ||
public ResponseEntity<UserPreviewResponse> getUserPreview(@PathVariable("userId") Long userId) { | ||
UserPreviewResponse response = userInternalQueryService.getUserPreview(userId); | ||
return ApiResponse.ok(response); | ||
} | ||
} |
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
19 changes: 19 additions & 0 deletions
19
src/main/java/com/gloddy/server/user/application/internal/UserInternalQueryService.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,19 @@ | ||
package com.gloddy.server.user.application.internal; | ||
|
||
import com.gloddy.server.user.application.internal.dto.UserPreviewResponse; | ||
import com.gloddy.server.user.domain.handler.UserQueryHandler; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional(readOnly = true) | ||
public class UserInternalQueryService { | ||
|
||
private final UserQueryHandler userQueryHandler; | ||
|
||
public UserPreviewResponse getUserPreview(Long userId) { | ||
return userQueryHandler.findUserPreviewById(userId); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/gloddy/server/user/application/internal/dto/UserPreviewResponse.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,11 @@ | ||
package com.gloddy.server.user.application.internal.dto; | ||
|
||
import com.gloddy.server.user.domain.vo.ReliabilityLevel; | ||
import com.querydsl.core.annotations.QueryProjection; | ||
|
||
public record UserPreviewResponse(Long id, Boolean isCertifiedStudent, String profileImage, String nickName, | ||
String countryName, String countryImage, ReliabilityLevel reliabilityLevel) { | ||
@QueryProjection | ||
public UserPreviewResponse { | ||
} | ||
} |
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
6 changes: 4 additions & 2 deletions
6
src/main/java/com/gloddy/server/user/domain/handler/UserQueryHandler.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 |
---|---|---|
@@ -1,21 +1,23 @@ | ||
package com.gloddy.server.user.domain.handler; | ||
|
||
import com.gloddy.server.user.application.internal.dto.UserPreviewResponse; | ||
import com.gloddy.server.user.domain.User; | ||
import com.gloddy.server.user.domain.vo.Phone; | ||
import com.gloddy.server.user.domain.vo.kind.Status; | ||
import com.gloddy.server.user.domain.dto.PraiseResponse; | ||
|
||
import java.util.Optional; | ||
|
||
public interface UserQueryHandler { | ||
User findById(Long id); | ||
|
||
User findByIdAndStatus(Long id, Status status); | ||
User findByIdFetch(Long id); | ||
Optional<User> findByEmail(String email); | ||
|
||
boolean existsByNickname(String nickname); | ||
|
||
Optional<User> findByPhone(Phone phone); | ||
|
||
PraiseResponse.GetPraiseForUser findPraiseDtoByUserId(Long userId); | ||
|
||
UserPreviewResponse findUserPreviewById(Long userId); | ||
} |
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