Skip to content

Commit 8716f82

Browse files
authored
[fix] 작가 공개 프로필 상세조회 ID 불일치 오류 해결 (#388)
1 parent 298951b commit 8716f82

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/main/java/com/back/domain/artist/dto/response/ArtistPublicProfileResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public record ArtistPublicProfileResponse(
4141
) {
4242
public static ArtistPublicProfileResponse from(ArtistProfile artistProfile) {
4343
return new ArtistPublicProfileResponse(
44-
artistProfile.getUser().getId(),
44+
artistProfile.getId(),
4545
artistProfile.getArtistName(),
4646
artistProfile.getProfileImageUrl(),
4747
artistProfile.getDescription(),

src/main/java/com/back/domain/artist/service/ArtistPublicService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public ArtistPublicProfileResponse getPublicProfile(Long artistId) {
5353
log.info("작가 공개 프로필 조회 시작 - artistId: {}", artistId);
5454

5555
// 작가 프로필 조회
56-
ArtistProfile artistProfile = artistProfileRepository.findByUserId(artistId)
56+
ArtistProfile artistProfile = artistProfileRepository.findById(artistId)
5757
.orElseThrow(() -> new ServiceException("404", "존재하지 않는 작가입니다."));
5858

5959
log.info("작가 공개 프로필 조회 완료 - artistId: {}, artistName: {}",

src/test/java/com/back/domain/artist/controller/ArtistControllerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,15 +584,15 @@ void t18() throws Exception {
584584
artistProfileRepository.save(profile);
585585

586586
// when
587-
ResultActions resultActions = mvc.perform(get("/api/artist/profile/" + user1.getId())
587+
ResultActions resultActions = mvc.perform(get("/api/artist/profile/" + profile.getId())
588588
.contentType(MediaType.APPLICATION_JSON))
589589
.andDo(print());
590590

591591
// then
592592
resultActions.andExpect(status().isOk())
593593
.andExpect(jsonPath("$.resultCode").value("200"))
594594
.andExpect(jsonPath("$.msg").value("작가 프로필 조회 성공"))
595-
.andExpect(jsonPath("$.data.artistId").value(user1.getId()))
595+
.andExpect(jsonPath("$.data.artistId").value(profile.getId()))
596596
.andExpect(jsonPath("$.data.artistName").value("유저1작가"))
597597
.andExpect(jsonPath("$.data.description").value("전통 도자기를 현대적으로 재해석하는 작가입니다."))
598598
.andExpect(jsonPath("$.data.mainProducts").value("도자기, 머그컵"))

0 commit comments

Comments
 (0)