Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ public interface LostItemChatRoomApi {
""")
})
),
@ApiResponse(responseCode = "404", description = "리소스 없음",
content = @Content(mediaType = "application/json", examples = {
@ExampleObject(name = "채팅 상대방 탈퇴", summary = "채팅 상대방이 존재하지 않습니다.", value = """
{
"message": "채팅 상대방이 존재하지 않습니다.",
"errorTraceId": "123e4567-e89b-12d3-a456-426614174000",
"code": "NOT_FOUND_CHAT_PARTNER"
}
""")
})
)
})
@Operation(
summary = "분실물 게시글에서 직접 채팅방 진입시 채팅방 데이터 생성, 필요한 데이터 반환",
Expand Down Expand Up @@ -110,6 +121,13 @@ ResponseEntity<ChatRoomInfoResponse> createLostItemChatRoom(
"errorTraceId": "123e4567-e89b-12d3-a456-426614174000",
"code": "NOT_FOUND_LOST_ITEM_CHATROOM"
}
"""),
@ExampleObject(name = "채팅 상대방 탈퇴", summary = "채팅 상대방이 존재하지 않습니다.", value = """
{
"message": "채팅 상대방이 존재하지 않습니다.",
"errorTraceId": "123e4567-e89b-12d3-a456-426614174000",
"code": "NOT_FOUND_CHAT_PARTNER"
}
""")
})
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package in.koreatech.koin.domain.community.lostitem.chatroom.service;

import java.util.Optional;

import org.springframework.stereotype.Service;

import in.koreatech.koin.domain.user.model.User;
import in.koreatech.koin.global.code.ApiResponseCode;
import in.koreatech.koin.global.exception.CustomException;
import in.koreatech.koin.domain.community.article.model.Article;
Expand Down Expand Up @@ -31,6 +34,8 @@ public String getChatPartnerProfileImage(Integer articleId) {
() -> CustomException.of(ApiResponseCode.NOT_FOUND_ARTICLE)
);

return lostItemArticle.getAuthor().getProfileImageUrl();
User author = Optional.ofNullable(lostItemArticle.getAuthor())
.orElseThrow(() -> CustomException.of(ApiResponseCode.NOT_FOUND_CHAT_PARTNER));
return author.getProfileImageUrl();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public enum ApiResponseCode {
NOT_FOUND_SHOP(HttpStatus.NOT_FOUND, "상점이 존재하지 않습니다."),
NOT_FOUND_COOP_SEMESTER(HttpStatus.NOT_FOUND, "해당 학기가 존재하지 않습니다."),
NOT_FOUND_SHOP_ORDER_SERVICE_REQUEST(HttpStatus.NOT_FOUND, "상점 서비스 전환 요청이 존재하지 않습니다."),
NOT_FOUND_CHAT_PARTNER(HttpStatus.NOT_FOUND, "채팅 상대방이 존재하지 않습니다."),

/**
* 409 CONFLICT (중복 혹은 충돌)
Expand Down
Loading