Skip to content

Conversation

@mirlee0304
Copy link
Member

@mirlee0304 mirlee0304 commented Jan 22, 2025

Pull request

Related issue

#31

Motivation and context

워크스페이스 채널 목록 조회 api 구현
요청 @PathVariable Long workspaceId
응답
public class ChannelListDTO {
private List joinedChannels;
private List unjoinedChannels;
}
public class SimpleChannel {
private Long channelId;
private String channelName;
private LocalDateTime createdAt;
}

Solution

스크린샷 2025-01-23 오후 1 48 57

How has this been tested

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the docs/CONTRIBUTING.md document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@mirlee0304 mirlee0304 added ✨ Feature 기능 추가 🎮 BE 백엔드 무조건 스프린트내에 해야하는 것들 labels Jan 22, 2025
@mirlee0304 mirlee0304 self-assigned this Jan 22, 2025
Copy link
Collaborator

@ki-met-hoon ki-met-hoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생많으셨습니다 👍
리뷰 작성 완료했습니다!

log.info("Getting channels for workspace with id: {}", workspaceId);

ChannelListDTO channelListDTO = workSpaceService.getChannels(userId, workspaceId);
return ResponseEntity.ok().body(channelListDTO);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok method 매개변수로 body값을 넣을 수 있지 않나요?

@Column(name = "name", length = 100, nullable = false)
private String name;

@CreationTimestamp
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MappedSuperClass로 항상 사용되는 createdAt, updatedAt , id 변수를 통합시키는건 어떨까요?

import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;

public interface UserChannelRepository extends JpaRepository<UserChannel, Long> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ChannelRepository는 @Repository 어노테이션이 있는데 얘는 없는 것 같아요!


@Repository
public interface ChannelRepository extends JpaRepository<Channels, Long> {
List<Channels> findByWorkSpaceWorkspaceId(Long workspaceId);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

얘는 Optional을 사용하지 않은 이유가 있을까요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

디폴트 채널이 무조건 있다고 가정했기 때문입니다!

private final ChannelRepository channelRepository;
private final UserChannelRepository userChannelRepository;

public ChannelListDTO getChannels(Long userId, Long workspaceId) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getChannels method가 많은 책임을 가지고 있는 것 같아요! 기능별로 method를 분리하는건 어떨까요?

@mirlee0304 mirlee0304 merged commit 698fb69 into dev Jan 23, 2025
1 check failed
@mirlee0304 mirlee0304 deleted the be-feat/workspace-CHlist branch February 25, 2025 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Feature 기능 추가 무조건 스프린트내에 해야하는 것들 🎮 BE 백엔드

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants