Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 휴지통 관련 기능 구현 #53

Merged
merged 22 commits into from
Oct 23, 2023
Merged

feat: 휴지통 관련 기능 구현 #53

merged 22 commits into from
Oct 23, 2023

Conversation

Choi-Jungbin
Copy link
Contributor

@Choi-Jungbin Choi-Jungbin commented Oct 21, 2023

Issue #52

어떤 페이지인지 이미지를 띄워야 하는데 앨범 페이지에서 가지고 오는지 논의가 필요합니다.
페이지 영구 삭제에 대한 논의가 필요합니다.

Description

휴지통 관련 기능 구현

Tasks

  • 휴지통 조회 구현
  • 휴지통 복구 구현

import javax.persistence.Table;

@Entity
@Table(name = "albumPage")
Copy link
Contributor

Choose a reason for hiding this comment

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

굳이 name을 지정하지 않으셔도 될거 같아요!

import java.time.LocalDateTime;

@Entity
@Table(name = "trashs")
Copy link
Contributor

Choose a reason for hiding this comment

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

해당 테이블은 trashs라고 명명하신 이유가 있을까요?

private final TrashService trashService;

//휴지통 조회 GET
@GetMapping("/")
Copy link
Contributor

Choose a reason for hiding this comment

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

해당 엔드포인트는 불필요해 보입니다!


@RestController
@RequiredArgsConstructor
@RequestMapping("/albums/{albumId}/trashes")
Copy link
Contributor

@MinseokGo MinseokGo Oct 22, 2023

Choose a reason for hiding this comment

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

작성하신 대로 trash의 복수형이 trashs인데 trashs에서 명세를 바꾸는 것이 좋을듯 합니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

잘 이해가 안가서 그러는데 trashs로 명세를 다 바꾸는 것이 좋다는 의미인가요?

Copy link
Contributor

Choose a reason for hiding this comment

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

trashes 로 바뀌어야 하지 않을까 라는 의견입니다..ㅎㅎ


public interface TrashJPARepository extends JpaRepository<Trash, Long> {
@Query("select t from Trash t where t.albumPage.album.id = :albumId")
List<Trash> findAllByAlbumId(@Param("albumId") Long albumId);
Copy link
Contributor

@MinseokGo MinseokGo Oct 22, 2023

Choose a reason for hiding this comment

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

이 부분도 Spring Data JPA 라이브러리가 제공하는 쿼리 메소드를 활용하면 좋을듯 합니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

jpa 기본 메서드가 findAllByAlbumPage_Album_Id라 findAllByAlbumId으로 직접 쿼리를 적는 것이 직관적이라 생각했습니다. 둘의 성능 차이는 없는데 기본 메서드로 변경하는 것이 좋을까요?

Copy link
Contributor

Choose a reason for hiding this comment

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

휴지통이 가지는 앨범 페이지의 앨범 id를 참조하네요

쿼리(@query)로 작성하는 것이 더 가독성이 좋아보입니다.

좋은 고민인 거 같아요!

return new TrashesFindResponseDTO(albumId, trashes);
}

public void restoreTrash(Long trashId){
Copy link
Contributor

Choose a reason for hiding this comment

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

트랜잭션 처리를 해야하지 않을까요!

@Getter
public class TrashesFindResponseDTO {
private Long albumId;
private List<TrashDTO> Trashes;
Copy link
Contributor

Choose a reason for hiding this comment

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

trashes라고 명명하는 게 더 좋을거 같아요! 오타인거 같네요.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

이름 관련은 둘이 작성하다 보니 체크가 덜 된 것 같습니다. 확인해서 통일하겠습니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

휴지통 관련 기능 구현
3 participants