Skip to content

Commit

Permalink
[debug] #111 오픈톡 참여하기 에러 확인 (findByUserAndOpentalk)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeesw committed Aug 25, 2024
1 parent 024ccd0 commit c0667a5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.book.backend.exception.CustomException;
import com.book.backend.exception.ErrorCode;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.modelmapper.ModelMapper;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
Expand All @@ -19,6 +20,7 @@

@Component
@RequiredArgsConstructor
@Slf4j
public class MessageMapper {
private final ModelMapper mapper;
private final UserService userService;
Expand All @@ -27,6 +29,7 @@ public class MessageMapper {

@Transactional
public Message convertToMessage(MessageRequestDto dto) {
log.trace("MessageMapper > convertToMessage()");
User user = userService.loadLoggedinUser();
if (user == null) {
throw new CustomException(ErrorCode.USER_NOT_FOUND);
Expand All @@ -44,6 +47,7 @@ public Message convertToMessage(MessageRequestDto dto) {
}

public MessageResponseDto convertToMessageResponseDto(Message message) {
log.trace("MessageMapper > convertToMessageResponseDto()");
User user = userRepository.findByLoginId(message.getUser().getLoginId()).orElseThrow();
return MessageResponseDto.builder()
.nickname(user.getNickname())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ public OpentalkJoinResponseDto joinOpentalk(String isbn, int pageSize){
// 즐찾 여부
User user = userService.loadLoggedinUser();
boolean isFavorite = userOpentalkRepository.findByUserAndOpentalk(user, opentalk) != null;
log.debug("즐찾여부 문제?", isFavorite);

return OpentalkJoinResponseDto.builder()
.opentalkId(opentalk.getOpentalkId())
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/com/book/backend/global/SwaggerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ public OpenAPI api() {
.addList("Bearer Token");

Server server = new Server();
server.setUrl("https://www.readables.site");
server.setUrl("localhost:8080");

return new OpenAPI()
.components(new Components().addSecuritySchemes("Bearer Token", apiKey))
.addSecurityItem(securityRequirement)
.addServersItem(server);
.addSecurityItem(securityRequirement);
}
}

0 comments on commit c0667a5

Please sign in to comment.